about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2015-02-28 13:32:18 +0100
committerMs2ger <ms2ger@gmail.com>2015-02-28 13:32:18 +0100
commit8a7b6b3ee6a85aa60a1733727a4028a690744fdf (patch)
tree990606afbd7cccd21adf65d46c35411cf01a494c
parentf38b83b3609b060df5ab3d2a57e98020b8b29efb (diff)
downloadrust-8a7b6b3ee6a85aa60a1733727a4028a690744fdf.tar.gz
rust-8a7b6b3ee6a85aa60a1733727a4028a690744fdf.zip
Collapse nested matches in method_context.
-rw-r--r--src/librustc_lint/builtin.rs38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs
index 6252c372009..13c99e9dff7 100644
--- a/src/librustc_lint/builtin.rs
+++ b/src/librustc_lint/builtin.rs
@@ -887,32 +887,28 @@ fn method_context(cx: &Context, m: &ast::Method) -> MethodContext {
 
     match cx.tcx.impl_or_trait_items.borrow().get(&did).cloned() {
         None => cx.sess().span_bug(m.span, "missing method descriptor?!"),
-        Some(md) => {
-            match md {
-                ty::MethodTraitItem(md) => {
-                    match md.container {
-                        ty::TraitContainer(..) => MethodContext::TraitDefaultImpl,
-                        ty::ImplContainer(cid) => {
-                            match ty::impl_trait_ref(cx.tcx, cid) {
-                                Some(..) => MethodContext::TraitImpl,
-                                None => MethodContext::PlainImpl
-                            }
-                        }
+        Some(ty::MethodTraitItem(md)) => {
+            match md.container {
+                ty::TraitContainer(..) => MethodContext::TraitDefaultImpl,
+                ty::ImplContainer(cid) => {
+                    match ty::impl_trait_ref(cx.tcx, cid) {
+                        Some(..) => MethodContext::TraitImpl,
+                        None => MethodContext::PlainImpl
                     }
                 }
-                ty::TypeTraitItem(typedef) => {
-                    match typedef.container {
-                        ty::TraitContainer(..) => MethodContext::TraitDefaultImpl,
-                        ty::ImplContainer(cid) => {
-                            match ty::impl_trait_ref(cx.tcx, cid) {
-                                Some(..) => MethodContext::TraitImpl,
-                                None => MethodContext::PlainImpl
-                            }
-                        }
+            }
+        },
+        Some(ty::TypeTraitItem(typedef)) => {
+            match typedef.container {
+                ty::TraitContainer(..) => MethodContext::TraitDefaultImpl,
+                ty::ImplContainer(cid) => {
+                    match ty::impl_trait_ref(cx.tcx, cid) {
+                        Some(..) => MethodContext::TraitImpl,
+                        None => MethodContext::PlainImpl
                     }
                 }
             }
-        }
+        },
     }
 }