-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thinggood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
rustfmt had this code in src/config/config_type.rs:431:45
/// Returns true if the config key was explicitely set and is the default value.
pub fn is_default(&self, key: &str) -> bool {
$(
if let stringify!($i) = key {
return self.$i.1 && self.$i.2 == $def;
}
)+
false
}which triggers bool_comparison lint 3 times, 2 times for false and one time for true:
warning: equality checks against false can be replaced by a negation
--> src/config/config_type.rs:431:45
|
431 | return self.$i.1 && self.$i.2 == $def;
| ^^^^^^^^^ help: try simplifying it as shown: `!self.$i.2`
|
::: src/config/mod.rs:37:1
|
37 | / create_config! {
38 | | // Fundamental stuff
39 | | max_width: usize, 100, true, "Maximum width of each line";
40 | | hard_tabs: bool, false, true, "Use tab characters for indentation, spaces for alignment";
... |
153 | | make_backup: bool, false, false, "Backup changed files";
154 | | }
| |_- in this macro invocation
|
= note: #[warn(clippy::bool_comparison)] on by default
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#bool_comparison
warning: equality checks against false can be replaced by a negation
--> src/config/config_type.rs:431:45
|
431 | return self.$i.1 && self.$i.2 == $def;
| ^^^^^^^^^ help: try simplifying it as shown: `!self.$i.2`
|
::: src/config/mod.rs:37:1
|
37 | / create_config! {
38 | | // Fundamental stuff
39 | | max_width: usize, 100, true, "Maximum width of each line";
40 | | hard_tabs: bool, false, true, "Use tab characters for indentation, spaces for alignment";
... |
153 | | make_backup: bool, false, false, "Backup changed files";
154 | | }
| |_- in this macro invocation
|
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#bool_comparison
warning: equality checks against true are unnecessary
--> src/config/config_type.rs:431:45
|
431 | return self.$i.1 && self.$i.2 == $def;
| ^^^^^^^^^ help: try simplifying it as shown: `self.$i.2`
|
::: src/config/mod.rs:37:1
|
37 | / create_config! {
38 | | // Fundamental stuff
39 | | max_width: usize, 100, true, "Maximum width of each line";
40 | | hard_tabs: bool, false, true, "Use tab characters for indentation, spaces for alignment";
... |
153 | | make_backup: bool, false, false, "Backup changed files";
154 | | }
| |_- in this macro invocation
|
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#bool_comparison
maybe it should be disabled in macros?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thinggood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy