]> git.lizzy.rs Git - rust.git/commitdiff
make match exaustive
authorDouglas Campos <qmx@qmx.me>
Sat, 30 Sep 2017 02:21:35 +0000 (22:21 -0400)
committerDouglas Campos <qmx@qmx.me>
Sat, 30 Sep 2017 02:34:51 +0000 (22:34 -0400)
src/librustc/ty/instance.rs

index 9560d6359a53203b138c331f182f07f90172564a..35ab1cec4cf9ebe459406021de9df6007d1c8e92 100644 (file)
@@ -247,15 +247,17 @@ fn resolve_associated_item<'a, 'tcx>(
                 substs: rcvr_substs
             })
         }
-        traits::VtableBuiltin(..) if Some(trait_id) == tcx.lang_items().clone_trait() => {
-            Some(Instance {
-                def: ty::InstanceDef::CloneShim(def_id, trait_ref.self_ty()),
-                substs: rcvr_substs
-            })
-        }
-        _ => {
-            None
+        traits::VtableBuiltin(..) => {
+            if let Some(_) = tcx.lang_items().clone_trait() {
+                Some(Instance {
+                    def: ty::InstanceDef::CloneShim(def_id, trait_ref.self_ty()),
+                    substs: rcvr_substs
+                })
+            } else {
+                None
+            }
         }
+        traits::VtableDefaultImpl(..) | traits::VtableParam(..) => None
     }
 }
 
@@ -287,8 +289,9 @@ fn needs_fn_once_adapter_shim<'a, 'tcx>(actual_closure_kind: ty::ClosureKind,
                 //
                 // These are both the same at trans time.
                 Ok(true)
-            }
-        _ => Err(()),
+        }
+        (ty::ClosureKind::FnMut, _) |
+        (ty::ClosureKind::FnOnce, _) => Err(())
     }
 }