Skip to content

Commit

Permalink
Improve the warning messages for deprecated attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
weiznich authored and pksunkara committed Nov 24, 2021
1 parent 30075e2 commit 24fcf3c
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 214 deletions.
Original file line number Diff line number Diff line change
@@ -1,116 +1,80 @@
warning: #[belongs_to] attribute form is deprecated
= help: use `#[diesel(belongs_to(User, foreign_key = mykey))]` format instead

error: unexpected end of input, expected parentheses
--> $DIR/deprecated_belongs_to.rs:29:3
|
29 | #[belongs_to]
| ^^^^^^^^^^

warning: #[belongs_to] attribute form is deprecated
= help: use `#[diesel(belongs_to(User, foreign_key = mykey))]` format instead

error: expected parentheses
--> $DIR/deprecated_belongs_to.rs:36:14
|
36 | #[belongs_to = Bar]
| ^

warning: #[belongs_to] attribute form is deprecated
= help: use `#[diesel(belongs_to(User, foreign_key = mykey))]` format instead

error: unexpected end of input, expected identifier
--> $DIR/deprecated_belongs_to.rs:43:13
|
43 | #[belongs_to()]
| ^^

warning: #[belongs_to] attribute form is deprecated
= help: use `#[diesel(belongs_to(User, foreign_key = mykey))]` format instead

error: expected identifier
--> $DIR/deprecated_belongs_to.rs:50:14
|
50 | #[belongs_to("what")]
| ^^^^^^

warning: #[belongs_to] attribute form is deprecated
= help: use `#[diesel(belongs_to(User, foreign_key = mykey))]` format instead

error: unexpected end of input, expected `=`
--> $DIR/deprecated_belongs_to.rs:57:14
|
57 | #[belongs_to(parent)]
| ^^^^^^

warning: #[belongs_to] attribute form is deprecated
= help: use `#[diesel(belongs_to(User, foreign_key = mykey))]` format instead

error: expected `=`
--> $DIR/deprecated_belongs_to.rs:64:20
|
64 | #[belongs_to(parent())]
| ^^

warning: #[belongs_to] attribute form is deprecated
= help: use `#[diesel(belongs_to(User, foreign_key = mykey))]` format instead

error: expected string literal
--> $DIR/deprecated_belongs_to.rs:71:23
|
71 | #[belongs_to(parent = 1)]
| ^

warning: #[belongs_to] attribute form is deprecated
= help: use `#[diesel(belongs_to(User, foreign_key = mykey))]` format instead

error: expected identifier
--> $DIR/deprecated_belongs_to.rs:78:23
|
78 | #[belongs_to(parent = "1")]
| ^^^

warning: #[belongs_to] attribute form is deprecated
= help: use `#[diesel(belongs_to(User, foreign_key = mykey))]` format instead

warning: #[belongs_to] attribute form is deprecated
= help: use `#[diesel(belongs_to(User, foreign_key = mykey))]` format instead
= help: use `#[diesel(belongs_to(Bar))]` instead

error: expected `foreign_key`
--> $DIR/deprecated_belongs_to.rs:92:19
|
92 | #[belongs_to(Bar, what)]
| ^^^^

warning: #[belongs_to] attribute form is deprecated
= help: use `#[diesel(belongs_to(User, foreign_key = mykey))]` format instead

error: unexpected end of input, expected `=`
--> $DIR/deprecated_belongs_to.rs:99:19
|
99 | #[belongs_to(Bar, foreign_key)]
| ^^^^^^^^^^^

warning: #[belongs_to] attribute form is deprecated
= help: use `#[diesel(belongs_to(User, foreign_key = mykey))]` format instead

error: expected string literal
--> $DIR/deprecated_belongs_to.rs:106:33
|
106 | #[belongs_to(Bar, foreign_key = 1)]
| ^

warning: #[belongs_to] attribute form is deprecated
= help: use `#[diesel(belongs_to(User, foreign_key = mykey))]` format instead

error: expected identifier
--> $DIR/deprecated_belongs_to.rs:113:33
|
113 | #[belongs_to(Bar, foreign_key = "1")]
| ^^^

warning: #[belongs_to] attribute form is deprecated
= help: use `#[diesel(belongs_to(User, foreign_key = mykey))]` format instead
= help: use `#[diesel(belongs_to(Baz, foreign_key = bar_id))]` instead

error: unexpected token: `Bar`
--> $DIR/deprecated_belongs_to.rs:36:16
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,30 @@
warning: #[changeset_options] attribute form is deprecated
= help: use `#[diesel(treat_none_as_null = true)]` format instead

warning: #[changeset_options] attribute form is deprecated
= help: use `#[diesel(treat_none_as_null = true)]` format instead
= help: use `#[diesel(treat_none_as_null = true)]` instead

