about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorjfager <jfager@gmail.com>2014-11-29 16:41:21 -0500
committerjfager <jfager@gmail.com>2014-11-29 16:41:21 -0500
commit232ffa039ddb349c9e9c08d0872aaf95970a1369 (patch)
treee502451f6717605305e19c8fbcc8902f617c0a36 /src
parent6163581451a089a8d07bed4dba058677ee4a21f3 (diff)
Replace some verbose match statements with their `if let` equivalent.
No semantic changes, no enabling `if let` where it wasn't already enabled.
Diffstat (limited to 'src')
-rw-r--r--src/librustc/lint/builtin.rs190
-rw-r--r--src/librustc/metadata/decoder.rs75
-rw-r--r--src/librustc/metadata/encoder.rs149
-rw-r--r--src/librustc/middle/borrowck/check_loans.rs12
-rw-r--r--src/librustc/middle/borrowck/gather_loans/mod.rs27
-rw-r--r--src/librustc/middle/const_eval.rs14
-rw-r--r--src/librustc/middle/effect.rs28
-rw-r--r--src/librustc/middle/intrinsicck.rs36
-rw-r--r--src/librustc/middle/liveness.rs52
-rw-r--r--src/librustc/middle/privacy.rs82
-rw-r--r--src/librustc/middle/reachable.rs14
-rw-r--r--src/librustc/middle/resolve.rs299
-rw-r--r--src/librustc/middle/stability.rs20
-rw-r--r--src/librustc/middle/traits/util.rs6
-rw-r--r--src/librustc/middle/ty.rs12
-rw-r--r--src/librustc/middle/typeck/check/mod.rs85
-rw-r--r--src/librustc/middle/typeck/check/regionck.rs129
-rw-r--r--src/librustc/middle/typeck/check/vtable.rs17
-rw-r--r--src/librustc/middle/typeck/check/wf.rs15
-rw-r--r--src/librustc/middle/typeck/collect.rs295
-rw-r--r--src/librustc/plugin/build.rs11
-rw-r--r--src/librustc_trans/back/link.rs40
-rw-r--r--src/librustc_trans/save/mod.rs12
-rw-r--r--src/librustc_trans/trans/_match.rs32
-rw-r--r--src/librustc_trans/trans/base.rs35
-rw-r--r--src/librustc_trans/trans/callee.rs7
-rw-r--r--src/librustc_trans/trans/cleanup.rs7
-rw-r--r--src/librustc_trans/trans/consts.rs14
-rw-r--r--src/librustc_trans/trans/context.rs5
-rw-r--r--src/librustc_trans/trans/controlflow.rs15
-rw-r--r--src/librustc_trans/trans/expr.rs13
-rw-r--r--src/librustc_trans/trans/foreign.rs30
-rw-r--r--src/librustc_trans/trans/monomorphize.rs11
-rw-r--r--src/librustc_trans/trans/tvec.rs22
-rw-r--r--src/librustdoc/clean/mod.rs9
-rw-r--r--src/librustdoc/html/render.rs194
-rw-r--r--src/librustdoc/passes.rs43
-rw-r--r--src/libsyntax/ast_map/mod.rs7
-rw-r--r--src/libsyntax/ast_util.rs19
-rw-r--r--src/libsyntax/feature_gate.rs23
-rw-r--r--src/libsyntax/parse/parser.rs63
-rw-r--r--src/libsyntax/print/pprust.rs43
-rw-r--r--src/libsyntax/visit.rs7
43 files changed, 882 insertions, 1337 deletions
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index 9b6fedd2955..a90055093a4 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -61,23 +61,13 @@ impl LintPass for WhileTrue {
     }
 
     fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
