mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 01:34:21 +00:00
make nonminimal_bool
allow-by-default
This commit is contained in:
parent
fa48ee678a
commit
2917484130
@ -98,7 +98,7 @@ name
|
|||||||
[new_without_default](https://github.com/Manishearth/rust-clippy/wiki#new_without_default) | warn | `fn new() -> Self` method without `Default` implementation
|
[new_without_default](https://github.com/Manishearth/rust-clippy/wiki#new_without_default) | warn | `fn new() -> Self` method without `Default` implementation
|
||||||
[no_effect](https://github.com/Manishearth/rust-clippy/wiki#no_effect) | warn | statements with no effect
|
[no_effect](https://github.com/Manishearth/rust-clippy/wiki#no_effect) | warn | statements with no effect
|
||||||
[non_ascii_literal](https://github.com/Manishearth/rust-clippy/wiki#non_ascii_literal) | allow | using any literal non-ASCII chars in a string literal; suggests using the \\u escape instead
|
[non_ascii_literal](https://github.com/Manishearth/rust-clippy/wiki#non_ascii_literal) | allow | using any literal non-ASCII chars in a string literal; suggests using the \\u escape instead
|
||||||
[nonminimal_bool](https://github.com/Manishearth/rust-clippy/wiki#nonminimal_bool) | warn | checks for boolean expressions that can be written more concisely
|
[nonminimal_bool](https://github.com/Manishearth/rust-clippy/wiki#nonminimal_bool) | allow | checks for boolean expressions that can be written more concisely
|
||||||
[nonsensical_open_options](https://github.com/Manishearth/rust-clippy/wiki#nonsensical_open_options) | warn | nonsensical combination of options for opening a file
|
[nonsensical_open_options](https://github.com/Manishearth/rust-clippy/wiki#nonsensical_open_options) | warn | nonsensical combination of options for opening a file
|
||||||
[ok_expect](https://github.com/Manishearth/rust-clippy/wiki#ok_expect) | warn | using `ok().expect()`, which gives worse error messages than calling `expect` directly on the Result
|
[ok_expect](https://github.com/Manishearth/rust-clippy/wiki#ok_expect) | warn | using `ok().expect()`, which gives worse error messages than calling `expect` directly on the Result
|
||||||
[option_map_unwrap_or](https://github.com/Manishearth/rust-clippy/wiki#option_map_unwrap_or) | warn | using `Option.map(f).unwrap_or(a)`, which is more succinctly expressed as `map_or(a, f)`
|
[option_map_unwrap_or](https://github.com/Manishearth/rust-clippy/wiki#option_map_unwrap_or) | warn | using `Option.map(f).unwrap_or(a)`, which is more succinctly expressed as `map_or(a, f)`
|
||||||
|
@ -9,11 +9,11 @@ use utils::{span_lint_and_then, in_macro, snippet_opt, SpanlessEq};
|
|||||||
///
|
///
|
||||||
/// **Why is this bad?** Readability of boolean expressions suffers from unnecesessary duplication
|
/// **Why is this bad?** Readability of boolean expressions suffers from unnecesessary duplication
|
||||||
///
|
///
|
||||||
/// **Known problems:** Ignores short circuting behavior, bitwise and/or and xor. Ends up suggesting things like !(a == b)
|
/// **Known problems:** Ignores short circuting behavior of `||` and `&&`. Ignores `|`, `&` and `^`.
|
||||||
///
|
///
|
||||||
/// **Example:** `if a && true` should be `if a`
|
/// **Example:** `if a && true` should be `if a` and `!(a == b)` should be `a != b`
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
pub NONMINIMAL_BOOL, Warn,
|
pub NONMINIMAL_BOOL, Allow,
|
||||||
"checks for boolean expressions that can be written more concisely"
|
"checks for boolean expressions that can be written more concisely"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,6 +235,7 @@ pub fn plugin_registrar(reg: &mut Registry) {
|
|||||||
|
|
||||||
reg.register_lint_group("clippy_pedantic", vec![
|
reg.register_lint_group("clippy_pedantic", vec![
|
||||||
array_indexing::INDEXING_SLICING,
|
array_indexing::INDEXING_SLICING,
|
||||||
|
booleans::NONMINIMAL_BOOL,
|
||||||
enum_glob_use::ENUM_GLOB_USE,
|
enum_glob_use::ENUM_GLOB_USE,
|
||||||
matches::SINGLE_MATCH_ELSE,
|
matches::SINGLE_MATCH_ELSE,
|
||||||
methods::OPTION_UNWRAP_USED,
|
methods::OPTION_UNWRAP_USED,
|
||||||
@ -268,7 +269,6 @@ pub fn plugin_registrar(reg: &mut Registry) {
|
|||||||
block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
|
block_in_if_condition::BLOCK_IN_IF_CONDITION_EXPR,
|
||||||
block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
|
block_in_if_condition::BLOCK_IN_IF_CONDITION_STMT,
|
||||||
booleans::LOGIC_BUG,
|
booleans::LOGIC_BUG,
|
||||||
booleans::NONMINIMAL_BOOL,
|
|
||||||
collapsible_if::COLLAPSIBLE_IF,
|
collapsible_if::COLLAPSIBLE_IF,
|
||||||
copies::IF_SAME_THEN_ELSE,
|
copies::IF_SAME_THEN_ELSE,
|
||||||
copies::IFS_SAME_COND,
|
copies::IFS_SAME_COND,
|
||||||
|
Loading…
Reference in New Issue
Block a user