Use if let
This commit is contained in:
parent
908979d53d
commit
fb7e325900
@ -659,10 +659,8 @@ impl LateLintPass for ImproperCTypes {
|
||||
}
|
||||
}
|
||||
|
||||
match it.node {
|
||||
hir::ItemForeignMod(ref nmod)
|
||||
if nmod.abi != abi::RustIntrinsic &&
|
||||
nmod.abi != abi::PlatformIntrinsic => {
|
||||
if let hir::ItemForeignMod(ref nmod) = it.node {
|
||||
if nmod.abi != abi::RustIntrinsic && nmod.abi != abi::PlatformIntrinsic {
|
||||
for ni in &nmod.items {
|
||||
match ni.node {
|
||||
hir::ForeignItemFn(ref decl, _) => check_foreign_fn(cx, &**decl),
|
||||
@ -670,7 +668,6 @@ impl LateLintPass for ImproperCTypes {
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -220,15 +220,11 @@ impl LintPass for PathStatements {
|
||||
|
||||
impl LateLintPass for PathStatements {
|
||||
fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
|
||||
match s.node {
|
||||
hir::StmtSemi(ref expr, _) => {
|
||||
match expr.node {
|
||||
hir::ExprPath(..) => cx.span_lint(PATH_STATEMENTS, s.span,
|
||||
"path statement with no effect"),
|
||||
_ => ()
|
||||
}
|
||||
if let hir::StmtSemi(ref expr, _) = s.node {
|
||||
if let hir::ExprPath(..) = expr.node {
|
||||
cx.span_lint(PATH_STATEMENTS, s.span,
|
||||
"path statement with no effect");
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user