diff options
| author | Ms2ger <ms2ger@gmail.com> | 2015-02-28 13:32:34 +0100 |
|---|---|---|
| committer | Ms2ger <ms2ger@gmail.com> | 2015-02-28 13:32:34 +0100 |
| commit | fe2e0976decadb94cecc4ab85abdd02345cc7a64 (patch) | |
| tree | ecb3c27ae8fc1bc4ab15a91698995fb9d7eae021 /src | |
| parent | 8a7b6b3ee6a85aa60a1733727a4028a690744fdf (diff) | |
| download | rust-fe2e0976decadb94cecc4ab85abdd02345cc7a64.tar.gz rust-fe2e0976decadb94cecc4ab85abdd02345cc7a64.zip | |
Use if-let for UnusedImportBraces.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_lint/builtin.rs | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 13c99e9dff7..015c841ea1d 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1218,26 +1218,17 @@ impl LintPass for UnusedImportBraces { } fn check_item(&mut self, cx: &Context, item: &ast::Item) { - match item.node { - ast::ItemUse(ref view_path) => { - match view_path.node { - ast::ViewPathList(_, ref items) => { - if items.len() == 1 { - match items[0].node { - ast::PathListIdent {ref name, ..} => { - let m = format!("braces around {} is unnecessary", - &token::get_ident(*name)); - cx.span_lint(UNUSED_IMPORT_BRACES, item.span, - &m[..]); - }, - _ => () - } - } + if let ast::ItemUse(ref view_path) = item.node { + if let ast::ViewPathList(_, ref items) = view_path.node { + if items.len() == 1 { + if let ast::PathListIdent {ref name, ..} = items[0].node { + let m = format!("braces around {} is unnecessary", + &token::get_ident(*name)); + cx.span_lint(UNUSED_IMPORT_BRACES, item.span, + &m[..]); } - _ => () } - }, - _ => () + } } } } |
