-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #7605 - xordi:issue-7548-fix, r=giraffate
Issue 7548 fix Close #7548 changelog: [`bool_assert_comparison`] fixes should be emitted only in case they are comparing a value of a type that implements the `Not` trait with an output of type `bool` against a boolean literal.
- Loading branch information
Showing
4 changed files
with
169 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,136 @@ | ||
error: used `assert_eq!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:16:5 | ||
--> $DIR/bool_assert_comparison.rs:69:5 | ||
| | ||
LL | assert_eq!("a".is_empty(), false); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ||
| | ||
= note: `-D clippy::bool-assert-comparison` implied by `-D warnings` | ||
|
||
error: used `assert_eq!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:17:5 | ||
--> $DIR/bool_assert_comparison.rs:70:5 | ||
| | ||
LL | assert_eq!("".is_empty(), true); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ||
|
||
error: used `assert_eq!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:18:5 | ||
--> $DIR/bool_assert_comparison.rs:71:5 | ||
| | ||
LL | assert_eq!(true, "".is_empty()); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ||
|
||
error: used `assert_eq!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:76:5 | ||
| | ||
LL | assert_eq!(b, true); | ||
| ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ||
|
||
error: used `assert_ne!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:24:5 | ||
--> $DIR/bool_assert_comparison.rs:79:5 | ||
| | ||
LL | assert_ne!("a".is_empty(), false); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ||
|
||
error: used `assert_ne!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:25:5 | ||
--> $DIR/bool_assert_comparison.rs:80:5 | ||
| | ||
LL | assert_ne!("".is_empty(), true); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ||
|
||
error: used `assert_ne!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:26:5 | ||
--> $DIR/bool_assert_comparison.rs:81:5 | ||
| | ||
LL | assert_ne!(true, "".is_empty()); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ||
|
||
error: used `assert_ne!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:86:5 | ||
| | ||
LL | assert_ne!(b, true); | ||
| ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ||
|
||
error: used `debug_assert_eq!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:32:5 | ||
--> $DIR/bool_assert_comparison.rs:89:5 | ||
| | ||
LL | debug_assert_eq!("a".is_empty(), false); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ||
|
||
error: used `debug_assert_eq!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:33:5 | ||
--> $DIR/bool_assert_comparison.rs:90:5 | ||
| | ||
LL | debug_assert_eq!("".is_empty(), true); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ||
|
||
error: used `debug_assert_eq!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:34:5 | ||
--> $DIR/bool_assert_comparison.rs:91:5 | ||
| | ||
LL | debug_assert_eq!(true, "".is_empty()); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ||
|
||
error: used `debug_assert_eq!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:96:5 | ||
| | ||
LL | debug_assert_eq!(b, true); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ||
|
||
error: used `debug_assert_ne!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:40:5 | ||
--> $DIR/bool_assert_comparison.rs:99:5 | ||
| | ||
LL | debug_assert_ne!("a".is_empty(), false); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ||
|
||
error: used `debug_assert_ne!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:41:5 | ||
--> $DIR/bool_assert_comparison.rs:100:5 | ||
| | ||
LL | debug_assert_ne!("".is_empty(), true); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ||
|
||
error: used `debug_assert_ne!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:42:5 | ||
--> $DIR/bool_assert_comparison.rs:101:5 | ||
| | ||
LL | debug_assert_ne!(true, "".is_empty()); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ||
|
||
error: used `debug_assert_ne!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:106:5 | ||
| | ||
LL | debug_assert_ne!(b, true); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ||
|
||
error: used `assert_eq!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:50:5 | ||
--> $DIR/bool_assert_comparison.rs:111:5 | ||
| | ||
LL | assert_eq!("a".is_empty(), false, "tadam {}", 1); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ||
|
||
error: used `assert_eq!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:51:5 | ||
--> $DIR/bool_assert_comparison.rs:112:5 | ||
| | ||
LL | assert_eq!("a".is_empty(), false, "tadam {}", true); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ||
|
||
error: used `assert_eq!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:52:5 | ||
--> $DIR/bool_assert_comparison.rs:113:5 | ||
| | ||
LL | assert_eq!(false, "a".is_empty(), "tadam {}", true); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ||
|
||
error: used `debug_assert_eq!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:56:5 | ||
--> $DIR/bool_assert_comparison.rs:118:5 | ||
| | ||
LL | debug_assert_eq!("a".is_empty(), false, "tadam {}", 1); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ||
|
||
error: used `debug_assert_eq!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:57:5 | ||
--> $DIR/bool_assert_comparison.rs:119:5 | ||
| | ||
LL | debug_assert_eq!("a".is_empty(), false, "tadam {}", true); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ||
|
||
error: used `debug_assert_eq!` with a literal bool | ||
--> $DIR/bool_assert_comparison.rs:58:5 | ||
--> $DIR/bool_assert_comparison.rs:120:5 | ||
| | ||
LL | debug_assert_eq!(false, "a".is_empty(), "tadam {}", true); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ||
|
||
error: aborting due to 18 previous errors | ||
error: aborting due to 22 previous errors | ||
|