Add lint for ifs that could be collapsed
"Collapsible" ifs are ones which contain only a then block, and the then block consists of an if that only has a then block.
This commit is contained in:
@@ -25,6 +25,7 @@ pub mod eta_reduction;
|
||||
pub mod identity_op;
|
||||
pub mod mut_mut;
|
||||
pub mod len_zero;
|
||||
pub mod collapsible_if;
|
||||
|
||||
#[plugin_registrar]
|
||||
pub fn plugin_registrar(reg: &mut Registry) {
|
||||
@@ -45,6 +46,7 @@ pub fn plugin_registrar(reg: &mut Registry) {
|
||||
reg.register_lint_pass(box mut_mut::MutMut as LintPassObject);
|
||||
reg.register_lint_pass(box len_zero::LenZero as LintPassObject);
|
||||
reg.register_lint_pass(box misc::CmpOwned as LintPassObject);
|
||||
reg.register_lint_pass(box collapsible_if::CollapsibleIf as LintPassObject);
|
||||
|
||||
reg.register_lint_group("clippy", vec![types::BOX_VEC, types::LINKEDLIST,
|
||||
misc::SINGLE_MATCH, misc::STR_TO_STRING,
|
||||
@@ -61,5 +63,6 @@ pub fn plugin_registrar(reg: &mut Registry) {
|
||||
mut_mut::MUT_MUT,
|
||||
len_zero::LEN_ZERO,
|
||||
len_zero::LEN_WITHOUT_IS_EMPTY,
|
||||
collapsible_if::COLLAPSIBLE_IF,
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user