about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2015-01-02 05:34:49 -0500
committerNiko Matsakis <niko@alum.mit.edu>2015-01-02 12:09:38 -0500
commit704ed4c7d00d256b783086a682fbcfd7a4ac5c5a (patch)
tree993f4409fc3248ae18719479a0477d943d8e7dc0
parenta535f2aab1eacc757c8c28e87896be12eac56bd1 (diff)
downloadrust-704ed4c7d00d256b783086a682fbcfd7a4ac5c5a.tar.gz
rust-704ed4c7d00d256b783086a682fbcfd7a4ac5c5a.zip
Address nits.
-rw-r--r--src/librustc/middle/traits/object_safety.rs9
-rw-r--r--src/librustc/middle/traits/select.rs13
2 files changed, 8 insertions, 14 deletions
diff --git a/src/librustc/middle/traits/object_safety.rs b/src/librustc/middle/traits/object_safety.rs
index 20333043795..6b7bf82af92 100644
--- a/src/librustc/middle/traits/object_safety.rs
+++ b/src/librustc/middle/traits/object_safety.rs
@@ -38,17 +38,16 @@ pub enum ObjectSafetyViolation<'tcx> {
 /// Reasons a method might not be object-safe.
 #[deriving(Copy,Clone,Show)]
 pub enum MethodViolationCode {
-    /// fn(self),
+    /// e.g., `fn(self)`
     ByValueSelf,
 
-    // fn foo()
+    /// e.g., `fn foo()`
     StaticMethod,
 
-    // fn foo(&self, x: Self)
-    // fn foo(&self) -> Self
+    /// e.g., `fn foo(&self, x: Self)` or `fn foo(&self) -> Self`
     ReferencesSelf,
 
-    // fn foo<A>(),
+    /// e.g., `fn foo<A>()`
     Generic,
 }
 
diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs
index 6a69c878a76..ca4bf7863be 100644
--- a/src/librustc/middle/traits/select.rs
+++ b/src/librustc/middle/traits/select.rs
@@ -1045,15 +1045,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                upcast_trait_ref.repr(self.tcx()));
 
         // check whether the upcast version of the trait-ref matches what we are looking for
-        match
-            self.infcx.probe(
-                |_| self.match_poly_trait_ref(obligation, upcast_trait_ref.clone()))
-        {
-            Ok(()) => {
-                debug!("assemble_candidates_from_object_ty: matched, pushing candidate");
-                candidates.vec.push(ObjectCandidate);
-            }
-            Err(()) => { }
+        if let Ok(()) = self.infcx.probe(|_| self.match_poly_trait_ref(obligation,
+                                                                       upcast_trait_ref.clone())) {
+            debug!("assemble_candidates_from_object_ty: matched, pushing candidate");
+            candidates.vec.push(ObjectCandidate);
         }
     }