Skip to content

Use if let #29402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/librustc_lint/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,18 +659,15 @@ 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),
hir::ForeignItemStatic(ref t, _) => check_ty(cx, &**t)
}
}
}
_ => (),
}
}
}
Expand Down
12 changes: 4 additions & 8 deletions src/librustc_lint/unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
_ => ()
}
}
}
Expand Down