error: unexpected end of input, expected parentheses
--> $DIR/deprecated_changeset_options.rs:21:3
|
21 | #[changeset_options]
| ^^^^^^^^^^^^^^^^^

warning: #[changeset_options] attribute form is deprecated
= help: use `#[diesel(treat_none_as_null = true)]` format instead

error: unexpected end of input, expected identifier
--> $DIR/deprecated_changeset_options.rs:29:20
|
29 | #[changeset_options()]
| ^^

warning: #[changeset_options] attribute form is deprecated
= help: use `#[diesel(treat_none_as_null = true)]` format instead

error: expected `treat_none_as_null`
--> $DIR/deprecated_changeset_options.rs:37:21
|
37 | #[changeset_options(what)]
| ^^^^

warning: #[changeset_options] attribute form is deprecated
= help: use `#[diesel(treat_none_as_null = true)]` format instead

error: unexpected end of input, expected `=`
--> $DIR/deprecated_changeset_options.rs:45:21
|
45 | #[changeset_options(treat_none_as_null)]
| ^^^^^^^^^^^^^^^^^^

warning: #[changeset_options] attribute form is deprecated
= help: use `#[diesel(treat_none_as_null = true)]` format instead

error: expected boolean literal
--> $DIR/deprecated_changeset_options.rs:53:42
|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +1,31 @@
warning: #[column_name] attribute form is deprecated
= help: use `#[diesel(column_name = name)]` format instead
= help: use `#[diesel(column_name = name)]` instead

warning: #[column_name] attribute form is deprecated
= help: use `#[diesel(column_name = name)]` format instead

warning: #[column_name] attribute form is deprecated
= help: use `#[diesel(column_name = name)]` format instead
= help: use `#[diesel(column_name = name)]` instead

error: unexpected end of input, expected `=`
--> $DIR/deprecated_column_name.rs:24:7
|
24 | #[column_name]
| ^^^^^^^^^^^

warning: #[column_name] attribute form is deprecated
= help: use `#[diesel(column_name = name)]` format instead

error: expected `=`
--> $DIR/deprecated_column_name.rs:31:18
|
31 | #[column_name()]
| ^^

warning: #[column_name] attribute form is deprecated
= help: use `#[diesel(column_name = name)]` format instead

error: expected string literal
--> $DIR/deprecated_column_name.rs:38:21
|
38 | #[column_name = 1]
| ^

warning: #[column_name] attribute form is deprecated
= help: use `#[diesel(column_name = name)]` format instead
= help: use `#[diesel(column_name = 1)]` instead

error: expected identifier
error: expected string literal
--> $DIR/deprecated_column_name.rs:45:21
|
45 | #[column_name = "1"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
warning: #[mysql_type] attribute form is deprecated
= help: use `#[diesel(mysql_type(name = "TypeName"))]` format instead

error: unexpected end of input, expected `=`
--> $DIR/deprecated_mysql_type.rs:6:3
|
6 | #[mysql_type]
| ^^^^^^^^^^

warning: #[mysql_type] attribute form is deprecated
= help: use `#[diesel(mysql_type(name = "TypeName"))]` format instead

error: expected `=`
--> $DIR/deprecated_mysql_type.rs:10:13
|
10 | #[mysql_type()]
| ^^

warning: #[mysql_type] attribute form is deprecated
= help: use `#[diesel(mysql_type(name = "TypeName"))]` format instead

error: expected string literal
--> $DIR/deprecated_mysql_type.rs:14:16
|
14 | #[mysql_type = 1]
| ^

warning: #[mysql_type] attribute form is deprecated
= help: use `#[diesel(mysql_type(name = "TypeName"))]` format instead
= help: use `#[diesel(mysql_type(name = "foo"))]` instead

error[E0599]: no variant or associated item named `foo` found for enum `MysqlType` in the current scope
--> $DIR/deprecated_mysql_type.rs:17:10
Expand Down
Original file line number Diff line number Diff line change
@@ -1,107 +1,71 @@
warning: #[postgres] attribute form is deprecated
= help: use `#[diesel(postgres_type(name = "TypeName", schema = "public"))]` format instead

error: unexpected end of input, expected parentheses
--> $DIR/deprecated_postgres_type.rs:6:3
|
6 | #[postgres]
| ^^^^^^^^

warning: #[postgres] attribute form is deprecated
= help: use `#[diesel(postgres_type(name = "TypeName", schema = "public"))]` format instead

error: expected `oid` and `array_oid` attribute or `name` attribute
--> $DIR/deprecated_postgres_type.rs:10:11
|
10 | #[postgres()]
| ^^

