Skip to content

Commit 18ff06e

Browse files
committed
Auto merge of #29402 - sanxiyn:if-let, r=steveklabnik
2 parents a455edf + fb7e325 commit 18ff06e

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

src/librustc_lint/types.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -659,18 +659,15 @@ impl LateLintPass for ImproperCTypes {
659659
}
660660
}
661661

662-
match it.node {
663-
hir::ItemForeignMod(ref nmod)
664-
if nmod.abi != abi::RustIntrinsic &&
665-
nmod.abi != abi::PlatformIntrinsic => {
662+
if let hir::ItemForeignMod(ref nmod) = it.node {
663+
if nmod.abi != abi::RustIntrinsic && nmod.abi != abi::PlatformIntrinsic {
666664
for ni in &nmod.items {
667665
match ni.node {
668666
hir::ForeignItemFn(ref decl, _) => check_foreign_fn(cx, &**decl),
669667
hir::ForeignItemStatic(ref t, _) => check_ty(cx, &**t)
670668
}
671669
}
672670
}
673-
_ => (),
674671
}
675672
}
676673
}

src/librustc_lint/unused.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,11 @@ impl LintPass for PathStatements {
220220

221221
impl LateLintPass for PathStatements {
222222
fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
223-
match s.node {
224-
hir::StmtSemi(ref expr, _) => {
225-
match expr.node {
226-
hir::ExprPath(..) => cx.span_lint(PATH_STATEMENTS, s.span,
227-
"path statement with no effect"),
228-
_ => ()
229-
}
223+
if let hir::StmtSemi(ref expr, _) = s.node {
224+
if let hir::ExprPath(..) = expr.node {
225+
cx.span_lint(PATH_STATEMENTS, s.span,
226+
"path statement with no effect");
230227
}
231-
_ => ()
232228
}
233229
}
234230
}

0 commit comments

Comments
 (0)