-        match e.node {
-            ast::ExprWhile(ref cond, _, _) => {
-                match cond.node {
-                    ast::ExprLit(ref lit) => {
-                        match lit.node {
-                            ast::LitBool(true) => {
-                                cx.span_lint(WHILE_TRUE, e.span,
-                                             "denote infinite loops with loop \
-                                              { ... }");
-                            }
-                            _ => {}
-                        }
-                    }
-                    _ => ()
+        if let ast::ExprWhile(ref cond, _, _) = e.node {
+            if let ast::ExprLit(ref lit) = cond.node {
+                if let ast::LitBool(true) = lit.node {
+                    cx.span_lint(WHILE_TRUE, e.span,
+                                 "denote infinite loops with loop { ... }");
                 }
             }
-            _ => ()
         }
     }
 }
@@ -93,14 +83,11 @@ impl LintPass for UnusedCasts {
     }
 
     fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
-        match e.node {
-            ast::ExprCast(ref expr, ref ty) => {
-                let t_t = ast_ty_to_ty(cx, &infer::new_infer_ctxt(cx.tcx), &**ty);
-                if ty::expr_ty(cx.tcx, &**expr) == t_t {
-                    cx.span_lint(UNUSED_TYPECASTS, ty.span, "unnecessary type cast");
-                }
+        if let ast::ExprCast(ref expr, ref ty) = e.node {
+            let t_t = ast_ty_to_ty(cx, &infer::new_infer_ctxt(cx.tcx), &**ty);
+            if ty::expr_ty(cx.tcx, &**expr) == t_t {
+                cx.span_lint(UNUSED_TYPECASTS, ty.span, "unnecessary type cast");
             }
-            _ => ()
         }
     }
 }
@@ -540,9 +527,8 @@ struct RawPtrDerivingVisitor<'a, 'tcx: 'a> {
 impl<'a, 'tcx, 'v> Visitor<'v> for RawPtrDerivingVisitor<'a, 'tcx> {
     fn visit_ty(&mut self, ty: &ast::Ty) {
         static MSG: &'static str = "use of `#[deriving]` with a raw pointer";
-        match ty.node {
-            ast::TyPtr(..) => self.cx.span_lint(RAW_POINTER_DERIVING, ty.span, MSG),
-            _ => {}
+        if let ast::TyPtr(..) = ty.node {
+            self.cx.span_lint(RAW_POINTER_DERIVING, ty.span, MSG);
         }
         visit::walk_ty(self, ty);
     }
@@ -720,9 +706,8 @@ impl LintPass for UnusedResults {
             _ => return
         };
 
-        match expr.node {
-            ast::ExprRet(..) => return,
-            _ => {}
+        if let ast::ExprRet(..) = expr.node {
+            return;
         }
 
         let t = ty::expr_ty(cx.tcx, expr);
@@ -733,11 +718,8 @@ impl LintPass for UnusedResults {
             ty::ty_struct(did, _) |
             ty::ty_enum(did, _) => {
                 if ast_util::is_local(did) {
-                    match cx.tcx.map.get(did.node) {
-                        ast_map::NodeItem(it) => {
-                            warned |= check_must_use(cx, it.attrs.as_slice(), s.span);
-                        }
-                        _ => {}
+                    if let ast_map::NodeItem(it) = cx.tcx.map.get(did.node) {
+                        warned |= check_must_use(cx, it.attrs.as_slice(), s.span);
                     }
                 } else {
                     csearch::get_item_attrs(&cx.sess().cstore, did, |attrs| {
@@ -969,11 +951,8 @@ impl LintPass for NonSnakeCase {
     }
 
     fn check_item(&mut self, cx: &Context, it: &ast::Item) {
-        match it.node {
-            ast::ItemMod(_) => {
-                self.check_snake_case(cx, "module", it.ident, it.span);
-            }
-            _ => {}
+        if let ast::ItemMod(_) = it.node {
+            self.check_snake_case(cx, "module", it.ident, it.span);
         }
     }
 
@@ -986,27 +965,18 @@ impl LintPass for NonSnakeCase {
     }
 
     fn check_pat(&mut self, cx: &Context, p: &ast::Pat) {
-        match &p.node {
-            &ast::PatIdent(_, ref path1, _) => {
-                match cx.tcx.def_map.borrow().get(&p.id) {
-                    Some(&def::DefLocal(_)) => {
-                        self.check_snake_case(cx, "variable", path1.node, p.span);
-                    }
-                    _ => {}
-                }
+        if let &ast::PatIdent(_, ref path1, _) = &p.node {
+            if let Some(&def::DefLocal(_)) = cx.tcx.def_map.borrow().get(&p.id) {
+                self.check_snake_case(cx, "variable", path1.node, p.span);
             }
-            _ => {}
         }
     }
 
     fn check_struct_def(&mut self, cx: &Context, s: &ast::StructDef,
             _: ast::Ident, _: &ast::Generics, _: ast::NodeId) {
         for sf in s.fields.iter() {
-            match sf.node {
-                ast::StructField_ { kind: ast::NamedField(ident, _), .. } => {
-                    self.check_snake_case(cx, "structure field", ident, sf.span);
-                }
-                _ => {}
+            if let ast::StructField_ { kind: ast::NamedField(ident, _), .. } = sf.node {
+                self.check_snake_case(cx, "structure field", ident, sf.span);
             }
         }
     }
@@ -1069,16 +1039,13 @@ pub struct UnusedParens;
 impl UnusedParens {
     fn check_unused_parens_core(&self, cx: &Context, value: &ast::Expr, msg: &str,
                                      struct_lit_needs_parens: bool) {
-        match value.node {
-            ast::ExprParen(ref inner) => {
-                let necessary = struct_lit_needs_parens && contains_exterior_struct_lit(&**inner);
-                if !necessary {
-                    cx.span_lint(UNUSED_PARENS, value.span,
-                                 format!("unnecessary parentheses around {}",
-                                         msg).as_slice())
-                }
+        if let ast::ExprParen(ref inner) = value.node {
+            let necessary = struct_lit_needs_parens && contains_exterior_struct_lit(&**inner);
+            if !necessary {
+                cx.span_lint(UNUSED_PARENS, value.span,
+                             format!("unnecessary parentheses around {}",
+                                     msg).as_slice())
             }
-            _ => {}
         }
 
         /// Expressions that syntactically contain an "exterior" struct
@@ -1201,24 +1168,21 @@ impl LintPass for NonShorthandFieldPatterns {
 
     fn check_pat(&mut self, cx: &Context, pat: &ast::Pat) {
         let def_map = cx.tcx.def_map.borrow();
-        match pat.node {
-            ast::PatStruct(_, ref v, _) => {
-                for fieldpat in v.iter()
-                                 .filter(|fieldpat| !fieldpat.node.is_shorthand)
-                                 .filter(|fieldpat| def_map.get(&fieldpat.node.pat.id)
-                                    == Some(&def::DefLocal(fieldpat.node.pat.id))) {
-                    match fieldpat.node.pat.node {
-                        ast::PatIdent(_, ident, None) if ident.node.as_str()
-                                                         == fieldpat.node.ident.as_str() => {
-                            cx.span_lint(NON_SHORTHAND_FIELD_PATTERNS, fieldpat.span,
-                                         format!("the `{}:` in this pattern is redundant and can \
-                                                  be removed", ident.node.as_str()).as_slice())
-                        },
-                        _ => {},
-                    }
+        if let ast::PatStruct(_, ref v, _) = pat.node {
+            for fieldpat in v.iter()
+                             .filter(|fieldpat| !fieldpat.node.is_shorthand)
+                             .filter(|fieldpat| def_map.get(&fieldpat.node.pat.id)
+                                                == Some(&def::DefLocal(fieldpat.node.pat.id))) {
+                match fieldpat.node.pat.node {
+                    ast::PatIdent(_, ident, None) if ident.node.as_str()
+                                                     == fieldpat.node.ident.as_str() => {
+                        cx.span_lint(NON_SHORTHAND_FIELD_PATTERNS, fieldpat.span,
+                                     format!("the `{}:` in this pattern is redundant and can \
+                                              be removed", ident.node.as_str()).as_slice())
+                    },
+                    _ => {},
                 }
-            },
-            _ => {}
+            }
         }
     }
 }
@@ -1313,27 +1277,18 @@ impl LintPass for UnusedMut {
     }
 
     fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
-        match e.node {
-            ast::ExprMatch(_, ref arms, _) => {
-                for a in arms.iter() {
-                    self.check_unused_mut_pat(cx, a.pats.as_slice())
-                }
+        if let ast::ExprMatch(_, ref arms, _) = e.node {
+            for a in arms.iter() {
+                self.check_unused_mut_pat(cx, a.pats.as_slice())
             }
-            _ => {}
         }
     }
 
     fn check_stmt(&mut self, cx: &Context, s: &ast::Stmt) {
-        match s.node {
-            ast::StmtDecl(ref d, _) => {
-                match d.node {
-                    ast::DeclLocal(ref l) => {
-                        self.check_unused_mut_pat(cx, slice::ref_slice(&l.pat));
-                    },
-                    _ => {}
-                }
-            },
-            _ => {}
+        if let ast::StmtDecl(ref d, _) = s.node {
+            if let ast::DeclLocal(ref l) = d.node {
+                self.check_unused_mut_pat(cx, slice::ref_slice(&l.pat));
+            }
         }
     }
 
@@ -1362,26 +1317,20 @@ impl LintPass for UnusedAllocation {
             _ => return
         }
 
-        match cx.tcx.adjustments.borrow().get(&e.id) {
-            Some(adjustment) => {
-                match *adjustment {
-                    ty::AdjustDerefRef(ty::AutoDerefRef { ref autoref, .. }) => {
-                        match autoref {
-                            &Some(ty::AutoPtr(_, ast::MutImmutable, None)) => {
-                                cx.span_lint(UNUSED_ALLOCATION, e.span,
-                                             "unnecessary allocation, use & instead");
-                            }
-                            &Some(ty::AutoPtr(_, ast::MutMutable, None)) => {
-                                cx.span_lint(UNUSED_ALLOCATION, e.span,
-                                             "unnecessary allocation, use &mut instead");
-                            }
-                            _ => ()
-                        }
+        if let Some(adjustment) = cx.tcx.adjustments.borrow().get(&e.id) {
+            if let ty::AdjustDerefRef(ty::AutoDerefRef { ref autoref, .. }) = *adjustment {
+                match autoref {
+                    &Some(ty::AutoPtr(_, ast::MutImmutable, None)) => {
+                        cx.span_lint(UNUSED_ALLOCATION, e.span,
+                                     "unnecessary allocation, use & instead");
                     }
-                    _ => {}
+                    &Some(ty::AutoPtr(_, ast::MutMutable, None)) => {
+                        cx.span_lint(UNUSED_ALLOCATION, e.span,
+                                     "unnecessary allocation, use &mut instead");
+                    }
+                    _ => ()
                 }
             }
-            _ => ()
         }
     }
 }
@@ -1499,17 +1448,14 @@ impl LintPass for MissingDoc {
     fn check_fn(&mut self, cx: &Context,
             fk: visit::FnKind, _: &ast::FnDecl,
             _: &ast::Block, _: Span, _: ast::NodeId) {
-        match fk {
-            visit::FkMethod(_, _, m) => {
-                // If the method is an impl for a trait, don't doc.
-                if method_context(cx, m) == TraitImpl { return; }
-
-                // Otherwise, doc according to privacy. This will also check
-                // doc for default methods defined on traits.
-                self.check_missing_docs_attrs(cx, Some(m.id), m.attrs.as_slice(),
-                                             m.span, "a method");
-            }
-            _ => {}
+        if let visit::FkMethod(_, _, m) = fk {
+            // If the method is an impl for a trait, don't doc.
+            if method_context(cx, m) == TraitImpl { return; }
+
+            // Otherwise, doc according to privacy. This will also check
+            // doc for default methods defined on traits.
+            self.check_missing_docs_attrs(cx, Some(m.id), m.attrs.as_slice(),
+                                          m.span, "a method");
         }
     }
 
diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs
index 209e78682b4..92639ea3c78 100644
--- a/src/librustc/metadata/decoder.rs
+++ b/src/librustc/metadata/decoder.rs
@@ -514,41 +514,33 @@ fn each_child_of_item_or_crate(intr: Rc<IdentInterner>,
         let inherent_impl_def_id = item_def_id(inherent_impl_def_id_doc,
                                                cdata);
         let items = reader::get_doc(rbml::Doc::new(cdata.data()), tag_items);
-        match maybe_find_item(inherent_impl_def_id.node, items) {
-            None => {}
-            Some(inherent_impl_doc) => {
-                let _ = reader::tagged_docs(inherent_impl_doc,
-                                            tag_item_impl_item,
-                                            |impl_item_def_id_doc| {
-                    let impl_item_def_id = item_def_id(impl_item_def_id_doc,
-                                                       cdata);
-                    match maybe_find_item(impl_item_def_id.node, items) {
-                        None => {}
-                        Some(impl_method_doc) => {
-                            match item_family(impl_method_doc) {
-                                StaticMethod => {
-                                    // Hand off the static method
-                                    // to the callback.
-                                    let static_method_name =
-                                        item_name(&*intr, impl_method_doc);
-                                    let static_method_def_like =
-                                        item_to_def_like(impl_method_doc,
-                                                         impl_item_def_id,
-                                                         cdata.cnum);
-                                    callback(static_method_def_like,
-                                             static_method_name,
-                                             item_visibility(impl_method_doc));
-                                }
-                                _ => {}
-                            }
+        if let Some(inherent_impl_doc) = maybe_find_item(inherent_impl_def_id.node, items) {
+            let _ = reader::tagged_docs(inherent_impl_doc,
+                                        tag_item_impl_item,
+                                        |impl_item_def_id_doc| {
+                let impl_item_def_id = item_def_id(impl_item_def_id_doc,
+                                                   cdata);
+                if let Some(impl_method_doc) = maybe_find_item(impl_item_def_id.node, items) {
+                    match item_family(impl_method_doc) {
+                        StaticMethod => {
+                            // Hand off the static method
+                            // to the callback.
+                            let static_method_name =
+                                item_name(&*intr, impl_method_doc);
+                            let static_method_def_like =
+                                item_to_def_like(impl_method_doc,
+                                                 impl_item_def_id,
+                                                 cdata.cnum);
+                            callback(static_method_def_like,
+                                     static_method_name,
+                                     item_visibility(impl_method_doc));
                         }
+                        _ => {}
                     }
-
-                    true
-                });
-            }
+                }
+                true
+            });
         }
-
         true
     });
 
@@ -578,17 +570,14 @@ fn each_child_of_item_or_crate(intr: Rc<IdentInterner>,
         let other_crates_items = reader::get_doc(rbml::Doc::new(crate_data.data()), tag_items);
 
         // Get the item.
-        match maybe_find_item(child_def_id.node, other_crates_items) {
-            None => {}
-            Some(child_item_doc) => {
-                // Hand off the item to the callback.
-                let def_like = item_to_def_like(child_item_doc,
-                                                child_def_id,
-                                                child_def_id.krate);
-                // These items have a public visibility because they're part of
-                // a public re-export.
-                callback(def_like, token::intern(name), ast::Public);
-            }
+        if let Some(child_item_doc) = maybe_find_item(child_def_id.node, other_crates_items) {
+            // Hand off the item to the callback.
+            let def_like = item_to_def_like(child_item_doc,
+                                            child_def_id,
+                                            child_def_id.krate);
+            // These items have a public visibility because they're part of
+            // a public re-export.
+            callback(def_like, token::intern(name), ast::Public);
         }
 
         true
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index d65fb9d2778..f7ee9fa6522 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -433,17 +433,13 @@ fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
     match ecx.tcx.trait_items_cache.borrow().get(&exp.def_id) {
         Some(trait_items) => {
             for trait_item in trait_items.iter() {
-                match *trait_item {
-                    ty::MethodTraitItem(ref m) => {
-                        encode_reexported_static_method(rbml_w,
-                                                        exp,
-                                                        m.def_id,
-                                                        m.name);
-                    }
-                    _ => {}
+                if let ty::MethodTraitItem(ref m) = *trait_item {
+                    encode_reexported_static_method(rbml_w,
+                                                    exp,
+                                                    m.def_id,
+                                                    m.name);
                 }
             }
-
             true
         }
         None => { false }
@@ -454,46 +450,42 @@ fn encode_reexported_static_methods(ecx: &EncodeContext,
                                     rbml_w: &mut Encoder,
                                     mod_path: PathElems,
                                     exp: &middle::resolve::Export2) {
-    match ecx.tcx.map.find(exp.def_id.node) {
-        Some(ast_map::NodeItem(item)) => {
-            let original_name = token::get_ident(item.ident);
-
-            let path_differs = ecx.tcx.map.with_path(exp.def_id.node, |path| {
-                let (mut a, mut b) = (path, mod_path.clone());
-                loop {
-                    match (a.next(), b.next()) {
-                        (None, None) => return true,
-                        (None, _) | (_, None) => return false,
-                        (Some(x), Some(y)) => if x != y { return false },
-                    }
+    if let Some(ast_map::NodeItem(item)) = ecx.tcx.map.find(exp.def_id.node) {
+        let original_name = token::get_ident(item.ident);
+
+        let path_differs = ecx.tcx.map.with_path(exp.def_id.node, |path| {
+            let (mut a, mut b) = (path, mod_path.clone());
+            loop {
+                match (a.next(), b.next()) {
+                    (None, None) => return true,
+                    (None, _) | (_, None) => return false,
+                    (Some(x), Some(y)) => if x != y { return false },
                 }
-            });
+            }
+        });
 
-            //
-            // We don't need to reexport static methods on items
-            // declared in the same module as our `pub use ...` since
-            // that's done when we encode the item itself.
-            //
-            // The only exception is when the reexport *changes* the
-            // name e.g. `pub use Foo = self::Bar` -- we have
-            // encoded metadata for static methods relative to Bar,
-            // but not yet for Foo.
-            //
-            if path_differs || original_name.get() != exp.name.as_slice() {
-                if !encode_reexported_static_base_methods(ecx, rbml_w, exp) {
-                    if encode_reexported_static_trait_methods(ecx, rbml_w, exp) {
-                        debug!("(encode reexported static methods) {} \
-                                 [trait]",
-                                original_name);
-                    }
-                }
-                else {
-                    debug!("(encode reexported static methods) {} [base]",
-                            original_name);
+        //
+        // We don't need to reexport static methods on items
+        // declared in the same module as our `pub use ...` since
+        // that's done when we encode the item itself.
+        //
+        // The only exception is when the reexport *changes* the
+        // name e.g. `pub use Foo = self::Bar` -- we have
+        // encoded metadata for static methods relative to Bar,
+        // but not yet for Foo.
+        //
+        if path_differs || original_name.get() != exp.name.as_slice() {
+            if !encode_reexported_static_base_methods(ecx, rbml_w, exp) {
+                if encode_reexported_static_trait_methods(ecx, rbml_w, exp) {
+                    debug!("(encode reexported static methods) {} [trait]",
+                           original_name);
                 }
             }
+            else {
+                debug!("(encode reexported static methods) {} [base]",
+                       original_name);
+            }
         }
-        _ => {}
     }
 }
 
@@ -581,19 +573,15 @@ fn encode_info_for_mod(ecx: &EncodeContext,
             true
         });
 
-        match item.node {
-            ast::ItemImpl(..) => {
-                let (ident, did) = (item.ident, item.id);
-                debug!("(encoding info for module) ... encoding impl {} \
-                        ({}/{})",
-                        token::get_ident(ident),
-                        did, ecx.tcx.map.node_to_string(did));
+        if let ast::ItemImpl(..) = item.node {
+            let (ident, did) = (item.ident, item.id);
+            debug!("(encoding info for module) ... encoding impl {} ({}/{})",
+                   token::get_ident(ident),
+                   did, ecx.tcx.map.node_to_string(did));
 
-                rbml_w.start_tag(tag_mod_impl);
-                rbml_w.wr_str(def_to_string(local_def(did)).as_slice());
-                rbml_w.end_tag();
-            }
-            _ => {}
+            rbml_w.start_tag(tag_mod_impl);
+            rbml_w.wr_str(def_to_string(local_def(did)).as_slice());
+            rbml_w.end_tag();
         }
     }
 
@@ -923,12 +911,9 @@ fn encode_method_argument_names(rbml_w: &mut Encoder,
     rbml_w.start_tag(tag_method_argument_names);
     for arg in decl.inputs.iter() {
         rbml_w.start_tag(tag_method_argument_name);
-        match arg.pat.node {
-            ast::PatIdent(_, ref path1, _) => {
-                let name = token::get_ident(path1.node);
-                rbml_w.writer.write(name.get().as_bytes());
-            }
-            _ => {}
+        if let ast::PatIdent(_, ref path1, _) = arg.pat.node {
+            let name = token::get_ident(path1.node);
+            rbml_w.writer.write(name.get().as_bytes());
         }
         rbml_w.end_tag();
     }
@@ -1854,22 +1839,19 @@ struct ImplVisitor<'a, 'b:'a, 'c:'a, 'tcx:'b> {
 
 impl<'a, 'b, 'c, 'tcx, 'v> Visitor<'v> for ImplVisitor<'a, 'b, 'c, 'tcx> {
     fn visit_item(&mut self, item: &ast::Item) {
-        match item.node {
-            ast::ItemImpl(_, Some(ref trait_ref), _, _) => {
-                let def_map = &self.ecx.tcx.def_map;
-                let trait_def = def_map.borrow()[trait_ref.ref_id].clone();
-                let def_id = trait_def.def_id();
-
-                // Load eagerly if this is an implementation of the Drop trait
-                // or if the trait is not defined in this crate.
-                if Some(def_id) == self.ecx.tcx.lang_items.drop_trait() ||
-                        def_id.krate != ast::LOCAL_CRATE {
-                    self.rbml_w.start_tag(tag_impls_impl);
-                    encode_def_id(self.rbml_w, local_def(item.id));
-                    self.rbml_w.end_tag();
-                }
+        if let ast::ItemImpl(_, Some(ref trait_ref), _, _) = item.node {
+            let def_map = &self.ecx.tcx.def_map;
+            let trait_def = def_map.borrow()[trait_ref.ref_id].clone();
+            let def_id = trait_def.def_id();
+
+            // Load eagerly if this is an implementation of the Drop trait
+            // or if the trait is not defined in this crate.
+            if Some(def_id) == self.ecx.tcx.lang_items.drop_trait() ||
+                    def_id.krate != ast::LOCAL_CRATE {
+                self.rbml_w.start_tag(tag_impls_impl);
+                encode_def_id(self.rbml_w, local_def(item.id));
+                self.rbml_w.end_tag();
             }
-            _ => {}
         }
         visit::walk_item(self, item);
     }
@@ -1931,17 +1913,12 @@ fn encode_reachable_extern_fns(ecx: &EncodeContext, rbml_w: &mut Encoder) {
     rbml_w.start_tag(tag_reachable_extern_fns);
 
     for id in ecx.reachable.iter() {
-        match ecx.tcx.map.find(*id) {
-            Some(ast_map::NodeItem(i)) => {
-                match i.node {
-                    ast::ItemFn(_, _, abi, ref generics, _)
-                                if abi != abi::Rust && !generics.is_type_parameterized() => {
-                        rbml_w.wr_tagged_u32(tag_reachable_extern_fn_id, *id);
-                    }
-                    _ => {}
+        if let Some(ast_map::NodeItem(i)) = ecx.tcx.map.find(*id) {
+            if let ast::ItemFn(_, _, abi, ref generics, _) = i.node {
+                if abi != abi::Rust && !generics.is_type_parameterized() {
+                    rbml_w.wr_tagged_u32(tag_reachable_extern_fn_id, *id);
                 }
             }
-            _ => {}
         }
     }
 
diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs
index 9a27abbe832..72c6256dcb5 100644
--- a/src/librustc/middle/borrowck/check_loans.rs
+++ b/src/librustc/middle/borrowck/check_loans.rs
@@ -892,14 +892,9 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
             let guarantor = cmt.guarantor();
             debug!("check_for_aliasable_mutable_writes(cmt={}, guarantor={})",
                    cmt.repr(this.tcx()), guarantor.repr(this.tcx()));
-            match guarantor.cat {
-                mc::cat_deref(ref b, _, mc::BorrowedPtr(ty::MutBorrow, _)) => {
-                    // Statically prohibit writes to `&mut` when aliasable
-
-                    check_for_aliasability_violation(this, span, b.clone());
-                }
-
-                _ => {}
+            if let mc::cat_deref(ref b, _, mc::BorrowedPtr(ty::MutBorrow, _)) = guarantor.cat {
+                // Statically prohibit writes to `&mut` when aliasable
+                check_for_aliasability_violation(this, span, b.clone());
             }
 
             return true; // no errors reported
@@ -962,4 +957,3 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
                     self.bccx.loan_path_to_string(loan_path)).as_slice());
     }
 }
-
diff --git a/src/librustc/middle/borrowck/gather_loans/mod.rs b/src/librustc/middle/borrowck/gather_loans/mod.rs
index 4f7ecc99c89..edffe59fff5 100644
--- a/src/librustc/middle/borrowck/gather_loans/mod.rs
+++ b/src/librustc/middle/borrowck/gather_loans/mod.rs
@@ -97,12 +97,10 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> {
                cmt.repr(self.tcx()),
                mode);
 
-        match cmt.cat {
-            mc::cat_downcast(..) =>
-                gather_moves::gather_match_variant(
-                    self.bccx, &self.move_data, &self.move_error_collector,
-                    matched_pat, cmt, mode),
-            _ => {}
+        if let mc::cat_downcast(..) = cmt.cat {
+            gather_moves::gather_match_variant(
+                self.bccx, &self.move_data, &self.move_error_collector,
+                matched_pat, cmt, mode);
         }
     }
 
@@ -489,17 +487,14 @@ struct StaticInitializerCtxt<'a, 'tcx: 'a> {
 
 impl<'a, 'tcx, 'v> Visitor<'v> for StaticInitializerCtxt<'a, 'tcx> {
     fn visit_expr(&mut self, ex: &Expr) {
-        match ex.node {
-            ast::ExprAddrOf(mutbl, ref base) => {
-                let base_cmt = self.bccx.cat_expr(&**base);
-                let borrow_kind = ty::BorrowKind::from_mutbl(mutbl);
-                // Check that we don't allow borrows of unsafe static items.
-                if check_aliasability(self.bccx, ex.span, euv::AddrOf,
-                                      base_cmt, borrow_kind).is_err() {
-                    return; // reported an error, no sense in reporting more.
-                }
+        if let ast::ExprAddrOf(mutbl, ref base) = ex.node {
+            let base_cmt = self.bccx.cat_expr(&**base);
+            let borrow_kind = ty::BorrowKind::from_mutbl(mutbl);
+            // Check that we don't allow borrows of unsafe static items.
+            if check_aliasability(self.bccx, ex.span, euv::AddrOf,
+                                  base_cmt, borrow_kind).is_err() {
+                return; // reported an error, no sense in reporting more.
             }
-            _ => {}
         }
 
         visit::walk_expr(self, ex);
diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs
index 41901a3f431..d5a292b9f09 100644
--- a/src/librustc/middle/const_eval.rs
+++ b/src/librustc/middle/const_eval.rs
@@ -278,11 +278,8 @@ impl<'a, 'tcx> ConstEvalVisitor<'a, 'tcx> {
 
 impl<'a, 'tcx, 'v> Visitor<'v> for ConstEvalVisitor<'a, 'tcx> {
     fn visit_ty(&mut self, t: &ast::Ty) {
-        match t.node {
-            ast::TyFixedLengthVec(_, ref expr) => {
-                check::check_const_in_type(self.tcx, &**expr, ty::mk_uint());
-            }
-            _ => {}
+        if let ast::TyFixedLengthVec(_, ref expr) = t.node {
+            check::check_const_in_type(self.tcx, &**expr, ty::mk_uint());
         }
 
         visit::walk_ty(self, t);
@@ -321,10 +318,9 @@ pub fn const_expr_to_pat(tcx: &ty::ctxt, expr: &Expr) -> P<ast::Pat> {
 
         ast::ExprCall(ref callee, ref args) => {
             let def = tcx.def_map.borrow()[callee.id].clone();
-            match tcx.def_map.borrow_mut().entry(expr.id) {
-              Vacant(entry) => { entry.set(def); }
-              _ => {}
-            };
+            if let Vacant(entry) = tcx.def_map.borrow_mut().entry(expr.id) {
+               entry.set(def);
+            }
             let path = match def {
                 def::DefStruct(def_id) => def_to_path(tcx, def_id),
                 def::DefVariant(_, variant_did, _) => def_to_path(tcx, variant_did),
diff --git a/src/librustc/middle/effect.rs b/src/librustc/middle/effect.rs
index 71885a769f5..e67df0332dc 100644
--- a/src/librustc/middle/effect.rs
+++ b/src/librustc/middle/effect.rs
@@ -71,12 +71,9 @@ impl<'a, 'tcx> EffectCheckVisitor<'a, 'tcx> {
         debug!("effect: checking index with base type {}",
                 ppaux::ty_to_string(self.tcx, base_type));
         match base_type.sty {
-            ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) => match ty.sty {
-                ty::ty_str => {
-                    span_err!(self.tcx.sess, e.span, E0134,
-                              "modification of string types is not allowed");
-                }
-                _ => {}
+            ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) => if ty::ty_str == ty.sty {
+                span_err!(self.tcx.sess, e.span, E0134,
+                          "modification of string types is not allowed");
             },
             ty::ty_str => {
                 span_err!(self.tcx.sess, e.span, E0135,
@@ -165,13 +162,9 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
             ast::ExprUnary(ast::UnDeref, ref base) => {
                 let base_type = ty::node_id_to_type(self.tcx, base.id);
                 debug!("effect: unary case, base type is {}",
-                        ppaux::ty_to_string(self.tcx, base_type));
-                match base_type.sty {
-                    ty::ty_ptr(_) => {
-                        self.require_unsafe(expr.span,
-                                            "dereference of unsafe pointer")
-                    }
-                    _ => {}
+                       ppaux::ty_to_string(self.tcx, base_type));
+                if let ty::ty_ptr(_) = base_type.sty {
+                    self.require_unsafe(expr.span, "dereference of unsafe pointer")
                 }
             }
             ast::ExprAssign(ref base, _) | ast::ExprAssignOp(_, ref base, _) => {
@@ -181,14 +174,11 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
                 self.check_str_index(&**base);
             }
             ast::ExprInlineAsm(..) => {
-                self.require_unsafe(expr.span, "use of inline assembly")
+                self.require_unsafe(expr.span, "use of inline assembly");
             }
             ast::ExprPath(..) => {
-                match ty::resolve_expr(self.tcx, expr) {
-                    def::DefStatic(_, true) => {
-                        self.require_unsafe(expr.span, "use of mutable static")
-                    }
-                    _ => {}
+                if let def::DefStatic(_, true) = ty::resolve_expr(self.tcx, expr) {
+                    self.require_unsafe(expr.span, "use of mutable static");
                 }
             }
             _ => {}
diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs
index 68d0ac93216..acfdf6fefb5 100644
--- a/src/librustc/middle/intrinsicck.rs
+++ b/src/librustc/middle/intrinsicck.rs
@@ -118,31 +118,26 @@ impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> {
 
 impl<'a, 'tcx, 'v> Visitor<'v> for IntrinsicCheckingVisitor<'a, 'tcx> {
     fn visit_expr(&mut self, expr: &ast::Expr) {
-        match expr.node {
-            ast::ExprPath(..) => {
-                match ty::resolve_expr(self.tcx, expr) {
-                    DefFn(did, _) if self.def_id_is_transmute(did) => {
-                        let typ = ty::node_id_to_type(self.tcx, expr.id);
-                        match typ.sty {
-                            ty_bare_fn(ref bare_fn_ty)
-                                    if bare_fn_ty.abi == RustIntrinsic => {
-                                if let ty::FnConverging(to) = bare_fn_ty.sig.output {
-                                    let from = bare_fn_ty.sig.inputs[0];
-                                    self.check_transmute(expr.span, from, to, expr.id);
-                                }
-                            }
-                            _ => {
-                                self.tcx
-                                    .sess
-                                    .span_bug(expr.span,
-                                              "transmute wasn't a bare fn?!");
+        if let ast::ExprPath(..) = expr.node {
+            match ty::resolve_expr(self.tcx, expr) {
+                DefFn(did, _) if self.def_id_is_transmute(did) => {
+                    let typ = ty::node_id_to_type(self.tcx, expr.id);
+                    match typ.sty {
+                        ty_bare_fn(ref bare_fn_ty) if bare_fn_ty.abi == RustIntrinsic => {
+                            if let ty::FnConverging(to) = bare_fn_ty.sig.output {
+                                let from = bare_fn_ty.sig.inputs[0];
+                                self.check_transmute(expr.span, from, to, expr.id);
                             }
                         }
+                        _ => {
+                            self.tcx
+                                .sess
+                                .span_bug(expr.span, "transmute wasn't a bare fn?!");
+                        }
                     }
-                    _ => {}
                 }
+                _ => {}
             }
-            _ => {}
         }
 
         visit::walk_expr(self, expr);
@@ -153,4 +148,3 @@ pub fn check_crate(tcx: &ctxt) {
     visit::walk_crate(&mut IntrinsicCheckingVisitor { tcx: tcx },
                       tcx.map.krate());
 }
-
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index a09ceac11a5..fcc23d8ac55 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -445,9 +445,8 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
       ast::ExprPath(_) => {
         let def = ir.tcx.def_map.borrow()[expr.id].clone();
         debug!("expr {}: path that leads to {}", expr.id, def);
-        match def {
-            DefLocal(..) => ir.add_live_node_for_node(expr.id, ExprNode(expr.span)),
-            _ => {}
+        if let DefLocal(..) = def {
+            ir.add_live_node_for_node(expr.id, ExprNode(expr.span));
         }
         visit::walk_expr(ir, expr);
       }
@@ -463,13 +462,10 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
         let mut call_caps = Vec::new();
         ty::with_freevars(ir.tcx, expr.id, |freevars| {
             for fv in freevars.iter() {
-                match fv.def {
-                    DefLocal(rv) => {
-                        let fv_ln = ir.add_live_node(FreeVarNode(fv.span));
-                        call_caps.push(CaptureInfo {ln: fv_ln,
-                                                    var_nid: rv});
-                    }
-                    _ => {}
+                if let DefLocal(rv) = fv.def {
+                    let fv_ln = ir.add_live_node(FreeVarNode(fv.span));
+                    call_caps.push(CaptureInfo {ln: fv_ln,
+                                                var_nid: rv});
                 }
             }
         });
@@ -1576,27 +1572,23 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
 
     fn check_lvalue(&mut self, expr: &Expr) {
         match expr.node {
-          ast::ExprPath(_) => {
-            match self.ir.tcx.def_map.borrow()[expr.id].clone() {
-              DefLocal(nid) => {
-                // Assignment to an immutable variable or argument: only legal
-                // if there is no later assignment. If this local is actually
-                // mutable, then check for a reassignment to flag the mutability
-                // as being used.
-                let ln = self.live_node(expr.id, expr.span);
-                let var = self.variable(nid, expr.span);
-                self.warn_about_dead_assign(expr.span, expr.id, ln, var);
-              }
-              _ => {}
+            ast::ExprPath(_) => {
+                if let DefLocal(nid) = self.ir.tcx.def_map.borrow()[expr.id].clone() {
+                    // Assignment to an immutable variable or argument: only legal
+                    // if there is no later assignment. If this local is actually
+                    // mutable, then check for a reassignment to flag the mutability
+                    // as being used.
+                    let ln = self.live_node(expr.id, expr.span);
+                    let var = self.variable(nid, expr.span);
+                    self.warn_about_dead_assign(expr.span, expr.id, ln, var);
+                }
             }
-          }
-
-          _ => {
-            // For other kinds of lvalues, no checks are required,
-            // and any embedded expressions are actually rvalues
-            visit::walk_expr(self, expr);
-          }
-       }
+            _ => {
+                // For other kinds of lvalues, no checks are required,
+                // and any embedded expressions are actually rvalues
+                visit::walk_expr(self, expr);
+            }
+        }
     }
 
     fn should_warn(&self, var: Variable) -> Option<String> {
diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs
index ec939d19b72..5e182ba8337 100644
--- a/src/librustc/middle/privacy.rs
+++ b/src/librustc/middle/privacy.rs
@@ -310,19 +310,16 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
             }
 
             ast::ItemTy(ref ty, _) if public_first => {
-                match ty.node {
-                    ast::TyPath(_, id) => {
-                        match self.tcx.def_map.borrow()[id].clone() {
-                            def::DefPrimTy(..) | def::DefTyParam(..) => {},
-                            def => {
-                                let did = def.def_id();
-                                if is_local(did) {
-                                    self.exported_items.insert(did.node);
-                                }
+                if let ast::TyPath(_, id) = ty.node {
+                    match self.tcx.def_map.borrow()[id].clone() {
+                        def::DefPrimTy(..) | def::DefTyParam(..) => {},
+                        def => {
+                            let did = def.def_id();
+                            if is_local(did) {
+                                self.exported_items.insert(did.node);
                             }
                         }
                     }
-                    _ => {}
                 }
             }
 
@@ -771,11 +768,8 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
                                 resolve::AllPublic => None,
                                 resolve::DependsOn(def) => ck_public(def),
                             };
-                            match (v, t) {
-                                (Some(_), Some(t)) => {
-                                    self.report_error(Some(t));
-                                },
-                                _ => {},
+                            if let (Some(_), Some(t)) = (v, t) {
+                                self.report_error(Some(t));
                             }
                         },
                         _ => {},
@@ -1001,9 +995,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
                 match ty::pat_ty(self.tcx, pattern).sty {
                     ty::ty_struct(id, _) => {
                         for (i, field) in fields.iter().enumerate() {
-                            match field.node {
-                                ast::PatWild(..) => continue,
-                                _ => {}
+                            if let ast::PatWild(..) = field.node {
+                                continue
                             }
                             self.check_field(field.span, id, UnnamedField(i));
                         }
@@ -1075,14 +1068,9 @@ impl<'a, 'tcx, 'v> Visitor<'v> for SanePrivacyVisitor<'a, 'tcx> {
                     self.tcx.sess.span_err(i.span, "unnecessary `pub`, imports \
                                                     in functions are never \
                                                     reachable");
-                } else {
-                    match i.node {
-                        ast::ViewItemExternCrate(..) => {
-                            self.tcx.sess.span_err(i.span, "`pub` visibility \
-                                                            is not allowed");
-                        }
-                        _ => {}
-                    }
+                } else if let ast::ViewItemExternCrate(..) = i.node {
+                    self.tcx.sess.span_err(i.span, "`pub` visibility \
+                                                    is not allowed");
                 }
             }
         }
@@ -1275,34 +1263,28 @@ impl<'a, 'tcx> VisiblePrivateTypesVisitor<'a, 'tcx> {
     fn check_ty_param_bound(&self,
                             span: Span,
                             ty_param_bound: &ast::TyParamBound) {
-        match *ty_param_bound {
-            ast::TraitTyParamBound(ref trait_ref) => {
-                if !self.tcx.sess.features.borrow().visible_private_types &&
-                        self.path_is_private_type(trait_ref.trait_ref.ref_id) {
+        if let ast::TraitTyParamBound(ref trait_ref) = *ty_param_bound {
+            if !self.tcx.sess.features.borrow().visible_private_types &&
+                self.path_is_private_type(trait_ref.trait_ref.ref_id) {
                     self.tcx.sess.span_err(span,
                                            "private type in exported type \
                                             parameter bound");
-                }
             }
-            _ => {}
         }
     }
 }
 
 impl<'a, 'b, 'tcx, 'v> Visitor<'v> for CheckTypeForPrivatenessVisitor<'a, 'b, 'tcx> {
     fn visit_ty(&mut self, ty: &ast::Ty) {
-        match ty.node {
-            ast::TyPath(_, path_id) => {
-                if self.inner.path_is_private_type(path_id) {
-                    self.contains_private = true;
-                    // found what we're looking for so let's stop
-                    // working.
-                    return
-                } else if self.at_outer_type {
-                    self.outer_type_is_public_path = true;
-                }
+        if let ast::TyPath(_, path_id) = ty.node {
+            if self.inner.path_is_private_type(path_id) {
+                self.contains_private = true;
+                // found what we're looking for so let's stop
+                // working.
+                return
+            } else if self.at_outer_type {
+                self.outer_type_is_public_path = true;
             }
-            _ => {}
         }
         self.at_outer_type = false;
         visit::walk_ty(self, ty)
@@ -1492,16 +1474,12 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> {
     }
 
     fn visit_ty(&mut self, t: &ast::Ty) {
-        match t.node {
-            ast::TyPath(ref p, path_id) => {
-                if !self.tcx.sess.features.borrow().visible_private_types &&
-                        self.path_is_private_type(path_id) {
-                    self.tcx.sess.span_err(p.span,
-                                           "private type in exported type \
-                                            signature");
-                }
+        if let ast::TyPath(ref p, path_id) = t.node {
+            if !self.tcx.sess.features.borrow().visible_private_types &&
+                self.path_is_private_type(path_id) {
+                self.tcx.sess.span_err(p.span,
+                                       "private type in exported type signature");
             }
-            _ => {}
         }
         visit::walk_ty(self, t)
     }
diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs
index 7dcc0510a6a..96e1aacb0ce 100644
--- a/src/librustc/middle/reachable.rs
+++ b/src/librustc/middle/reachable.rs
@@ -264,18 +264,12 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
             // functions may still participate in some form of native interface,
             // but all other rust-only interfaces can be private (they will not
             // participate in linkage after this product is produced)
-            match *node {
-                ast_map::NodeItem(item) => {
-                    match item.node {
-                        ast::ItemFn(_, _, abi, _, _) => {
-                            if abi != abi::Rust {
-                                self.reachable_symbols.insert(search_item);
-                            }
-                        }
-                        _ => {}
+            if let ast_map::NodeItem(item) = *node {
+                if let ast::ItemFn(_, _, abi, _, _) = item.node {
+                    if abi != abi::Rust {
+                        self.reachable_symbols.insert(search_item);
                     }
                 }
-                _ => {}
             }
         } else {
             // If we are building a library, then reachable symbols will
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs
index ae32a10f314..823bc2a6873 100644
--- a/src/librustc/middle/resolve.rs
+++ b/src/librustc/middle/resolve.rs
@@ -3052,22 +3052,15 @@ impl<'a> Resolver<'a> {
 
         match import_resolution.value_target {
             Some(ref target) if !target.shadowable => {
-                match *name_bindings.value_def.borrow() {
-                    Some(ref value) => {
-                        let msg = format!("import `{}` conflicts with value \
-                                           in this module",
-                                          token::get_name(name).get());
-                        self.session.span_err(import_span, msg.as_slice());
-                        match value.value_span {
-                            None => {}
-                            Some(span) => {
-                                self.session
-                                    .span_note(span,
+                if let Some(ref value) = *name_bindings.value_def.borrow() {
+                    let msg = format!("import `{}` conflicts with value \
+                                       in this module",
+                                      token::get_name(name).get());
+                    self.session.span_err(import_span, msg.as_slice());
+                    if let Some(span) = value.value_span {
+                        self.session.span_note(span,
                                                "conflicting value here");
-                            }
-                        }
                     }
-                    _ => {}
                 }
             }
             Some(_) | None => {}
@@ -3075,59 +3068,43 @@ impl<'a> Resolver<'a> {
 
         match import_resolution.type_target {
             Some(ref target) if !target.shadowable => {
-                match *name_bindings.type_def.borrow() {
-                    Some(ref ty) => {
-                        match ty.module_def {
-                            None => {
-                                let msg = format!("import `{}` conflicts with type in \
-                                                   this module",
-                                                  token::get_name(name).get());
-                                self.session.span_err(import_span, msg.as_slice());
-                                match ty.type_span {
-                                    None => {}
-                                    Some(span) => {
-                                        self.session
-                                            .span_note(span,
+                if let Some(ref ty) = *name_bindings.type_def.borrow() {
+                    match ty.module_def {
+                        None => {
+                            let msg = format!("import `{}` conflicts with type in \
+                                               this module",
+                                              token::get_name(name).get());
+                            self.session.span_err(import_span, msg.as_slice());
+                            if let Some(span) = ty.type_span {
+                                self.session.span_note(span,
                                                        "note conflicting type here")
-                                    }
-                                }
                             }
-                            Some(ref module_def) => {
-                                match module_def.kind.get() {
-                                    ImplModuleKind => {
-                                        match ty.type_span {
-                                            None => { /* this can't ever happen */ }
-                                            Some(span) => {
-                                                let msg = format!("inherent implementations \
-                                                                   are only allowed on types \
-                                                                   defined in the current module");
-                                                self.session
-                                                    .span_err(span, msg.as_slice());
-                                                self.session
-                                                    .span_note(import_span,
+                        }
+                        Some(ref module_def) => {
+                            match module_def.kind.get() {
+                                ImplModuleKind => {
+                                    if let Some(span) = ty.type_span {
+                                        let msg = format!("inherent implementations \
+                                                           are only allowed on types \
+                                                           defined in the current module");
+                                        self.session.span_err(span, msg.as_slice());
+                                        self.session.span_note(import_span,
                                                                "import from other module here")
-                                            }
-                                        }
                                     }
-                                    _ => {
-                                        let msg = format!("import `{}` conflicts with existing \
-                                                           submodule",
-                                                          token::get_name(name).get());
-                                        self.session.span_err(import_span, msg.as_slice());
-                                        match ty.type_span {
-                                            None => {}
-                                            Some(span) => {
-                                                self.session
-                                                    .span_note(span,
+                                }
+                                _ => {
+                                    let msg = format!("import `{}` conflicts with existing \
+                                                       submodule",
+                                                      token::get_name(name).get());
+                                    self.session.span_err(import_span, msg.as_slice());
+                                    if let Some(span) = ty.type_span {
+                                        self.session.span_note(span,
                                                                "note conflicting module here")
-                                            }
-                                        }
                                     }
                                 }
                             }
                         }
                     }
-                    _ => {}
                 }
             }
             Some(_) | None => {}
@@ -3269,25 +3246,16 @@ impl<'a> Resolver<'a> {
                                     search_module = module_def.clone();
 
                                     // track extern crates for unused_extern_crate lint
-                                    match module_def.def_id.get() {
-                                        Some(did) => {
-                                            self.used_crates.insert(did.krate);
-                                        }
-                                        _ => {}
+                                    if let Some(did) = module_def.def_id.get() {
+                                        self.used_crates.insert(did.krate);
                                     }
 
                                     // Keep track of the closest
                                     // private module used when
                                     // resolving this import chain.
-                                    if !used_proxy &&
-                                       !search_module.is_public {
-                                        match search_module.def_id
-                                                           .get() {
-                                            Some(did) => {
-                                                closest_private =
-                                                    LastMod(DependsOn(did));
-                                            }
-                                            None => {}
+                                    if !used_proxy && !search_module.is_public {
+                                        if let Some(did) = search_module.def_id.get() {
+                                            closest_private = LastMod(DependsOn(did));
                                         }
                                     }
                                 }
@@ -3442,46 +3410,35 @@ impl<'a> Resolver<'a> {
         // all its imports in the usual way; this is because chains of
         // adjacent import statements are processed as though they mutated the
         // current scope.
-        match module_.import_resolutions.borrow().get(&name) {
-            None => {
-                // Not found; continue.
-            }
-            Some(import_resolution) => {
-                match (*import_resolution).target_for_namespace(namespace) {
-                    None => {
-                        // Not found; continue.
-                        debug!("(resolving item in lexical scope) found \
-                                import resolution, but not in namespace {}",
-                               namespace);
-                    }
-                    Some(target) => {
-                        debug!("(resolving item in lexical scope) using \
-                                import resolution");
-                        // track used imports and extern crates as well
-                        self.used_imports.insert((import_resolution.id(namespace), namespace));
-                        match target.target_module.def_id.get() {
-                            Some(DefId{krate: kid, ..}) => { self.used_crates.insert(kid); },
-                            _ => {}
-                        }
-                        return Success((target, false));
+        if let Some(import_resolution) = module_.import_resolutions.borrow().get(&name) {
+            match (*import_resolution).target_for_namespace(namespace) {
+                None => {
+                    // Not found; continue.
+                    debug!("(resolving item in lexical scope) found \
+                            import resolution, but not in namespace {}",
+                           namespace);
+                }
+                Some(target) => {
+                    debug!("(resolving item in lexical scope) using \
+                            import resolution");
+                    // track used imports and extern crates as well
+                    self.used_imports.insert((import_resolution.id(namespace), namespace));
+                    if let Some(DefId{krate: kid, ..}) = target.target_module.def_id.get() {
+                        self.used_crates.insert(kid);
                     }
+                    return Success((target, false));
                 }
             }
         }
 
         // Search for external modules.
         if namespace == TypeNS {
-            match module_.external_module_children.borrow().get(&name).cloned() {
-                None => {}
-                Some(module) => {
-                    let name_bindings =
-                        Rc::new(Resolver::create_name_bindings_from_module(module));
-                    debug!("lower name bindings succeeded");
-                    return Success((Target::new(module_,
-                                                name_bindings,
-                                                false),
-                                    false));
-                }
+            if let Some(module) = module_.external_module_children.borrow().get(&name).cloned() {
+                let name_bindings =
+                    Rc::new(Resolver::create_name_bindings_from_module(module));
+                debug!("lower name bindings succeeded");
+                return Success((Target::new(module_, name_bindings, false),
+                                false));
             }
         }
 
@@ -3743,9 +3700,8 @@ impl<'a> Resolver<'a> {
                                 import");
                         // track used imports and extern crates as well
                         self.used_imports.insert((import_resolution.id(namespace), namespace));
-                        match target.target_module.def_id.get() {
-                            Some(DefId{krate: kid, ..}) => { self.used_crates.insert(kid); },
-                            _ => {}
+                        if let Some(DefId{krate: kid, ..}) = target.target_module.def_id.get() {
+                            self.used_crates.insert(kid);
                         }
                         return Success((target, true));
                     }
@@ -3756,16 +3712,11 @@ impl<'a> Resolver<'a> {
 
         // Finally, search through external children.
         if namespace == TypeNS {
-            match module_.external_module_children.borrow().get(&name).cloned() {
-                None => {}
-                Some(module) => {
-                    let name_bindings =
-                        Rc::new(Resolver::create_name_bindings_from_module(module));
-                    return Success((Target::new(module_,
-                                                name_bindings,
-                                                false),
-                                    false));
-                }
+            if let Some(module) = module_.external_module_children.borrow().get(&name).cloned() {
+                let name_bindings =
+                    Rc::new(Resolver::create_name_bindings_from_module(module));
+                return Success((Target::new(module_, name_bindings, false),
+                                false));
             }
         }
 
@@ -4271,11 +4222,8 @@ impl<'a> Resolver<'a> {
                                     this.resolve_type(&*argument.ty);
                                 }
 
-                                match ty_m.explicit_self.node {
-                                    SelfExplicit(ref typ, _) => {
-                                        this.resolve_type(&**typ)
-                                    }
-                                    _ => {}
+                                if let SelfExplicit(ref typ, _) = ty_m.explicit_self.node {
+                                    this.resolve_type(&**typ)
                                 }
 
                                 if let ast::Return(ref ret_ty) = ty_m.decl.output {
@@ -4563,19 +4511,14 @@ impl<'a> Resolver<'a> {
                                                        &trait_reference.path)));
 
                         // If it's a typedef, give a note
-                        match def {
-                            DefTy(..) => {
-                                self.session.span_note(
-                                    trait_reference.path.span,
-                                    format!("`type` aliases cannot \
-                                                        be used for traits")
-                                                        .as_slice());
-                            }
-                            _ => {}
+                        if let DefTy(..) = def {
+                            self.session.span_note(
+                                trait_reference.path.span,
+                                format!("`type` aliases cannot be used for traits")
+                                    .as_slice());
                         }
                     }
                 }
-
             }
         }
     }
@@ -4637,9 +4580,8 @@ impl<'a> Resolver<'a> {
                                                 method.id,
                                                 rib_kind);
 
-        match method.pe_explicit_self().node {
-            SelfExplicit(ref typ, _) => self.resolve_type(&**typ),
-            _ => {}
+        if let SelfExplicit(ref typ, _) = method.pe_explicit_self().node {
+            self.resolve_type(&**typ);
         }
 
         self.resolve_function(rib_kind,
@@ -5351,29 +5293,26 @@ impl<'a> Resolver<'a> {
         // Next, search import resolutions.
         match containing_module.import_resolutions.borrow().get(&name) {
             Some(import_resolution) if import_resolution.is_public => {
-                match (*import_resolution).target_for_namespace(namespace) {
-                    Some(target) => {
-                        match target.bindings.def_for_namespace(namespace) {
-                            Some(def) => {
-                                // Found it.
-                                let id = import_resolution.id(namespace);
-                                // track imports and extern crates as well
-                                self.used_imports.insert((id, namespace));
-                                match target.target_module.def_id.get() {
-                                    Some(DefId{krate: kid, ..}) => {
-                                        self.used_crates.insert(kid);
-                                    },
-                                    _ => {}
-                                }
-                                return ImportNameDefinition(def, LastMod(AllPublic));
-                            }
-                            None => {
-                                // This can happen with external impls, due to
-                                // the imperfect way we read the metadata.
+                if let Some(target) = (*import_resolution).target_for_namespace(namespace) {
+                    match target.bindings.def_for_namespace(namespace) {
+                        Some(def) => {
+                            // Found it.
+                            let id = import_resolution.id(namespace);
+                            // track imports and extern crates as well
+                            self.used_imports.insert((id, namespace));
+                            match target.target_module.def_id.get() {
+                                Some(DefId{krate: kid, ..}) => {
+                                    self.used_crates.insert(kid);
+                                },
+                                _ => {}
                             }
+                            return ImportNameDefinition(def, LastMod(AllPublic));
+                        }
+                        None => {
+                            // This can happen with external impls, due to
+                            // the imperfect way we read the metadata.
                         }
                     }
-                    None => {}
                 }
             }
             Some(..) | None => {} // Continue.
@@ -5381,21 +5320,15 @@ impl<'a> Resolver<'a> {
 
         // Finally, search through external children.
         if namespace == TypeNS {
-            match containing_module.external_module_children.borrow()
-                                   .get(&name).cloned() {
-                None => {}
-                Some(module) => {
-                    match module.def_id.get() {
-                        None => {} // Continue.
-                        Some(def_id) => {
-                            // track used crates
-                            self.used_crates.insert(def_id.krate);
-                            let lp = if module.is_public {LastMod(AllPublic)} else {
-                                LastMod(DependsOn(def_id))
-                            };
-                            return ChildNameDefinition(DefMod(def_id), lp);
-                        }
-                    }
+            if let Some(module) = containing_module.external_module_children.borrow()
+                                                   .get(&name).cloned() {
+                if let Some(def_id) = module.def_id.get() {
+                    // track used crates
+                    self.used_crates.insert(def_id.krate);
+                    let lp = if module.is_public {LastMod(AllPublic)} else {
+                        LastMod(DependsOn(def_id))
+                    };
+                    return ChildNameDefinition(DefMod(def_id), lp);
                 }
             }
         }
@@ -5454,9 +5387,8 @@ impl<'a> Resolver<'a> {
                 (def, last_private.or(lp))
             }
         };
-        match containing_module.def_id.get() {
-            Some(DefId{krate: kid, ..}) => { self.used_crates.insert(kid); },
-            _ => {}
+        if let Some(DefId{krate: kid, ..}) = containing_module.def_id.get() {
+            self.used_crates.insert(kid);
         }
         return Some(def);
     }
@@ -6049,9 +5981,8 @@ impl<'a> Resolver<'a> {
                 if self.trait_item_map.contains_key(&(name, did)) {
                     add_trait_info(&mut found_traits, did, name);
                     self.used_imports.insert((import.type_id, TypeNS));
-                    match target.target_module.def_id.get() {
-                        Some(DefId{krate: kid, ..}) => { self.used_crates.insert(kid); },
-                        _ => {}
+                    if let Some(DefId{krate: kid, ..}) = target.target_module.def_id.get() {
+                        self.used_crates.insert(kid);
                     }
                 }
             }
@@ -6128,15 +6059,13 @@ impl<'a> Resolver<'a> {
 
         match vi.node {
             ViewItemExternCrate(_, _, id) => {
-                match self.session.cstore.find_extern_mod_stmt_cnum(id)
-                {
-                    Some(crate_num) => if !self.used_crates.contains(&crate_num) {
-                    self.session.add_lint(lint::builtin::UNUSED_EXTERN_CRATES,
-                                          id,
-                                          vi.span,
-                                          "unused extern crate".to_string());
-                    },
-                    _ => {}
+                if let Some(crate_num) = self.session.cstore.find_extern_mod_stmt_cnum(id) {
+                    if !self.used_crates.contains(&crate_num) {
+                        self.session.add_lint(lint::builtin::UNUSED_EXTERN_CRATES,
+                                              id,
+                                              vi.span,
+                                              "unused extern crate".to_string());
+                    }
                 }
             },
             ViewItemUse(ref p) => {
diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs
index 4d0474b68da..994fe2e9e27 100644
--- a/src/librustc/middle/stability.rs
+++ b/src/librustc/middle/stability.rs
@@ -69,24 +69,18 @@ impl<'v> Visitor<'v> for Annotator {
     fn visit_item(&mut self, i: &Item) {
         self.annotate(i.id, &i.attrs, |v| visit::walk_item(v, i));
 
-        match i.node {
-            ast::ItemStruct(ref sd, _) => {
-                sd.ctor_id.map(|id| {
-                    self.annotate(id, &i.attrs, |_| {})
-                });
-            }
-            _ => {}
+        if let ast::ItemStruct(ref sd, _) = i.node {
+            sd.ctor_id.map(|id| {
+                self.annotate(id, &i.attrs, |_| {})
+            });
         }
     }
 
     fn visit_fn(&mut self, fk: FnKind<'v>, _: &'v FnDecl,
                 _: &'v Block, _: Span, _: NodeId) {
-        match fk {
-            FkMethod(_, _, meth) => {
-                // Methods are not already annotated, so we annotate it
-                self.annotate(meth.id, &meth.attrs, |_| {});
-            }
-            _ => {}
+        if let FkMethod(_, _, meth) = fk {
+            // Methods are not already annotated, so we annotate it
+            self.annotate(meth.id, &meth.attrs, |_| {});
         }
         // Items defined in a function body have no reason to have
         // a stability attribute, so we don't recurse.
diff --git a/src/librustc/middle/traits/util.rs b/src/librustc/middle/traits/util.rs
index cd7260b1812..e8b292aac6d 100644
--- a/src/librustc/middle/traits/util.rs
+++ b/src/librustc/middle/traits/util.rs
@@ -211,9 +211,8 @@ fn push_obligations_for_param_bounds<'tcx>(
                                                       builtin_bound,
                                                       recursion_depth,
                                                       param_ty);
-        match obligation {
-            Ok(ob) => obligations.push(space, ob),
-            _ => {}
+        if let Ok(ob) = obligation {
+            obligations.push(space, ob);
         }
     }
 
@@ -383,4 +382,3 @@ impl<'tcx> Repr<'tcx> for ty::type_err<'tcx> {
         ty::type_err_to_str(tcx, self)
     }
 }
-
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 0574806c1b7..35aed356303 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -1893,11 +1893,8 @@ impl FlagComputation {
             }
 
             &ty_closure(ref f) => {
-                match f.store {
-                    RegionTraitStore(r, _) => {
-                        self.add_region(r);
-                    }
-                    _ => {}
+                if let RegionTraitStore(r, _) = f.store {
+                    self.add_region(r);
                 }
                 self.add_fn_sig(&f.sig);
                 self.add_bounds(&f.bounds);
@@ -3664,9 +3661,8 @@ pub fn adjust_ty<'tcx>(cx: &ctxt<'tcx>,
                        method_type: |typeck::MethodCall| -> Option<Ty<'tcx>>)
                        -> Ty<'tcx> {
 
-    match unadjusted_ty.sty {
-        ty_err => return unadjusted_ty,
-        _ => {}
+    if let ty_err = unadjusted_ty.sty {
+        return unadjusted_ty;
     }
 
     return match adjustment {
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs
index 40a38d45fa0..641cbd11d64 100644
--- a/src/librustc/middle/typeck/check/mod.rs
+++ b/src/librustc/middle/typeck/check/mod.rs
@@ -441,21 +441,19 @@ impl<'a, 'tcx, 'v> Visitor<'v> for GatherLocalsVisitor<'a, 'tcx> {
 
     // Add pattern bindings.
     fn visit_pat(&mut self, p: &ast::Pat) {
-        match p.node {
-            ast::PatIdent(_, ref path1, _)
-                if pat_util::pat_is_binding(&self.fcx.ccx.tcx.def_map, p) => {
-                    let var_ty = self.assign(p.span, p.id, None);
-
-                    self.fcx.require_type_is_sized(var_ty, p.span,
-                                                   traits::VariableType(p.id));
-
-                    debug!("Pattern binding {} is assigned to {} with type {}",
-                           token::get_ident(path1.node),
-                           self.fcx.infcx().ty_to_string(
-                               self.fcx.inh.locals.borrow()[p.id].clone()),
-                           var_ty.repr(self.fcx.tcx()));
-                }
-            _ => {}
+        if let ast::PatIdent(_, ref path1, _) = p.node {
+            if pat_util::pat_is_binding(&self.fcx.ccx.tcx.def_map, p) {
+                let var_ty = self.assign(p.span, p.id, None);
+
+                self.fcx.require_type_is_sized(var_ty, p.span,
+                                               traits::VariableType(p.id));
+
+                debug!("Pattern binding {} is assigned to {} with type {}",
+                       token::get_ident(path1.node),
+                       self.fcx.infcx().ty_to_string(
+                           self.fcx.inh.locals.borrow()[p.id].clone()),
+                       var_ty.repr(self.fcx.tcx()));
+            }
         }
         visit::walk_pat(self, p);
     }
@@ -681,14 +679,11 @@ pub fn check_item(ccx: &CrateCtxt, it: &ast::Item) {
                         "foreign items may not have type parameters");
                 }
 
-                match item.node {
-                    ast::ForeignItemFn(ref fn_decl, _) => {
-                        if fn_decl.variadic && m.abi != abi::C {
-                            span_err!(ccx.tcx.sess, item.span, E0045,
-                                "variadic function must have C calling convention");
-                        }
+                if let ast::ForeignItemFn(ref fn_decl, _) = item.node {
+                    if fn_decl.variadic && m.abi != abi::C {
+                        span_err!(ccx.tcx.sess, item.span, E0045,
+                                  "variadic function must have C calling convention");
                     }
-                    _ => {}
                 }
             }
         }
@@ -1808,9 +1803,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             traits::ObligationCause::new(span, code),
             ty,
             bound);
-        match obligation {
-            Ok(ob) => self.register_obligation(ob),
-            _ => {}
+        if let Ok(ob) = obligation {
+            self.register_obligation(ob);
         }
     }
 
@@ -3763,19 +3757,16 @@ fn check_expr_with_unifier<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
           check_expr(fcx, &**subexpr);
 
           let mut checked = false;
-          match place.node {
-              ast::ExprPath(ref path) => {
-                  // FIXME(pcwalton): For now we hardcode the two permissible
-                  // places: the exchange heap and the managed heap.
-                  let definition = lookup_def(fcx, path.span, place.id);
-                  let def_id = definition.def_id();
-                  let referent_ty = fcx.expr_ty(&**subexpr);
-                  if tcx.lang_items.exchange_heap() == Some(def_id) {
-                      fcx.write_ty(id, ty::mk_uniq(tcx, referent_ty));
-                      checked = true
-                  }
+          if let ast::ExprPath(ref path) = place.node {
+              // FIXME(pcwalton): For now we hardcode the two permissible
+              // places: the exchange heap and the managed heap.
+              let definition = lookup_def(fcx, path.span, place.id);
+              let def_id = definition.def_id();
+              let referent_ty = fcx.expr_ty(&**subexpr);
+              if tcx.lang_items.exchange_heap() == Some(def_id) {
+                  fcx.write_ty(id, ty::mk_uniq(tcx, referent_ty));
+                  checked = true
               }
-              _ => {}
           }
 
           if !checked {
@@ -4129,11 +4120,8 @@ fn check_expr_with_unifier<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         }
       }
       ast::ExprCast(ref e, ref t) => {
-        match t.node {
-            ast::TyFixedLengthVec(_, ref count_expr) => {
-                check_expr_with_hint(fcx, &**count_expr, ty::mk_uint());
-            }
-            _ => {}
+        if let ast::TyFixedLengthVec(_, ref count_expr) = t.node {
+            check_expr_with_hint(fcx, &**count_expr, ty::mk_uint());
         }
         check_cast(fcx, expr, &**e, &**t);
       }
@@ -4524,15 +4512,12 @@ pub fn check_decl_local(fcx: &FnCtxt, local: &ast::Local)  {
     let t = fcx.local_ty(local.span, local.id);
     fcx.write_ty(local.id, t);
 
-    match local.init {
-        Some(ref init) => {
-            check_decl_initializer(fcx, local.id, &**init);
-            let init_ty = fcx.expr_ty(&**init);
-            if ty::type_is_error(init_ty) {
-                fcx.write_ty(local.id, init_ty);
-            }
+    if let Some(ref init) = local.init {
+        check_decl_initializer(fcx, local.id, &**init);
+        let init_ty = fcx.expr_ty(&**init);
+        if ty::type_is_error(init_ty) {
+            fcx.write_ty(local.id, init_ty);
         }
-        _ => {}
     }
 
     let pcx = pat_ctxt {
diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs
index bc6e7d9d87f..08f7f9cf5e3 100644
--- a/src/librustc/middle/typeck/check/regionck.rs
+++ b/src/librustc/middle/typeck/check/regionck.rs
@@ -672,12 +672,9 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
                 }
                 None => rcx.resolve_node_type(base.id)
             };
-            match base_ty.sty {
-                ty::ty_rptr(r_ptr, _) => {
-                    mk_subregion_due_to_dereference(
-                        rcx, expr.span, ty::ReScope(CodeExtent::from_node_id(expr.id)), r_ptr);
-                }
-                _ => {}
+            if let ty::ty_rptr(r_ptr, _) = base_ty.sty {
+                mk_subregion_due_to_dereference(
+                    rcx, expr.span, ty::ReScope(CodeExtent::from_node_id(expr.id)), r_ptr);
             }
 
             visit::walk_expr(rcx, expr);
@@ -943,12 +940,9 @@ fn check_expr_fn_block(rcx: &mut Rcx,
                 let cause = traits::ObligationCause::new(freevar.span, code);
                 let obligation = traits::obligation_for_builtin_bound(rcx.tcx(), cause,
                                                                       var_ty, builtin_bound);
-                match obligation {
-                    Ok(obligation) => {
-                        rcx.fcx.inh.fulfillment_cx.borrow_mut().register_obligation(rcx.tcx(),
-                                                                                    obligation)
-                    }
-                    _ => {}
+                if let Ok(obligation) = obligation {
+                    rcx.fcx.inh.fulfillment_cx.borrow_mut().register_obligation(rcx.tcx(),
+                                                                                obligation)
                 }
             }
             type_must_outlive(
@@ -1036,20 +1030,17 @@ fn check_expr_fn_block(rcx: &mut Rcx,
             // after checking the inner closure (and hence
             // determining the final borrow_kind) and propagate that as
             // a constraint on the outer closure.
-            match freevar.def {
-                def::DefUpvar(var_id, outer_closure_id, _) => {
-                    // thing being captured is itself an upvar:
-                    let outer_upvar_id = ty::UpvarId {
-                        var_id: var_id,
-                        closure_expr_id: outer_closure_id };
-                    let inner_upvar_id = ty::UpvarId {
-                        var_id: var_id,
-                        closure_expr_id: expr.id };
-                    link_upvar_borrow_kind_for_nested_closures(rcx,
-                                                               inner_upvar_id,
-                                                               outer_upvar_id);
-                }
-                _ => {}
+            if let def::DefUpvar(var_id, outer_closure_id, _) = freevar.def {
+                // thing being captured is itself an upvar:
+                let outer_upvar_id = ty::UpvarId {
+                    var_id: var_id,
+                    closure_expr_id: outer_closure_id };
+                let inner_upvar_id = ty::UpvarId {
+                    var_id: var_id,
+                    closure_expr_id: expr.id };
+                link_upvar_borrow_kind_for_nested_closures(rcx,
+                                                           inner_upvar_id,
+                                                           outer_upvar_id);
             }
         }
     }
@@ -1199,12 +1190,9 @@ fn constrain_autoderefs<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
             None => derefd_ty
         };
 
-        match derefd_ty.sty {
-            ty::ty_rptr(r_ptr, _) => {
-                mk_subregion_due_to_dereference(rcx, deref_expr.span,
-                                                r_deref_expr, r_ptr);
-            }
-            _ => {}
+        if let ty::ty_rptr(r_ptr, _) =  derefd_ty.sty {
+            mk_subregion_due_to_dereference(rcx, deref_expr.span,
+                                            r_deref_expr, r_ptr);
         }
 
         match ty::deref(derefd_ty, true) {
@@ -1235,16 +1223,14 @@ fn constrain_index<'a, 'tcx>(rcx: &mut Rcx<'a, 'tcx>,
            rcx.fcx.infcx().ty_to_string(indexed_ty));
 
     let r_index_expr = ty::ReScope(CodeExtent::from_node_id(index_expr.id));
-    match indexed_ty.sty {
-        ty::ty_rptr(r_ptr, mt) => match mt.ty.sty {
+    if let ty::ty_rptr(r_ptr, mt) = indexed_ty.sty {
+        match mt.ty.sty {
             ty::ty_vec(_, None) | ty::ty_str => {
                 rcx.fcx.mk_subr(infer::IndexSlice(index_expr.span),
                                 r_index_expr, r_ptr);
             }
             _ => {}
-        },
-
-        _ => {}
+        }
     }
 }
 
@@ -1615,21 +1601,18 @@ fn link_reborrowed_region<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
             // upvar borrow kind to mutable/unique.  Record the
             // information needed to perform the recursive link in the
             // maybe link map.
-            match note {
-                mc::NoteUpvarRef(upvar_id) => {
-                    let link = MaybeLink {
-                        span: span,
-                        borrow_region: borrow_region,
-                        borrow_kind: new_borrow_kind,
-                        borrow_cmt: ref_cmt
-                    };
-
-                    match rcx.maybe_links.borrow_mut().entry(upvar_id) {
-                        Vacant(entry) => { entry.set(vec![link]); }
-                        Occupied(entry) => { entry.into_mut().push(link); }
-                    }
-                },
-                _ => {}
+            if let mc::NoteUpvarRef(upvar_id) = note {
+                let link = MaybeLink {
+                    span: span,
+                    borrow_region: borrow_region,
+                    borrow_kind: new_borrow_kind,
+                    borrow_cmt: ref_cmt
+                };
+
+                match rcx.maybe_links.borrow_mut().entry(upvar_id) {
+                    Vacant(entry) => { entry.set(vec![link]); }
+                    Occupied(entry) => { entry.into_mut().push(link); }
+                }
             }
 
             return None;
@@ -1673,19 +1656,15 @@ fn adjust_upvar_borrow_kind_for_mut<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
 
             mc::cat_deref(base, _, mc::BorrowedPtr(..)) |
             mc::cat_deref(base, _, mc::Implicit(..)) => {
-                match cmt.note {
-                    mc::NoteUpvarRef(ref upvar_id) => {
-                        // if this is an implicit deref of an
-                        // upvar, then we need to modify the
-                        // borrow_kind of the upvar to make sure it
-                        // is inferred to mutable if necessary
-                        let mut upvar_borrow_map =
-                            rcx.fcx.inh.upvar_borrow_map.borrow_mut();
-                        let ub = &mut (*upvar_borrow_map)[*upvar_id];
-                        return adjust_upvar_borrow_kind(rcx, *upvar_id, ub, ty::MutBorrow);
-                    }
-
-                    _ => {}
+                if let mc::NoteUpvarRef(ref upvar_id) = cmt.note {
+                    // if this is an implicit deref of an
+                    // upvar, then we need to modify the
+                    // borrow_kind of the upvar to make sure it
+                    // is inferred to mutable if necessary
+                    let mut upvar_borrow_map =
+                        rcx.fcx.inh.upvar_borrow_map.borrow_mut();
+                    let ub = &mut (*upvar_borrow_map)[*upvar_id];
+                    return adjust_upvar_borrow_kind(rcx, *upvar_id, ub, ty::MutBorrow);
                 }
 
                 // assignment to deref of an `&mut`
@@ -1724,18 +1703,14 @@ fn adjust_upvar_borrow_kind_for_unique<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>, cmt: mc::c
 
             mc::cat_deref(base, _, mc::BorrowedPtr(..)) |
             mc::cat_deref(base, _, mc::Implicit(..)) => {
-                match cmt.note {
-                    mc::NoteUpvarRef(ref upvar_id) => {
-                        // if this is an implicit deref of an
-                        // upvar, then we need to modify the
-                        // borrow_kind of the upvar to make sure it
-                        // is inferred to unique if necessary
-                        let mut ub = rcx.fcx.inh.upvar_borrow_map.borrow_mut();
-                        let ub = &mut (*ub)[*upvar_id];
-                        return adjust_upvar_borrow_kind(rcx, *upvar_id, ub, ty::UniqueImmBorrow);
-                    }
-
-                    _ => {}
+                if let mc::NoteUpvarRef(ref upvar_id) = cmt.note {
+                    // if this is an implicit deref of an
+                    // upvar, then we need to modify the
+                    // borrow_kind of the upvar to make sure it
+                    // is inferred to unique if necessary
+                    let mut ub = rcx.fcx.inh.upvar_borrow_map.borrow_mut();
+                    let ub = &mut (*ub)[*upvar_id];
+                    return adjust_upvar_borrow_kind(rcx, *upvar_id, ub, ty::UniqueImmBorrow);
                 }
 
                 // for a borrowed pointer to be unique, its
diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs
index 51978a01f71..84cb74b4de2 100644
--- a/src/librustc/middle/typeck/check/vtable.rs
+++ b/src/librustc/middle/typeck/check/vtable.rs
@@ -208,15 +208,13 @@ pub fn check_object_safety<'tcx>(tcx: &ty::ctxt<'tcx>,
         };
         let ref sig = method.fty.sig;
         for &input_ty in sig.inputs[1..].iter() {
-            match check_for_self_ty(input_ty) {
-                Some(msg) => msgs.push(msg),
-                _ => {}
+            if let Some(msg) = check_for_self_ty(input_ty) {
+                msgs.push(msg);
             }
         }
         if let ty::FnConverging(result_type) = sig.output {
-            match check_for_self_ty(result_type) {
-                Some(msg) => msgs.push(msg),
-                _ => {}
+            if let Some(msg) = check_for_self_ty(result_type) {
+                msgs.push(msg);
             }
         }
 
@@ -290,10 +288,9 @@ pub fn register_object_cast_obligations<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                      traits::ObjectCastObligation(object_trait_ty)),
                 referent_ty,
                 builtin_bound);
-            match obligation {
-                Ok(obligation) => fcx.register_obligation(obligation),
-                _ => {}
-            }
+        if let Ok(obligation) = obligation {
+            fcx.register_obligation(obligation);
+        }
     }
 
     object_trait_ref
diff --git a/src/librustc/middle/typeck/check/wf.rs b/src/librustc/middle/typeck/check/wf.rs
index 502e37aa9f3..8535ec4fa6e 100644
--- a/src/librustc/middle/typeck/check/wf.rs
+++ b/src/librustc/middle/typeck/check/wf.rs
@@ -127,9 +127,8 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> {
                                                                               cause,
                                                                               field.ty,
                                                                               ty::BoundSized);
-                        match obligation {
-                            Ok(obligation) => fcx.register_obligation(obligation),
-                            _ => {}
+                        if let Ok(obligation) = obligation {
+                            fcx.register_obligation(obligation);
                         }
                     }
                 }
@@ -233,9 +232,8 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> {
                                                                       cause,
                                                                       trait_ref.self_ty(),
                                                                       builtin_bound);
-                match obligation {
-                    Ok (obligation) => fcx.register_obligation(obligation),
-                    _ => {}
+                if let Ok(obligation) = obligation {
+                    fcx.register_obligation(obligation);
                 }
             }
             for trait_bound in trait_def.bounds.trait_bounds.iter() {
@@ -471,9 +469,8 @@ fn check_struct_safe_for_destructor<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                                                               cause,
                                                               self_ty,
                                                               ty::BoundSend);
-        match obligation {
-            Ok(obligation) => fcx.register_obligation(obligation),
-            _ => {}
+        if let Ok(obligation) = obligation {
+            fcx.register_obligation(obligation);
         }
     } else {
         span_err!(fcx.tcx().sess, span, E0141,
diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs
index 3a62978ed00..061d2a2f5c4 100644
--- a/src/librustc/middle/typeck/collect.rs
+++ b/src/librustc/middle/typeck/collect.rs
@@ -258,112 +258,96 @@ fn collect_trait_methods<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                    trait_id: ast::NodeId,
                                    trait_def: &ty::TraitDef<'tcx>) {
     let tcx = ccx.tcx;
-    match tcx.map.get(trait_id) {
-        ast_map::NodeItem(item) => {
-            match item.node {
-                ast::ItemTrait(_, _, _, ref trait_items) => {
-                    // For each method, construct a suitable ty::Method and
-                    // store it into the `tcx.impl_or_trait_items` table:
-                    for trait_item in trait_items.iter() {
-                        match *trait_item {
-                            ast::RequiredMethod(_) |
-                            ast::ProvidedMethod(_) => {
-                                let ty_method = Rc::new(match *trait_item {
-                                    ast::RequiredMethod(ref m) => {
-                                        ty_method_of_trait_method(
-                                            ccx,
-                                            trait_id,
-                                            &trait_def.generics,
-                                            trait_items.as_slice(),
-                                            &m.id,
-                                            &m.ident.name,
-                                            &m.explicit_self,
-                                            m.abi,
-                                            &m.generics,
-                                            &m.fn_style,
-                                            &*m.decl)
-                                    }
-                                    ast::ProvidedMethod(ref m) => {
-                                        ty_method_of_trait_method(
-                                            ccx,
-                                            trait_id,
-                                            &trait_def.generics,
-                                            trait_items.as_slice(),
-                                            &m.id,
-                                            &m.pe_ident().name,
-                                            m.pe_explicit_self(),
-                                            m.pe_abi(),
-                                            m.pe_generics(),
-                                            &m.pe_fn_style(),
-                                            &*m.pe_fn_decl())
-                                    }
-                                    ast::TypeTraitItem(ref at) => {
-                                        tcx.sess.span_bug(at.ty_param.span,
-                                                          "there shouldn't \
-                                                           be a type trait \
-                                                           item here")
-                                    }
-                                });
-
-                                debug!("ty_method_of_trait_method yielded {} \
-                                        for method {} of trait {}",
-                                       ty_method.repr(ccx.tcx),
-                                       trait_item.repr(ccx.tcx),
-                                       local_def(trait_id).repr(ccx.tcx));
-
-                                make_method_ty(ccx, &*ty_method);
-
-                                tcx.impl_or_trait_items
-                                   .borrow_mut()
-                                   .insert(ty_method.def_id,
-                                           ty::MethodTraitItem(ty_method));
+    if let ast_map::NodeItem(item) = tcx.map.get(trait_id) {
+        if let ast::ItemTrait(_, _, _, ref trait_items) = item.node {
+            // For each method, construct a suitable ty::Method and
+            // store it into the `tcx.impl_or_trait_items` table:
+            for trait_item in trait_items.iter() {
+                match *trait_item {
+                    ast::RequiredMethod(_) |
+                    ast::ProvidedMethod(_) => {
+                        let ty_method = Rc::new(match *trait_item {
+                            ast::RequiredMethod(ref m) => {
+                                ty_method_of_trait_method(
+                                    ccx,
+                                    trait_id,
+                                    &trait_def.generics,
+                                    trait_items.as_slice(),
+                                    &m.id,
+                                    &m.ident.name,
+                                    &m.explicit_self,
+                                    m.abi,
+                                    &m.generics,
+                                    &m.fn_style,
+                                    &*m.decl)
                             }
-                            ast::TypeTraitItem(ref ast_associated_type) => {
-                                let trait_did = local_def(trait_id);
-                                let associated_type = ty::AssociatedType {
-                                    name: ast_associated_type.ty_param.ident.name,
-                                    vis: ast::Public,
-                                    def_id: local_def(ast_associated_type.ty_param.id),
-                                    container: TraitContainer(trait_did),
-                                };
-
-                                let trait_item = ty::TypeTraitItem(Rc::new(
-                                        associated_type));
-                                tcx.impl_or_trait_items
-                                   .borrow_mut()
-                                   .insert(associated_type.def_id,
-                                           trait_item);
+                            ast::ProvidedMethod(ref m) => {
+                                ty_method_of_trait_method(
+                                    ccx,
+                                    trait_id,
+                                    &trait_def.generics,
+                                    trait_items.as_slice(),
+                                    &m.id,
+                                    &m.pe_ident().name,
+                                    m.pe_explicit_self(),
+                                    m.pe_abi(),
+                                    m.pe_generics(),
+                                    &m.pe_fn_style(),
+                                    &*m.pe_fn_decl())
                             }
-                        }
-                    }
-
-                    // Add an entry mapping
-                    let trait_item_def_ids =
-                        Rc::new(trait_items.iter()
-                                           .map(|ti| {
-                            match *ti {
-                                ast::RequiredMethod(ref ty_method) => {
-                                    ty::MethodTraitItemId(local_def(
-                                            ty_method.id))
-                                }
-                                ast::ProvidedMethod(ref method) => {
-                                    ty::MethodTraitItemId(local_def(
-                                            method.id))
-                                }
-                                ast::TypeTraitItem(ref typedef) => {
-                                    ty::TypeTraitItemId(local_def(typedef.ty_param.id))
-                                }
+                            ast::TypeTraitItem(ref at) => {
+                                tcx.sess.span_bug(at.ty_param.span,
+                                                  "there shouldn't be a type trait item here")
                             }
-                        }).collect());
+                        });
+
+                        debug!("ty_method_of_trait_method yielded {} for method {} of trait {}",
+                               ty_method.repr(ccx.tcx),
+                               trait_item.repr(ccx.tcx),
+                               local_def(trait_id).repr(ccx.tcx));
+
+                        make_method_ty(ccx, &*ty_method);
 
-                    let trait_def_id = local_def(trait_id);
-                    tcx.trait_item_def_ids.borrow_mut()
-                        .insert(trait_def_id, trait_item_def_ids);
+                        tcx.impl_or_trait_items
+                            .borrow_mut()
+                            .insert(ty_method.def_id, ty::MethodTraitItem(ty_method));
+                    }
+                    ast::TypeTraitItem(ref ast_associated_type) => {
+                        let trait_did = local_def(trait_id);
+                        let associated_type = ty::AssociatedType {
+                            name: ast_associated_type.ty_param.ident.name,
+                            vis: ast::Public,
+                            def_id: local_def(ast_associated_type.ty_param.id),
+                            container: TraitContainer(trait_did),
+                        };
+
+                        let trait_item = ty::TypeTraitItem(Rc::new(associated_type));
+                        tcx.impl_or_trait_items
+                            .borrow_mut()
+                            .insert(associated_type.def_id, trait_item);
+                    }
                 }
-                _ => {} // Ignore things that aren't traits.
             }
+
+            // Add an entry mapping
+            let trait_item_def_ids =
+                Rc::new(trait_items.iter().map(|ti| {
+                    match *ti {
+                        ast::RequiredMethod(ref ty_method) => {
+                            ty::MethodTraitItemId(local_def(ty_method.id))
+                        }
+                        ast::ProvidedMethod(ref method) => {
+                            ty::MethodTraitItemId(local_def(method.id))
+                        }
+                        ast::TypeTraitItem(ref typedef) => {
+                            ty::TypeTraitItemId(local_def(typedef.ty_param.id))
+                        }
+                    }
+                }).collect());
+
+            let trait_def_id = local_def(trait_id);
+            tcx.trait_item_def_ids.borrow_mut().insert(trait_def_id, trait_item_def_ids);
         }
-        _ => { /* Ignore things that aren't traits */ }
     }
 
     fn make_method_ty<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, m: &ty::Method<'tcx>) {
@@ -664,17 +648,13 @@ fn is_associated_type_valid_for_param(ty: Ty,
                                       trait_id: ast::DefId,
                                       generics: &ty::Generics)
                                       -> bool {
-    match ty.sty {
-        ty::ty_param(param_ty) => {
-            let type_parameter = generics.types.get(param_ty.space,
-                                                    param_ty.idx);
-            for trait_bound in type_parameter.bounds.trait_bounds.iter() {
-                if trait_bound.def_id == trait_id {
-                    return true
-                }
+    if let ty::ty_param(param_ty) = ty.sty {
+        let type_parameter = generics.types.get(param_ty.space, param_ty.idx);
+        for trait_bound in type_parameter.bounds.trait_bounds.iter() {
+            if trait_bound.def_id == trait_id {
+                return true
             }
         }
-        _ => {}
     }
 
     false
@@ -1352,9 +1332,8 @@ pub fn trait_def_of_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
                                    -> Rc<ty::TraitDef<'tcx>> {
     let def_id = local_def(it.id);
     let tcx = ccx.tcx;
-    match tcx.trait_defs.borrow().get(&def_id) {
-        Some(def) => return def.clone(),
-        _ => {}
+    if let Some(def) = tcx.trait_defs.borrow().get(&def_id) {
+        return def.clone();
     }
 
     let (generics, unbound, bounds, items) = match it.node {
@@ -1452,9 +1431,8 @@ pub fn ty_of_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, it: &ast::Item)
                             -> ty::Polytype<'tcx> {
     let def_id = local_def(it.id);
     let tcx = ccx.tcx;
-    match tcx.tcache.borrow().get(&def_id) {
-        Some(pty) => return pty.clone(),
-        _ => {}
+    if let Some(pty) = tcx.tcache.borrow().get(&def_id) {
+        return pty.clone();
     }
     match it.node {
         ast::ItemStatic(ref t, _, _) | ast::ItemConst(ref t, _) => {
@@ -2146,54 +2124,51 @@ fn check_method_self_type<'a, 'tcx, RS:RegionScope>(
     explicit_self: &ast::ExplicitSelf,
     body_id: ast::NodeId)
 {
-    match explicit_self.node {
-        ast::SelfExplicit(ref ast_type, _) => {
-            let typ = crate_context.to_ty(rs, &**ast_type);
-            let base_type = match typ.sty {
-                ty::ty_ptr(tm) | ty::ty_rptr(_, tm) => tm.ty,
-                ty::ty_uniq(typ) => typ,
-                _ => typ,
-            };
+    if let ast::SelfExplicit(ref ast_type, _) = explicit_self.node {
+        let typ = crate_context.to_ty(rs, &**ast_type);
+        let base_type = match typ.sty {
+            ty::ty_ptr(tm) | ty::ty_rptr(_, tm) => tm.ty,
+            ty::ty_uniq(typ) => typ,
+            _ => typ,
+        };
 
-            let body_scope = region::CodeExtent::from_node_id(body_id);
-
-            // "Required type" comes from the trait definition. It may
-            // contain late-bound regions from the method, but not the
-            // trait (since traits only have early-bound region
-            // parameters).
-            assert!(!ty::type_escapes_depth(required_type, 1));
-            let required_type_free =
-                ty::liberate_late_bound_regions(
-                    crate_context.tcx, body_scope, &ty::bind(required_type)).value;
-
-            // The "base type" comes from the impl. It may have late-bound
-            // regions from the impl or the method.
-            let base_type_free = // liberate impl regions:
-                ty::liberate_late_bound_regions(
-                    crate_context.tcx, body_scope, &ty::bind(ty::bind(base_type))).value.value;
-            let base_type_free = // liberate method regions:
-                ty::liberate_late_bound_regions(
-                    crate_context.tcx, body_scope, &ty::bind(base_type_free)).value;
-
-            debug!("required_type={} required_type_free={} \
-                    base_type={} base_type_free={}",
-                   required_type.repr(crate_context.tcx),
-                   required_type_free.repr(crate_context.tcx),
-                   base_type.repr(crate_context.tcx),
-                   base_type_free.repr(crate_context.tcx));
-            let infcx = infer::new_infer_ctxt(crate_context.tcx);
-            drop(typeck::require_same_types(crate_context.tcx,
-                                            Some(&infcx),
-                                            false,
-                                            explicit_self.span,
-                                            base_type_free,
-                                            required_type_free,
-                                            || {
+        let body_scope = region::CodeExtent::from_node_id(body_id);
+
+        // "Required type" comes from the trait definition. It may
+        // contain late-bound regions from the method, but not the
+        // trait (since traits only have early-bound region
+        // parameters).
+        assert!(!ty::type_escapes_depth(required_type, 1));
+        let required_type_free =
+            ty::liberate_late_bound_regions(
+                crate_context.tcx, body_scope, &ty::bind(required_type)).value;
+
+        // The "base type" comes from the impl. It may have late-bound
+        // regions from the impl or the method.
+        let base_type_free = // liberate impl regions:
+            ty::liberate_late_bound_regions(
+                crate_context.tcx, body_scope, &ty::bind(ty::bind(base_type))).value.value;
+        let base_type_free = // liberate method regions:
+            ty::liberate_late_bound_regions(
+                crate_context.tcx, body_scope, &ty::bind(base_type_free)).value;
+
+        debug!("required_type={} required_type_free={} \
+                base_type={} base_type_free={}",
+               required_type.repr(crate_context.tcx),
+               required_type_free.repr(crate_context.tcx),
+               base_type.repr(crate_context.tcx),
+               base_type_free.repr(crate_context.tcx));
+        let infcx = infer::new_infer_ctxt(crate_context.tcx);
+        drop(typeck::require_same_types(crate_context.tcx,
+                                        Some(&infcx),
+                                        false,
+                                        explicit_self.span,
+                                        base_type_free,
+                                        required_type_free,
+                                        || {
                 format!("mismatched self type: expected `{}`",
                         ppaux::ty_to_string(crate_context.tcx, required_type))
-            }));
-            infcx.resolve_regions_and_report_errors();
-        }
-        _ => {}
+        }));
+        infcx.resolve_regions_and_report_errors();
     }
 }
diff --git a/src/librustc/plugin/build.rs b/src/librustc/plugin/build.rs
index 457fcb861e6..a8018662d29 100644
--- a/src/librustc/plugin/build.rs
+++ b/src/librustc/plugin/build.rs
@@ -23,14 +23,11 @@ struct RegistrarFinder {
 
 impl<'v> Visitor<'v> for RegistrarFinder {
     fn visit_item(&mut self, item: &ast::Item) {
-        match item.node {
-            ast::ItemFn(..) => {
-                if attr::contains_name(item.attrs.as_slice(),
-                                       "plugin_registrar") {
-                    self.registrars.push((item.id, item.span));
-                }
+        if let ast::ItemFn(..) = item.node {
+            if attr::contains_name(item.attrs.as_slice(),
+                                   "plugin_registrar") {
+                self.registrars.push((item.id, item.span));
             }
-            _ => {}
         }
 
         visit::walk_item(self, item);
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 3715256e3ec..d8cdffe2100 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -139,39 +139,27 @@ pub fn find_crate_name(sess: Option<&Session>,
     let attr_crate_name = attrs.iter().find(|at| at.check_name("crate_name"))
                                .and_then(|at| at.value_str().map(|s| (at, s)));
 
-    match sess {
-        Some(sess) => {
-            match sess.opts.crate_name {
-                Some(ref s) => {
-                    match attr_crate_name {
-                        Some((attr, ref name)) if s.as_slice() != name.get() => {
-                            let msg = format!("--crate-name and #[crate_name] \
-                                               are required to match, but `{}` \
-                                               != `{}`", s, name);
-                            sess.span_err(attr.span, msg.as_slice());
-                        }
-                        _ => {},
-                    }
-                    return validate(s.clone(), None);
+    if let Some(sess) = sess {
+        if let Some(ref s) = sess.opts.crate_name {
+            if let Some((attr, ref name)) = attr_crate_name {
+                if s.as_slice() != name.get() {
+                    let msg = format!("--crate-name and #[crate_name] are \
+                                       required to match, but `{}` != `{}`",
+                                      s, name);
+                    sess.span_err(attr.span, msg.as_slice());
                 }
-                None => {}
             }
+            return validate(s.clone(), None);
         }
-        None => {}
     }
 
-    match attr_crate_name {
-        Some((attr, s)) => return validate(s.get().to_string(), Some(attr.span)),
-        None => {}
+    if let Some((attr, s)) = attr_crate_name {
+        return validate(s.get().to_string(), Some(attr.span));
     }
-    match *input {
-        FileInput(ref path) => {
-            match path.filestem_str() {
-                Some(s) => return validate(s.to_string(), None),
-                None => {}
-            }
+    if let FileInput(ref path) = *input {
+        if let Some(s) = path.filestem_str() {
+            return validate(s.to_string(), None);
         }
-        _ => {}
     }
 
     "rust-out".to_string()
diff --git a/src/librustc_trans/save/mod.rs b/src/librustc_trans/save/mod.rs
index f5c732d9adc..7a41be1dbe4 100644
--- a/src/librustc_trans/save/mod.rs
+++ b/src/librustc_trans/save/mod.rs
@@ -1073,16 +1073,12 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
     fn visit_generics(&mut self, generics: &ast::Generics) {
         for param in generics.ty_params.iter() {
             for bound in param.bounds.iter() {
-                match *bound {
-                    ast::TraitTyParamBound(ref trait_ref) => {
-                        self.process_trait_ref(&trait_ref.trait_ref, None);
-                    }
-                    _ => {}
+                if let ast::TraitTyParamBound(ref trait_ref) = *bound {
+                    self.process_trait_ref(&trait_ref.trait_ref, None);
                 }
             }
-            match param.default {
-                Some(ref ty) => self.visit_ty(&**ty),
-                None => {}
+            if let Some(ref ty) = param.default {
+                self.visit_ty(&**ty);
             }
         }
     }
diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs
index e8b759fa1a2..ada46ab7db7 100644
--- a/src/librustc_trans/trans/_match.rs
+++ b/src/librustc_trans/trans/_match.rs
@@ -438,14 +438,11 @@ fn enter_match<'a, 'b, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                     }
                 }
                 ast::PatVec(ref before, Some(ref slice), ref after) => {
-                    match slice.node {
-                        ast::PatIdent(_, ref path, None) => {
-                            let subslice_val = bind_subslice_pat(
-                                bcx, this.id, val,
-                                before.len(), after.len());
-                            bound_ptrs.push((path.node, subslice_val));
-                        }
-                        _ => {}
+                    if let ast::PatIdent(_, ref path, None) = slice.node {
+                        let subslice_val = bind_subslice_pat(
+                            bcx, this.id, val,
+                            before.len(), after.len());
+                        bound_ptrs.push((path.node, subslice_val));
                     }
                 }
                 _ => {}
@@ -835,9 +832,8 @@ fn insert_lllocals<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
                 let datum = Datum::new(llval, binding_info.ty, Lvalue);
                 call_lifetime_start(bcx, llbinding);
                 bcx = datum.store_to(bcx, llbinding);
-                match cs {
-                    Some(cs) => bcx.fcx.schedule_lifetime_end(cs, llbinding),
-                    _ => {}
+                if let Some(cs) = cs {
+                    bcx.fcx.schedule_lifetime_end(cs, llbinding);
                 }
 
                 llbinding
@@ -851,12 +847,9 @@ fn insert_lllocals<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
         };
 
         let datum = Datum::new(llval, binding_info.ty, Lvalue);
-        match cs {
-            Some(cs) => {
-                bcx.fcx.schedule_drop_and_zero_mem(cs, llval, binding_info.ty);
-                bcx.fcx.schedule_lifetime_end(cs, binding_info.llmatch);
-            }
-            _ => {}
+        if let Some(cs) = cs {
+            bcx.fcx.schedule_drop_and_zero_mem(cs, llval, binding_info.ty);
+            bcx.fcx.schedule_lifetime_end(cs, binding_info.llmatch);
         }
 
         debug!("binding {} to {}",
@@ -894,9 +887,8 @@ fn compile_guard<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let val = val.to_llbool(bcx);
 
     for (_, &binding_info) in data.bindings_map.iter() {
-        match binding_info.trmode {
-            TrByCopy(llbinding) => call_lifetime_end(bcx, llbinding),
-            _ => {}
+        if let TrByCopy(llbinding) = binding_info.trmode {
+            call_lifetime_end(bcx, llbinding);
         }
     }
 
diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs
index 52e54a4a261..9d6d1bc4a9e 100644
--- a/src/librustc_trans/trans/base.rs
+++ b/src/librustc_trans/trans/base.rs
@@ -2212,21 +2212,18 @@ pub fn update_linkage(ccx: &CrateContext,
         OriginalTranslation => {},
     }
 
-    match id {
-        Some(id) => {
-            let item = ccx.tcx().map.get(id);
-            if let ast_map::NodeItem(i) = item {
-                if let Some(name) =  attr::first_attr_value_str_by_name(i.attrs[], "linkage") {
-                    if let Some(linkage) = llvm_linkage_by_name(name.get()) {
-                        llvm::SetLinkage(llval, linkage);
-                    } else {
-                        ccx.sess().span_fatal(i.span, "invalid linkage specified");
-                    }
-                    return;
+    if let Some(id) = id {
+        let item = ccx.tcx().map.get(id);
+        if let ast_map::NodeItem(i) = item {
+            if let Some(name) = attr::first_attr_value_str_by_name(i.attrs[], "linkage") {
+                if let Some(linkage) = llvm_linkage_by_name(name.get()) {
+                    llvm::SetLinkage(llval, linkage);
+                } else {
+                    ccx.sess().span_fatal(i.span, "invalid linkage specified");
                 }
+                return;
             }
         }
-        _ => {}
     }
 
     match id {
@@ -2492,11 +2489,8 @@ pub fn get_fn_llvm_attributes<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_ty: Ty<
                 _ => {}
             }
 
-            match ret_ty.sty {
-                ty::ty_bool => {
-                    attrs.ret(llvm::ZExtAttribute);
-                }
-                _ => {}
+            if let ty::ty_bool = ret_ty.sty {
+                attrs.ret(llvm::ZExtAttribute);
             }
         }
     }
@@ -2543,11 +2537,8 @@ pub fn get_fn_llvm_attributes<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_ty: Ty<
                     attrs.arg(idx, llvm::ReadOnlyAttribute);
                 }
 
-                match b {
-                    ReLateBound(_, BrAnon(_)) => {
-                        attrs.arg(idx, llvm::NoCaptureAttribute);
-                    }
-                    _ => {}
+                if let ReLateBound(_, BrAnon(_)) = b {
+                    attrs.arg(idx, llvm::NoCaptureAttribute);
                 }
             }
 
diff --git a/src/librustc_trans/trans/callee.rs b/src/librustc_trans/trans/callee.rs
index 5d713526a3d..80a17465d78 100644
--- a/src/librustc_trans/trans/callee.rs
+++ b/src/librustc_trans/trans/callee.rs
@@ -92,11 +92,8 @@ fn trans<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &ast::Expr)
     debug!("callee::trans(expr={})", expr.repr(bcx.tcx()));
 
     // pick out special kinds of expressions that can be called:
-    match expr.node {
-        ast::ExprPath(_) => {
-            return trans_def(bcx, bcx.def(expr.id), expr);
-        }
-        _ => {}
+    if let ast::ExprPath(_) = expr.node {
+        return trans_def(bcx, bcx.def(expr.id), expr);
     }
 
     // any other expressions are closures:
diff --git a/src/librustc_trans/trans/cleanup.rs b/src/librustc_trans/trans/cleanup.rs
index d7da83ddb0d..33393ba76c5 100644
--- a/src/librustc_trans/trans/cleanup.rs
+++ b/src/librustc_trans/trans/cleanup.rs
@@ -236,11 +236,8 @@ impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> {
     /// Returns the id of the top-most loop scope
     fn top_loop_scope(&self) -> ast::NodeId {
         for scope in self.scopes.borrow().iter().rev() {
-            match scope.kind {
-                LoopScopeKind(id, _) => {
-                    return id;
-                }
-                _ => {}
+            if let LoopScopeKind(id, _) = scope.kind {
+                return id;
             }
         }
         self.ccx.sess().bug("no loop scope found");
diff --git a/src/librustc_trans/trans/consts.rs b/src/librustc_trans/trans/consts.rs
index aa549c99d02..42daf718816 100644
--- a/src/librustc_trans/trans/consts.rs
+++ b/src/librustc_trans/trans/consts.rs
@@ -171,9 +171,8 @@ pub fn get_const_val(cx: &CrateContext,
             def_id = inline::maybe_instantiate_inline(cx, def_id);
         }
 
-        match cx.tcx().map.expect_item(def_id.node).node {
-            ast::ItemConst(..) => { base::get_item_val(cx, def_id.node); }
-            _ => {}
+        if let ast::ItemConst(..) = cx.tcx().map.expect_item(def_id.node).node {
+            base::get_item_val(cx, def_id.node);
         }
     }
 
@@ -546,12 +545,9 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef {
                   }
               }
               let opt_def = cx.tcx().def_map.borrow().get(&cur.id).cloned();
-              match opt_def {
-                  Some(def::DefStatic(def_id, _)) => {
-                      let ty = ty::expr_ty(cx.tcx(), e);
-                      return get_static_val(cx, def_id, ty);
-                  }
-                  _ => {}
+              if let Some(def::DefStatic(def_id, _)) = opt_def {
+                  let ty = ty::expr_ty(cx.tcx(), e);
+                  return get_static_val(cx, def_id, ty);
               }
 
               // If this isn't the address of a static, then keep going through
diff --git a/src/librustc_trans/trans/context.rs b/src/librustc_trans/trans/context.rs
index 6a28ef38c51..a0b7eb02f02 100644
--- a/src/librustc_trans/trans/context.rs
+++ b/src/librustc_trans/trans/context.rs
@@ -519,9 +519,8 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
     }
 
     pub fn get_intrinsic(&self, key: & &'static str) -> ValueRef {
-        match self.intrinsics().borrow().get(key).cloned() {
-            Some(v) => return v,
-            _ => {}
+        if let Some(v) = self.intrinsics().borrow().get(key).cloned() {
+            return v;
         }
         match declare_intrinsic(self, key) {
             Some(v) => return v,
diff --git a/src/librustc_trans/trans/controlflow.rs b/src/librustc_trans/trans/controlflow.rs
index 10a73033b64..7b2e48cd2e3 100644
--- a/src/librustc_trans/trans/controlflow.rs
+++ b/src/librustc_trans/trans/controlflow.rs
@@ -465,17 +465,14 @@ pub fn trans_ret<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         }
         _ => expr::Ignore,
     };
-    match e {
-        Some(x) => {
-            bcx = expr::trans_into(bcx, &*x, dest);
-            match dest {
-                expr::SaveIn(slot) if fcx.needs_ret_allocas => {
-                    Store(bcx, slot, fcx.llretslotptr.get().unwrap());
-                }
-                _ => {}
+    if let Some(x) = e {
+        bcx = expr::trans_into(bcx, &*x, dest);
+        match dest {
+            expr::SaveIn(slot) if fcx.needs_ret_allocas => {
+                Store(bcx, slot, fcx.llretslotptr.get().unwrap());
             }
+            _ => {}
         }
-        _ => {}
     }
     let cleanup_llbb = fcx.return_exit_block();
     Br(bcx, cleanup_llbb);
diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs
index b7ac0f49754..5a9131d94e2 100644
--- a/src/librustc_trans/trans/expr.rs
+++ b/src/librustc_trans/trans/expr.rs
@@ -209,14 +209,11 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 
             // (You might think there is a more elegant way to do this than a
             // use_autoref bool, but then you remember that the borrow checker exists).
-            match (use_autoref, &adj.autoref) {
-                (true, &Some(ref a)) => {
-                    datum = unpack_datum!(bcx, apply_autoref(a,
-                                                             bcx,
-                                                             expr,
-                                                             datum));
-                }
-                _ => {}
+            if let (true, &Some(ref a)) = (use_autoref, &adj.autoref) {
+                datum = unpack_datum!(bcx, apply_autoref(a,
+                                                         bcx,
+                                                         expr,
+                                                         datum));
             }
         }
     }
diff --git a/src/librustc_trans/trans/foreign.rs b/src/librustc_trans/trans/foreign.rs
index 6f97f6453fd..615d5467f84 100644
--- a/src/librustc_trans/trans/foreign.rs
+++ b/src/librustc_trans/trans/foreign.rs
@@ -355,9 +355,8 @@ pub fn trans_native_call<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         // skip padding
         if arg_ty.pad.is_some() { arg_idx += 1; }
 
-        match arg_ty.attr {
-            Some(attr) => { attrs.arg(arg_idx, attr); },
-            _ => {}
+        if let Some(attr) = arg_ty.attr {
+            attrs.arg(arg_idx, attr);
         }
 
         arg_idx += 1;
@@ -429,22 +428,19 @@ pub fn trans_foreign_mod(ccx: &CrateContext, foreign_mod: &ast::ForeignMod) {
     for foreign_item in foreign_mod.items.iter() {
         let lname = link_name(&**foreign_item);
 
-        match foreign_item.node {
-            ast::ForeignItemFn(..) => {
-                match foreign_mod.abi {
-                    Rust | RustIntrinsic => {}
-                    abi => {
-                        let ty = ty::node_id_to_type(ccx.tcx(), foreign_item.id);
-                        register_foreign_item_fn(ccx, abi, ty,
-                                                 lname.get().as_slice());
-                        // Unlike for other items, we shouldn't call
-                        // `base::update_linkage` here.  Foreign items have
-                        // special linkage requirements, which are handled
-                        // inside `foreign::register_*`.
-                    }
+        if let ast::ForeignItemFn(..) = foreign_item.node {
+            match foreign_mod.abi {
+                Rust | RustIntrinsic => {}
+                abi => {
+                    let ty = ty::node_id_to_type(ccx.tcx(), foreign_item.id);
+                    register_foreign_item_fn(ccx, abi, ty,
+                                             lname.get().as_slice());
+                    // Unlike for other items, we shouldn't call
+                    // `base::update_linkage` here.  Foreign items have
+                    // special linkage requirements, which are handled
+                    // inside `foreign::register_*`.
                 }
             }
-            _ => {}
         }
 
         ccx.item_symbols().borrow_mut().insert(foreign_item.id,
diff --git a/src/librustc_trans/trans/monomorphize.rs b/src/librustc_trans/trans/monomorphize.rs
index bf7d560fdaa..cb3c56ad277 100644
--- a/src/librustc_trans/trans/monomorphize.rs
+++ b/src/librustc_trans/trans/monomorphize.rs
@@ -84,14 +84,11 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                     fn_id)
         });
 
-    match map_node {
-        ast_map::NodeForeignItem(_) => {
-            if ccx.tcx().map.get_foreign_abi(fn_id.node) != abi::RustIntrinsic {
-                // Foreign externs don't have to be monomorphized.
-                return (get_item_val(ccx, fn_id.node), true);
-            }
+    if let ast_map::NodeForeignItem(_) = map_node {
+        if ccx.tcx().map.get_foreign_abi(fn_id.node) != abi::RustIntrinsic {
+            // Foreign externs don't have to be monomorphized.
+            return (get_item_val(ccx, fn_id.node), true);
         }
-        _ => {}
     }
 
     debug!("monomorphic_fn about to subst into {}", llitem_ty.repr(ccx.tcx()));
diff --git a/src/librustc_trans/trans/tvec.rs b/src/librustc_trans/trans/tvec.rs
index 9aeb4cdb8a3..00f938191f8 100644
--- a/src/librustc_trans/trans/tvec.rs
+++ b/src/librustc_trans/trans/tvec.rs
@@ -151,21 +151,15 @@ pub fn trans_slice_vec<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     let vec_ty = node_id_type(bcx, slice_expr.id);
 
     // Handle the "..." case (returns a slice since strings are always unsized):
-    match content_expr.node {
-        ast::ExprLit(ref lit) => {
-            match lit.node {
-                ast::LitStr(ref s, _) => {
-                    let scratch = rvalue_scratch_datum(bcx, vec_ty, "");
-                    bcx = trans_lit_str(bcx,
-                                        content_expr,
-                                        s.clone(),
-                                        SaveIn(scratch.val));
-                    return DatumBlock::new(bcx, scratch.to_expr_datum());
-                }
-                _ => {}
-            }
+    if let ast::ExprLit(ref lit) = content_expr.node {
+        if let ast::LitStr(ref s, _) = lit.node {
+            let scratch = rvalue_scratch_datum(bcx, vec_ty, "");
+            bcx = trans_lit_str(bcx,
+                                content_expr,
+                                s.clone(),
+                                SaveIn(scratch.val));
+            return DatumBlock::new(bcx, scratch.to_expr_datum());
         }
-        _ => {}
     }
 
     // Handle the &[...] case:
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 8270c8f3a20..d23c1b6ccf8 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -2200,12 +2200,9 @@ fn register_def(cx: &DocContext, def: def::Def) -> ast::DefId {
         None => return did
     };
     inline::record_extern_fqn(cx, did, kind);
-    match kind {
-        TypeTrait => {
-            let t = inline::build_external_trait(cx, tcx, did);
-            cx.external_traits.borrow_mut().as_mut().unwrap().insert(did, t);
-        }
-        _ => {}
+    if let TypeTrait = kind {
+        let t = inline::build_external_trait(cx, tcx, did);
+        cx.external_traits.borrow_mut().as_mut().unwrap().insert(did, t);
     }
     return did;
 }
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 3fbb2a8749f..2522de92584 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -805,96 +805,87 @@ impl DocFolder for Cache {
 
         // Propagate a trait methods' documentation to all implementors of the
         // trait
-        match item.inner {
-            clean::TraitItem(ref t) => {
-                self.traits.insert(item.def_id, t.clone());
-            }
-            _ => {}
+        if let clean::TraitItem(ref t) = item.inner {
+            self.traits.insert(item.def_id, t.clone());
         }
 
         // Collect all the implementors of traits.
-        match item.inner {
-            clean::ImplItem(ref i) => {
-                match i.trait_ {
-                    Some(clean::ResolvedPath{ did, .. }) => {
-                        let v = match self.implementors.entry(did) {
-                            Vacant(entry) => entry.set(Vec::with_capacity(1)),
-                            Occupied(entry) => entry.into_mut(),
-                        };
-                        v.push(Implementor {
-                            def_id: item.def_id,
-                            generics: i.generics.clone(),
-                            trait_: i.trait_.as_ref().unwrap().clone(),
-                            for_: i.for_.clone(),
-                            stability: item.stability.clone(),
-                        });
-                    }
-                    Some(..) | None => {}
+        if let clean::ImplItem(ref i) = item.inner {
+            match i.trait_ {
+                Some(clean::ResolvedPath{ did, .. }) => {
+                    let v = match self.implementors.entry(did) {
+                        Vacant(entry) => entry.set(Vec::with_capacity(1)),
+                        Occupied(entry) => entry.into_mut(),
+                    };
+                    v.push(Implementor {
+                        def_id: item.def_id,
+                        generics: i.generics.clone(),
+                        trait_: i.trait_.as_ref().unwrap().clone(),
+                        for_: i.for_.clone(),
+                        stability: item.stability.clone(),
+                    });
                 }
+                Some(..) | None => {}
             }
-            _ => {}
         }
 
         // Index this method for searching later on
-        match item.name {
-            Some(ref s) => {
-                let (parent, is_method) = match item.inner {
-                    clean::TyMethodItem(..) |
-                    clean::StructFieldItem(..) |
-                    clean::VariantItem(..) => {
-                        ((Some(*self.parent_stack.last().unwrap()),
-                          Some(self.stack[..self.stack.len() - 1])),
-                          false)
-                    }
-                    clean::MethodItem(..) => {
-                        if self.parent_stack.len() == 0 {
-                            ((None, None), false)
-                        } else {
-                            let last = self.parent_stack.last().unwrap();
-                            let did = *last;
-                            let path = match self.paths.get(&did) {
-                                Some(&(_, item_type::Trait)) =>
-                                    Some(self.stack[..self.stack.len() - 1]),
-                                // The current stack not necessarily has correlation for
-                                // where the type was defined. On the other hand,
-                                // `paths` always has the right information if present.
-                                Some(&(ref fqp, item_type::Struct)) |
-                                Some(&(ref fqp, item_type::Enum)) =>
-                                    Some(fqp[..fqp.len() - 1]),
-                                Some(..) => Some(self.stack.as_slice()),
-                                None => None
-                            };
-                            ((Some(*last), path), true)
-                        }
+        if let Some(ref s) = item.name {
+            let (parent, is_method) = match item.inner {
+                clean::TyMethodItem(..) |
+                clean::StructFieldItem(..) |
+                clean::VariantItem(..) => {
+                    ((Some(*self.parent_stack.last().unwrap()),
+                      Some(self.stack[..self.stack.len() - 1])),
+                     false)
+                }
+                clean::MethodItem(..) => {
+                    if self.parent_stack.len() == 0 {
+                        ((None, None), false)
+                    } else {
+                        let last = self.parent_stack.last().unwrap();
+                        let did = *last;
+                        let path = match self.paths.get(&did) {
+                            Some(&(_, item_type::Trait)) =>
+                                Some(self.stack[..self.stack.len() - 1]),
+                            // The current stack not necessarily has correlation for
+                            // where the type was defined. On the other hand,
+                            // `paths` always has the right information if present.
+                            Some(&(ref fqp, item_type::Struct)) |
+                            Some(&(ref fqp, item_type::Enum)) =>
+                                Some(fqp[..fqp.len() - 1]),
+                            Some(..) => Some(self.stack.as_slice()),
+                            None => None
+                        };
+                        ((Some(*last), path), true)
                     }
-                    _ => ((None, Some(self.stack.as_slice())), false)
-                };
-                let hidden_field = match item.inner {
-                    clean::StructFieldItem(clean::HiddenStructField) => true,
-                    _ => false
-                };
+                }
+                _ => ((None, Some(self.stack.as_slice())), false)
+            };
+            let hidden_field = match item.inner {
+                clean::StructFieldItem(clean::HiddenStructField) => true,
+                _ => false
+            };
 
-                match parent {
-                    (parent, Some(path)) if is_method || (!self.privmod && !hidden_field) => {
-                        self.search_index.push(IndexItem {
-                            ty: shortty(&item),
-                            name: s.to_string(),
-                            path: path.connect("::").to_string(),
-                            desc: shorter(item.doc_value()).to_string(),
-                            parent: parent,
-                        });
-                    }
-                    (Some(parent), None) if is_method || (!self.privmod && !hidden_field)=> {
-                        if ast_util::is_local(parent) {
-                            // We have a parent, but we don't know where they're
-                            // defined yet. Wait for later to index this item.
-                            self.orphan_methods.push((parent.node, item.clone()))
-                        }
+            match parent {
+                (parent, Some(path)) if is_method || (!self.privmod && !hidden_field) => {
+                    self.search_index.push(IndexItem {
+                        ty: shortty(&item),
+                        name: s.to_string(),
+                        path: path.connect("::").to_string(),
+                        desc: shorter(item.doc_value()).to_string(),
+                        parent: parent,
+                    });
+                }
+                (Some(parent), None) if is_method || (!self.privmod && !hidden_field)=> {
+                    if ast_util::is_local(parent) {
+                        // We have a parent, but we don't know where they're
+                        // defined yet. Wait for later to index this item.
+                        self.orphan_methods.push((parent.node, item.clone()))
                     }
-                    _ => {}
                 }
+                _ => {}
             }
-            None => {}
         }
 
         // Keep track of the fully qualified path for this item.
@@ -1013,20 +1004,18 @@ impl DocFolder for Cache {
                             _ => None,
                         };
 
-                        match did {
-                            Some(did) => {
-                                let v = match self.impls.entry(did) {
-                                    Vacant(entry) => entry.set(Vec::with_capacity(1)),
-                                    Occupied(entry) => entry.into_mut(),
-                                };
-                                v.push(Impl {
-                                    impl_: i,
-                                    dox: dox,
-                                    stability: item.stability.clone(),
-                                });
-                            }
-                            None => {}
+                        if let Some(did) = did {
+                            let v = match self.impls.entry(did) {
+                                Vacant(entry) => entry.set(Vec::with_capacity(1)),
+                                Occupied(entry) => entry.into_mut(),
+                            };
+                            v.push(Impl {
+                                impl_: i,
+                                dox: dox,
+                                stability: item.stability.clone(),
+                            });
                         }
+
                         None
                     }
 
@@ -1865,22 +1854,19 @@ fn item_struct(w: &mut fmt::Formatter, it: &clean::Item,
             _ => false,
         }
     }).peekable();
-    match s.struct_type {
-        doctree::Plain => {
-            if fields.peek().is_some() {
-                try!(write!(w, "<h2 class='fields'>Fields</h2>\n<table>"));
-                for field in fields {
-                    try!(write!(w, "<tr><td id='structfield.{name}'>\
-                                      {stab}<code>{name}</code></td><td>",
-                                  stab = ConciseStability(&field.stability),
-                                  name = field.name.as_ref().unwrap().as_slice()));
-                    try!(document(w, field));
-                    try!(write!(w, "</td></tr>"));
-                }
-                try!(write!(w, "</table>"));
+    if let doctree::Plain = s.struct_type {
+        if fields.peek().is_some() {
+            try!(write!(w, "<h2 class='fields'>Fields</h2>\n<table>"));
+            for field in fields {
+                try!(write!(w, "<tr><td id='structfield.{name}'>\
+                                  {stab}<code>{name}</code></td><td>",
+                            stab = ConciseStability(&field.stability),
+                            name = field.name.as_ref().unwrap().as_slice()));
+                try!(document(w, field));
+                try!(write!(w, "</td></tr>"));
             }
+            try!(write!(w, "</table>"));
         }
-        _ => {}
     }
     render_methods(w, it)
 }
diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs
index eefdeb94984..8675d2b3749 100644
--- a/src/librustdoc/passes.rs
+++ b/src/librustdoc/passes.rs
@@ -65,26 +65,20 @@ pub fn strip_hidden(krate: clean::Crate) -> plugins::PluginResult {
         };
         impl<'a> fold::DocFolder for ImplStripper<'a> {
             fn fold_item(&mut self, i: Item) -> Option<Item> {
-                match i.inner {
-                    clean::ImplItem(clean::Impl{
-                        for_: clean::ResolvedPath{ did, .. },
-                        ref trait_, ..
-                    }) => {
-                        // Impls for stripped types don't need to exist
+                if let clean::ImplItem(clean::Impl{
+                           for_: clean::ResolvedPath{ did, .. },
+                           ref trait_, ..
+                }) = i.inner {
+                    // Impls for stripped types don't need to exist
+                    if self.stripped.contains(&did.node) {
+                        return None;
+                    }
+                    // Impls of stripped traits also don't need to exist
+                    if let Some(clean::ResolvedPath { did, .. }) = *trait_ {
                         if self.stripped.contains(&did.node) {
                             return None;
                         }
-                        // Impls of stripped traits also don't need to exist
-                        match *trait_ {
-                            Some(clean::ResolvedPath { did, .. }) => {
-                                if self.stripped.contains(&did.node) {
-                                    return None
-                                }
-                            }
-                            _ => {}
-                        }
                     }
-                    _ => {}
                 }
                 self.fold_item_recur(i)
             }
@@ -239,19 +233,16 @@ impl<'a> fold::DocFolder for Stripper<'a> {
 struct ImplStripper<'a>(&'a HashSet<ast::NodeId>);
 impl<'a> fold::DocFolder for ImplStripper<'a> {
     fn fold_item(&mut self, i: Item) -> Option<Item> {
-        match i.inner {
-            clean::ImplItem(ref imp) => {
-                match imp.trait_ {
-                    Some(clean::ResolvedPath{ did, .. }) => {
-                        let ImplStripper(s) = *self;
-                        if ast_util::is_local(did) && !s.contains(&did.node) {
-                            return None;
-                        }
+        if let clean::ImplItem(ref imp) = i.inner {
+            match imp.trait_ {
+                Some(clean::ResolvedPath{ did, .. }) => {
+                    let ImplStripper(s) = *self;
+                    if ast_util::is_local(did) && !s.contains(&did.node) {
+                        return None;
                     }
-                    Some(..) | None => {}
                 }
+                Some(..) | None => {}
             }
-            _ => {}
         }
         self.fold_item_recur(i)
     }
diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs
index 6b97b931ef7..2913666a315 100644
--- a/src/libsyntax/ast_map/mod.rs
+++ b/src/libsyntax/ast_map/mod.rs
@@ -776,11 +776,8 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
             }
             ItemTrait(_, _, ref bounds, ref trait_items) => {
                 for b in bounds.iter() {
-                    match *b {
-                        TraitTyParamBound(ref t) => {
-                            self.insert(t.trait_ref.ref_id, NodeItem(i));
-                        }
-                        _ => {}
+                    if let TraitTyParamBound(ref t) = *b {
+                        self.insert(t.trait_ref.ref_id, NodeItem(i));
                     }
                 }
 
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index aa693976fe4..68bb7ecfb85 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -412,13 +412,10 @@ impl<'a, 'v, O: IdVisitingOperation> Visitor<'v> for IdVisitor<'a, O> {
         }
 
         self.operation.visit_id(item.id);
-        match item.node {
-            ItemEnum(ref enum_definition, _) => {
-                for variant in enum_definition.variants.iter() {
-                    self.operation.visit_id(variant.node.id)
-                }
+        if let ItemEnum(ref enum_definition, _) = item.node {
+            for variant in enum_definition.variants.iter() {
+                self.operation.visit_id(variant.node.id)
             }
-            _ => {}
         }
 
         visit::walk_item(self, item);
@@ -453,9 +450,8 @@ impl<'a, 'v, O: IdVisitingOperation> Visitor<'v> for IdVisitor<'a, O> {
 
     fn visit_ty(&mut self, typ: &Ty) {
         self.operation.visit_id(typ.id);
-        match typ.node {
-            TyPath(_, id) => self.operation.visit_id(id),
-            _ => {}
+        if let TyPath(_, id) = typ.node {
+            self.operation.visit_id(id);
         }
         visit::walk_ty(self, typ)
     }
@@ -500,9 +496,8 @@ impl<'a, 'v, O: IdVisitingOperation> Visitor<'v> for IdVisitor<'a, O> {
                        span);
 
         if !self.pass_through_items {
-            match function_kind {
-                visit::FkMethod(..) => self.visited_outermost = false,
-                _ => {}
+            if let visit::FkMethod(..) = function_kind {
+                self.visited_outermost = false;
             }
         }
     }
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 9635f0175f0..7453da6374e 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -151,13 +151,10 @@ impl<'a, 'v> Visitor<'v> for Context<'a> {
     fn visit_view_item(&mut self, i: &ast::ViewItem) {
         match i.node {
             ast::ViewItemUse(ref path) => {
-                match path.node {
-                    ast::ViewPathGlob(..) => {
-                        self.gate_feature("globs", path.span,
-                                          "glob import statements are \
-                                           experimental and possibly buggy");
-                    }
-                    _ => {}
+                if let ast::ViewPathGlob(..) = path.node {
+                    self.gate_feature("globs", path.span,
+                                      "glob import statements are \
+                                       experimental and possibly buggy");
                 }
             }
             ast::ViewItemExternCrate(..) => {
@@ -295,13 +292,10 @@ impl<'a, 'v> Visitor<'v> for Context<'a> {
     }
 
     fn visit_ty(&mut self, t: &ast::Ty) {
-        match t.node {
-            ast::TyClosure(ref closure) => {
-                // this used to be blocked by a feature gate, but it should just
-                // be plain impossible right now
-                assert!(closure.onceness != ast::Once);
-            },
-            _ => {}
+        if let ast::TyClosure(ref closure) =  t.node {
+            // this used to be blocked by a feature gate, but it should just
+            // be plain impossible right now
+            assert!(closure.onceness != ast::Once);
         }
 
         visit::walk_ty(self, t);
@@ -465,4 +459,3 @@ pub fn check_crate(span_handler: &SpanHandler, krate: &ast::Crate) -> (Features,
     },
     unknown_features)
 }
-
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 447f2a376e1..01dc3564a84 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -178,11 +178,8 @@ macro_rules! maybe_whole (
                 }
                 _ => None
             };
-            match found {
-                Some(token::Interpolated(token::$constructor(x))) => {
-                    return x.clone()
-                }
-                _ => {}
+            if let Some(token::Interpolated(token::$constructor(x))) = found {
+                return x.clone();
             }
         }
     );
@@ -194,11 +191,8 @@ macro_rules! maybe_whole (
                 }
                 _ => None
             };
-            match found {
-                Some(token::Interpolated(token::$constructor(x))) => {
-                    return x
-                }
-                _ => {}
+            if let Some(token::Interpolated(token::$constructor(x))) = found {
+                return x;
             }
         }
     );
@@ -210,11 +204,8 @@ macro_rules! maybe_whole (
                 }
                 _ => None
             };
-            match found {
-                Some(token::Interpolated(token::$constructor(x))) => {
-                    return (*x).clone()
-                }
-                _ => {}
+            if let Some(token::Interpolated(token::$constructor(x))) = found {
+                return (*x).clone();
             }
         }
     );
@@ -226,11 +217,8 @@ macro_rules! maybe_whole (
                 }
                 _ => None
             };
-            match found {
-                Some(token::Interpolated(token::$constructor(x))) => {
-                    return Some(x.clone()),
-                }
-                _ => {}
+            if let Some(token::Interpolated(token::$constructor(x))) = found {
+                return Some(x.clone());
             }
         }
     );
@@ -242,11 +230,8 @@ macro_rules! maybe_whole (
                 }
                 _ => None
             };
-            match found {
-                Some(token::Interpolated(token::$constructor(x))) => {
-                    return IoviItem(x.clone())
-                }
-                _ => {}
+            if let Some(token::Interpolated(token::$constructor(x))) = found {
+                return IoviItem(x.clone());
             }
         }
     );
@@ -258,11 +243,8 @@ macro_rules! maybe_whole (
                 }
                 _ => None
             };
-            match found {
-                Some(token::Interpolated(token::$constructor(x))) => {
-                    return (Vec::new(), x)
-                }
-                _ => {}
+            if let Some(token::Interpolated(token::$constructor(x))) = found {
+                return (Vec::new(), x);
             }
         }
     )
@@ -469,15 +451,11 @@ impl<'a> Parser<'a> {
     /// from anticipated input errors, discarding erroneous characters.
     pub fn commit_expr(&mut self, e: &Expr, edible: &[token::Token], inedible: &[token::Token]) {
         debug!("commit_expr {}", e);
-        match e.node {
-            ExprPath(..) => {
-                // might be unit-struct construction; check for recoverableinput error.
-                let mut expected = edible.iter().map(|x| x.clone()).collect::<Vec<_>>();
-                expected.push_all(inedible);
-                self.check_for_erroneous_unit_struct_expecting(
-                    expected.as_slice());
-            }
-            _ => {}
+        if let ExprPath(..) = e.node {
+            // might be unit-struct construction; check for recoverableinput error.
+            let mut expected = edible.iter().map(|x| x.clone()).collect::<Vec<_>>();
+            expected.push_all(inedible);
+            self.check_for_erroneous_unit_struct_expecting(expected.as_slice());
         }
         self.expect_one_of(edible, inedible)
     }
@@ -1764,11 +1742,8 @@ impl<'a> Parser<'a> {
             token::Interpolated(token::NtPath(_)) => Some(self.bump_and_get()),
             _ => None,
         };
-        match found {
-            Some(token::Interpolated(token::NtPath(box path))) => {
-                return path;
-            }
-            _ => {}
+        if let Some(token::Interpolated(token::NtPath(box path))) = found {
+            return path;
         }
 
         let lo = self.span.lo;
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index c12c3098279..93376c5ef0d 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -969,14 +969,11 @@ impl<'a> State<'a> {
                                                     "trait").as_slice()));
                 try!(self.print_ident(item.ident));
                 try!(self.print_generics(generics));
-                match unbound {
-                    &Some(ref tref) => {
-                        try!(space(&mut self.s));
-                        try!(self.word_space("for"));
-                        try!(self.print_trait_ref(tref));
-                        try!(word(&mut self.s, "?"));
-                    }
-                    _ => {}
+                if let &Some(ref tref) = unbound {
+                    try!(space(&mut self.s));
+                    try!(self.word_space("for"));
+                    try!(self.print_trait_ref(tref));
+                    try!(word(&mut self.s, "?"));
                 }
                 try!(self.print_bounds(":", bounds.as_slice()));
                 try!(self.print_where_clause(generics));
@@ -1761,16 +1758,14 @@ impl<'a> State<'a> {
                         try!(space(&mut self.s));
                     }
                 }
-                match start {
-                    &Some(ref e) => try!(self.print_expr(&**e)),
-                    _ => {}
+                if let &Some(ref e) = start {
+                    try!(self.print_expr(&**e));
                 }
                 if start.is_some() || end.is_some() {
                     try!(word(&mut self.s, ".."));
                 }
-                match end {
-                    &Some(ref e) => try!(self.print_expr(&**e)),
-                    _ => {}
+                if let &Some(ref e) = end {
+                    try!(self.print_expr(&**e));
                 }
                 try!(word(&mut self.s, "]"));
             }
@@ -1875,13 +1870,10 @@ impl<'a> State<'a> {
                 try!(self.ibox(indent_unit));
                 try!(self.print_local_decl(&**loc));
                 try!(self.end());
-                match loc.init {
-                    Some(ref init) => {
-                        try!(self.nbsp());
-                        try!(self.word_space("="));
-                        try!(self.print_expr(&**init));
-                    }
-                    _ => {}
+                if let Some(ref init) = loc.init {
+                    try!(self.nbsp());
+                    try!(self.word_space("="));
+                    try!(self.print_expr(&**init));
                 }
                 self.end()
             }
@@ -2404,12 +2396,9 @@ impl<'a> State<'a> {
     }
 
     pub fn print_ty_param(&mut self, param: &ast::TyParam) -> IoResult<()> {
-        match param.unbound {
-            Some(ref tref) => {
-                try!(self.print_trait_ref(tref));
-                try!(self.word_space("?"));
-            }
-            _ => {}
+        if let Some(ref tref) = param.unbound {
+            try!(self.print_trait_ref(tref));
+            try!(self.word_space("?"));
         }
         try!(self.print_ident(param.ident));
         try!(self.print_bounds(":", param.bounds.as_slice()));
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 1385fb982e5..18623ca2a81 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -671,11 +671,8 @@ pub fn walk_struct_def<'v, V: Visitor<'v>>(visitor: &mut V,
 
 pub fn walk_struct_field<'v, V: Visitor<'v>>(visitor: &mut V,
                                              struct_field: &'v StructField) {
-    match struct_field.node.kind {
-        NamedField(name, _) => {
-            visitor.visit_ident(struct_field.span, name)
-        }
-        _ => {}
+    if let NamedField(name, _) = struct_field.node.kind {
+        visitor.visit_ident(struct_field.span, name);
     }
 
     visitor.visit_ty(&*struct_field.node.ty);