warning: #[postgres] attribute form is deprecated
= help: use `#[diesel(postgres_type(name = "TypeName", schema = "public"))]` format instead

error: expected parentheses
--> $DIR/deprecated_postgres_type.rs:14:12
|
14 | #[postgres = "foo"]
| ^

warning: #[postgres] attribute form is deprecated
= help: use `#[diesel(postgres_type(name = "TypeName", schema = "public"))]` format instead

error: unexpected end of input, expected `=`
--> $DIR/deprecated_postgres_type.rs:18:12
|
18 | #[postgres(type_name)]
| ^^^^^^^^^

warning: #[postgres] attribute form is deprecated
= help: use `#[diesel(postgres_type(name = "TypeName", schema = "public"))]` format instead

error: expected `=`
--> $DIR/deprecated_postgres_type.rs:22:21
|
22 | #[postgres(type_name())]
| ^^

warning: #[postgres] attribute form is deprecated
= help: use `#[diesel(postgres_type(name = "TypeName", schema = "public"))]` format instead

error: expected string literal
--> $DIR/deprecated_postgres_type.rs:26:24
|
26 | #[postgres(type_name = 1)]
| ^

warning: #[postgres] attribute form is deprecated
= help: use `#[diesel(postgres_type(name = "TypeName", schema = "public"))]` format instead

error: unexpected `oid` when `name` is present
--> $DIR/deprecated_postgres_type.rs:30:37
|
30 | #[postgres(type_name = "foo", oid = "2", array_oid = "3")]
| ^^^

warning: #[postgres] attribute form is deprecated
= help: use `#[diesel(postgres_type(name = "TypeName", schema = "public"))]` format instead

error: unexpected `array_oid` when `name` is present
--> $DIR/deprecated_postgres_type.rs:34:43
|
34 | #[postgres(type_name = "foo", array_oid = "3")]
| ^^^

warning: #[postgres] attribute form is deprecated
= help: use `#[diesel(postgres_type(name = "TypeName", schema = "public"))]` format instead

error: expected `oid` and `array_oid` attribute or `name` attribute
--> $DIR/deprecated_postgres_type.rs:38:11
|
38 | #[postgres(oid = "2")]
| ^^^^^^^^^^^

warning: #[postgres] attribute form is deprecated
= help: use `#[diesel(postgres_type(name = "TypeName", schema = "public"))]` format instead

error: expected string literal
--> $DIR/deprecated_postgres_type.rs:42:18
|
42 | #[postgres(oid = 1, array_oid = "1")]
| ^

warning: #[postgres] attribute form is deprecated
= help: use `#[diesel(postgres_type(name = "TypeName", schema = "public"))]` format instead

error: expected string literal
--> $DIR/deprecated_postgres_type.rs:46:35
|
46 | #[postgres(oid = "1", array_oid = 1)]
| ^

warning: #[postgres] attribute form is deprecated
= help: use `#[diesel(postgres_type(name = "TypeName", schema = "public"))]` format instead

warning: #[postgres] attribute form is deprecated
= help: use `#[diesel(postgres_type(name = "TypeName", schema = "public"))]` format instead
= help: use `#[diesel(postgres_type(oid = 1, array_oid = 1))]` instead

error: unknown attribute
--> $DIR/deprecated_postgres_type.rs:54:12
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,29 @@
warning: #[primary_key] attribute form is deprecated
= help: use `#[diesel(primary_key(id1, id2))]` format instead

error: expected `,`
--> $DIR/deprecated_primary_key.rs:12:23
|
12 | #[primary_key(id, bar = "baz")]
| ^

warning: #[primary_key] attribute form is deprecated
= help: use `#[diesel(primary_key(id1, id2))]` format instead

error: expected `,`
--> $DIR/deprecated_primary_key.rs:19:22
|
19 | #[primary_key(id, qux(id))]
| ^^^^

warning: #[primary_key] attribute form is deprecated
= help: use `#[diesel(primary_key(id1, id2))]` format instead

error: unexpected end of input, expected parentheses
--> $DIR/deprecated_primary_key.rs:26:3
|
26 | #[primary_key]
| ^^^^^^^^^^^

warning: #[primary_key] attribute form is deprecated
= help: use `#[diesel(primary_key(id1, id2))]` format instead

error: expected parentheses
--> $DIR/deprecated_primary_key.rs:33:15
|
33 | #[primary_key = id]
| ^

warning: #[primary_key] attribute form is deprecated
= help: use `#[diesel(primary_key(id1, id2))]` format instead
= help: use `#[diesel(primary_key(id, name))]` instead

error: Deriving `AsChangeset` on a structure that only contains primary keys isn't supported.

Expand Down
Loading

0 comments on commit 24fcf3c

Please sign in to comment.