about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2015-02-28 13:32:34 +0100
committerMs2ger <ms2ger@gmail.com>2015-02-28 13:32:34 +0100
commitfe2e0976decadb94cecc4ab85abdd02345cc7a64 (patch)
treeecb3c27ae8fc1bc4ab15a91698995fb9d7eae021 /src
parent8a7b6b3ee6a85aa60a1733727a4028a690744fdf (diff)
downloadrust-fe2e0976decadb94cecc4ab85abdd02345cc7a64.tar.gz
rust-fe2e0976decadb94cecc4ab85abdd02345cc7a64.zip
Use if-let for UnusedImportBraces.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_lint/builtin.rs27
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[..]);
                     }
-                    _ => ()
                 }
-            },
-            _ => ()
+            }
         }
     }
 }