Eat redundant else dogfood
This commit is contained in:
parent
f059febe85
commit
70f6a2cae2
@ -405,13 +405,10 @@ fn check_line_number(self, cx: &LateContext<'_>, span: Span, body: &'tcx hir::Bo
|
||||
break;
|
||||
}
|
||||
if in_comment {
|
||||
match line.find("*/") {
|
||||
Some(i) => {
|
||||
line = &line[i + 2..];
|
||||
in_comment = false;
|
||||
continue;
|
||||
},
|
||||
None => break,
|
||||
if let Some(i) = line.find("*/") {
|
||||
line = &line[i + 2..];
|
||||
in_comment = false;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
let multi_idx = line.find("/*").unwrap_or_else(|| line.len());
|
||||
@ -423,8 +420,8 @@ fn check_line_number(self, cx: &LateContext<'_>, span: Span, body: &'tcx hir::Bo
|
||||
in_comment = true;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if code_in_line {
|
||||
line_count += 1;
|
||||
|
@ -222,9 +222,8 @@ fn is_named_self(cx: &LateContext<'_>, item: &ImplItemRef<'_>, name: &str) -> bo
|
||||
let is_empty = if let Some(is_empty) = impl_items.iter().find(|i| is_named_self(cx, i, "is_empty")) {
|
||||
if cx.access_levels.is_exported(is_empty.id.hir_id) {
|
||||
return;
|
||||
} else {
|
||||
"a private"
|
||||
}
|
||||
"a private"
|
||||
} else {
|
||||
"no corresponding"
|
||||
};
|
||||
|
@ -696,10 +696,9 @@ fn check_single_match(cx: &LateContext<'_>, ex: &Expr<'_>, arms: &[Arm<'_>], exp
|
||||
if stmts.len() == 1 && block_expr.is_none() || stmts.is_empty() && block_expr.is_some() {
|
||||
// single statement/expr "else" block, don't lint
|
||||
return;
|
||||
} else {
|
||||
// block with 2+ statements or 1 expr and 1+ statement
|
||||
Some(els)
|
||||
}
|
||||
// block with 2+ statements or 1 expr and 1+ statement
|
||||
Some(els)
|
||||
} else {
|
||||
// not a block, don't lint
|
||||
return;
|
||||
|
@ -69,10 +69,9 @@ fn check_expression<'tcx>(cx: &LateContext<'tcx>, arg_id: hir::HirId, expr: &'tc
|
||||
}
|
||||
}
|
||||
return (true, false);
|
||||
} else {
|
||||
// We don't know. It might do anything.
|
||||
return (true, true);
|
||||
}
|
||||
// We don't know. It might do anything.
|
||||
return (true, true);
|
||||
}
|
||||
}
|
||||
(true, true)
|
||||
|
@ -409,11 +409,10 @@ fn levenstein_not_1(a_name: &str, b_name: &str) -> bool {
|
||||
if let Some(b2) = b_chars.next() {
|
||||
// check if there's just one character inserted
|
||||
return a != b2 || a_chars.ne(b_chars);
|
||||
} else {
|
||||
// tuple
|
||||
// ntuple
|
||||
return true;
|
||||
}
|
||||
// tuple
|
||||
// ntuple
|
||||
return true;
|
||||
}
|
||||
// for item in items
|
||||
true
|
||||
|
Loading…
Reference in New Issue
Block a user