Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
msg,
suggestions,
applicability,
SuggestionStyle::ShowCode,
SuggestionStyle::ShowAlways,
)
} }

Expand Down
7 changes: 6 additions & 1 deletion src/tools/clippy/tests/ui/blocks_in_conditions.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ error: this boolean expression can be simplified
--> tests/ui/blocks_in_conditions.rs:48:8
|
LL | if true && x == 3 { 6 } else { 10 }
| ^^^^^^^^^^^^^^ help: try: `x == 3`
| ^^^^^^^^^^^^^^
|
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]`
help: try
|
LL - if true && x == 3 { 6 } else { 10 }
LL + if x == 3 { 6 } else { 10 }
|

error: aborting due to 3 previous errors

7 changes: 6 additions & 1 deletion src/tools/clippy/tests/ui/crashes/ice-96721.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ error: malformed `path` attribute input
--> tests/ui/crashes/ice-96721.rs:7:1
|
LL | #[path = foo!()]
| ^^^^^^^^^^^^^^^^ help: must be of the form: `#[path = "file"]`
| ^^^^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute>
help: must be of the form
|
LL - #[path = foo!()]
LL + #[path = "file"]
|

error: aborting due to 1 previous error

79 changes: 69 additions & 10 deletions src/tools/clippy/tests/ui/nonminimal_bool.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,87 @@ error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:17:13
|
LL | let _ = !true;
| ^^^^^ help: try: `false`
| ^^^^^
|
= note: `-D clippy::nonminimal-bool` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]`
help: try
|
LL - let _ = !true;
LL + let _ = false;
|

error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:20:13
|
LL | let _ = !false;
| ^^^^^^ help: try: `true`
| ^^^^^^
|
help: try
|
LL - let _ = !false;
LL + let _ = true;
|

error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:23:13
|
LL | let _ = !!a;
| ^^^ help: try: `a`
| ^^^
|
help: try
|
LL - let _ = !!a;
LL + let _ = a;
|

error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:26:13
|
LL | let _ = false || a;
| ^^^^^^^^^^ help: try: `a`
| ^^^^^^^^^^
|
help: try
|
LL - let _ = false || a;
LL + let _ = a;
|

error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:32:13
|
LL | let _ = !(!a && b);
| ^^^^^^^^^^ help: try: `a || !b`
| ^^^^^^^^^^
|
help: try
|
LL - let _ = !(!a && b);
LL + let _ = a || !b;
|

error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:35:13
|
LL | let _ = !(!a || b);
| ^^^^^^^^^^ help: try: `a && !b`
| ^^^^^^^^^^
|
help: try
|
LL - let _ = !(!a || b);
LL + let _ = a && !b;
|

error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:38:13
|
LL | let _ = !a && !(b && c);
| ^^^^^^^^^^^^^^^ help: try: `!(a || b && c)`
| ^^^^^^^^^^^^^^^
|
help: try
|
LL - let _ = !a && !(b && c);
LL + let _ = !(a || b && c);
|

error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:47:13
Expand Down Expand Up @@ -122,7 +163,13 @@ error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:90:8
|
LL | if matches!(true, true) && true {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(true, true)`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: try
|
LL - if matches!(true, true) && true {
LL + if matches!(true, true) {
|

error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:171:8
Expand Down Expand Up @@ -215,13 +262,25 @@ error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:212:8
|
LL | if !(a < 2.0 && !b) {
| ^^^^^^^^^^^^^^^^ help: try: `a >= 2.0 || b`
| ^^^^^^^^^^^^^^^^
|
help: try
|
LL - if !(a < 2.0 && !b) {
LL + if a >= 2.0 || b {
|

error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:231:12
|
LL | if !(matches!(ty, TyKind::Ref(_, _, _)) && !is_mutable(&expr)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!matches!(ty, TyKind::Ref(_, _, _)) || is_mutable(&expr)`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: try
|
LL - if !(matches!(ty, TyKind::Ref(_, _, _)) && !is_mutable(&expr)) {
LL + if !matches!(ty, TyKind::Ref(_, _, _)) || is_mutable(&expr) {
|

error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:251:8
Expand Down
16 changes: 14 additions & 2 deletions src/tools/clippy/tests/ui/nonminimal_bool_methods.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,25 @@ error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:20:13
|
LL | let _ = !(a.is_some() && !c);
| ^^^^^^^^^^^^^^^^^^^^ help: try: `a.is_none() || c`
| ^^^^^^^^^^^^^^^^^^^^
|
help: try
|
LL - let _ = !(a.is_some() && !c);
LL + let _ = a.is_none() || c;
|

error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:22:13
|
LL | let _ = !(a.is_some() || !c);
| ^^^^^^^^^^^^^^^^^^^^ help: try: `a.is_none() && c`
| ^^^^^^^^^^^^^^^^^^^^
|
help: try
|
LL - let _ = !(a.is_some() || !c);
LL + let _ = a.is_none() && c;
|

error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:24:26
Expand Down
8 changes: 7 additions & 1 deletion tests/ui/allocator/allocator-args.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ error: malformed `global_allocator` attribute input
--> $DIR/allocator-args.rs:10:1
|
LL | #[global_allocator(malloc)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[global_allocator]`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: must be of the form
|
LL - #[global_allocator(malloc)]
LL + #[global_allocator]
|

error: aborting due to 1 previous error

7 changes: 6 additions & 1 deletion tests/ui/attributes/crate-type-delimited.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ error[E0539]: malformed `crate_type` attribute input
--> $DIR/crate-type-delimited.rs:2:1
|
LL | #![crate_type(lib)]
| ^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_type = "crate type"]`
| ^^^^^^^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/reference/linkage.html>
help: must be of the form
|
LL - #![crate_type(lib)]
LL + #![crate_type = "crate type"]
|

error: aborting due to 1 previous error

Expand Down
6 changes: 5 additions & 1 deletion tests/ui/attributes/crate-type-empty.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ error[E0539]: malformed `crate_type` attribute input
--> $DIR/crate-type-empty.rs:2:1
|
LL | #![crate_type]
| ^^^^^^^^^^^^^^ help: must be of the form: `#![crate_type = "crate type"]`
| ^^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/reference/linkage.html>
help: must be of the form
|
LL | #![crate_type = "crate type"]
| ++++++++++++++

error: aborting due to 1 previous error

Expand Down
51 changes: 42 additions & 9 deletions tests/ui/attributes/crate-type-non-crate.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,39 @@ error[E0539]: malformed `crate_type` attribute input
--> $DIR/crate-type-non-crate.rs:5:1
|
LL | #[crate_type]
| ^^^^^^^^^^^^^ help: must be of the form: `#[crate_type = "crate type"]`
| ^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/reference/linkage.html>
help: must be of the form
|
LL | #[crate_type = "crate type"]
| ++++++++++++++

error[E0539]: malformed `crate_type` attribute input
--> $DIR/crate-type-non-crate.rs:7:1
|
LL | #[crate_type(lib)]
| ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[crate_type = "crate type"]`
| ^^^^^^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/reference/linkage.html>
help: must be of the form
|
LL - #[crate_type(lib)]
LL + #[crate_type = "crate type"]
|

error[E0539]: malformed `crate_type` attribute input
--> $DIR/crate-type-non-crate.rs:8:1
|
LL | #[crate_type("lib")]
| ^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[crate_type = "crate type"]`
| ^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/reference/linkage.html>
help: must be of the form
|
LL - #[crate_type("lib")]
LL + #[crate_type = "crate type"]
|

error: attribute value must be a literal
--> $DIR/crate-type-non-crate.rs:9:16
Expand All @@ -32,17 +46,27 @@ error[E0539]: malformed `crate_type` attribute input
--> $DIR/crate-type-non-crate.rs:12:1
|
LL | #[crate_type(foo)]
| ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[crate_type = "crate type"]`
| ^^^^^^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/reference/linkage.html>
help: must be of the form
|
LL - #[crate_type(foo)]
LL + #[crate_type = "crate type"]
|

error[E0539]: malformed `crate_type` attribute input
--> $DIR/crate-type-non-crate.rs:13:1
|
LL | #[crate_type("foo")]
| ^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[crate_type = "crate type"]`
| ^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/reference/linkage.html>
help: must be of the form
|
LL - #[crate_type("foo")]
LL + #[crate_type = "crate type"]
|

error: attribute value must be a literal
--> $DIR/crate-type-non-crate.rs:14:16
Expand All @@ -54,20 +78,29 @@ error[E0539]: malformed `crate_type` attribute input
--> $DIR/crate-type-non-crate.rs:17:1
|
LL | #[crate_type(1)]
| ^^^^^^^^^^^^^^^^ help: must be of the form: `#[crate_type = "crate type"]`
| ^^^^^^^^^^^^^^^^
|
= note: for more information, visit <https://doc.rust-lang.org/reference/linkage.html>
help: must be of the form
|
LL - #[crate_type(1)]
LL + #[crate_type = "crate type"]
|

error[E0539]: malformed `crate_type` attribute input
--> $DIR/crate-type-non-crate.rs:18:1
|
LL | #[crate_type = 1]
| ^^^^^^^^^^^^^^^-^
| | |
| | expected a string literal here
| help: must be of the form: `#[crate_type = "crate type"]`
| |
| expected a string literal here
|
= note: for more information, visit <https://doc.rust-lang.org/reference/linkage.html>
help: must be of the form
|
LL - #[crate_type = 1]
LL + #[crate_type = "crate type"]
|

error: aborting due to 9 previous errors

Expand Down
11 changes: 8 additions & 3 deletions tests/ui/attributes/expected-word.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ error[E0565]: malformed `cold` attribute input
|
LL | #[cold = true]
| ^^^^^^^------^
| | |
| | didn't expect any arguments here
| help: must be of the form: `#[cold]`
| |
| didn't expect any arguments here
|
help: must be of the form
|
LL - #[cold = true]
LL + #[cold]
|

error: aborting due to 1 previous error

Expand Down
Loading
Loading