Skip to content

Commit fe2e097

Browse files
committed
Use if-let for UnusedImportBraces.
1 parent 8a7b6b3 commit fe2e097

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

src/librustc_lint/builtin.rs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,26 +1218,17 @@ impl LintPass for UnusedImportBraces {
12181218
}
12191219

12201220
fn check_item(&mut self, cx: &Context, item: &ast::Item) {
1221-
match item.node {
1222-
ast::ItemUse(ref view_path) => {
1223-
match view_path.node {
1224-
ast::ViewPathList(_, ref items) => {
1225-
if items.len() == 1 {
1226-
match items[0].node {
1227-
ast::PathListIdent {ref name, ..} => {
1228-
let m = format!("braces around {} is unnecessary",
1229-
&token::get_ident(*name));
1230-
cx.span_lint(UNUSED_IMPORT_BRACES, item.span,
1231-
&m[..]);
1232-
},
1233-
_ => ()
1234-
}
1235-
}
1221+
if let ast::ItemUse(ref view_path) = item.node {
1222+
if let ast::ViewPathList(_, ref items) = view_path.node {
1223+
if items.len() == 1 {
1224+
if let ast::PathListIdent {ref name, ..} = items[0].node {
1225+
let m = format!("braces around {} is unnecessary",
1226+
&token::get_ident(*name));
1227+
cx.span_lint(UNUSED_IMPORT_BRACES, item.span,
1228+
&m[..]);
12361229
}
1237-
_ => ()
12381230
}
1239-
},
1240-
_ => ()
1231+
}
12411232
}
12421233
}
12431234
}

0 commit comments

Comments
 (0)