diff --git a/src/librustc/middle/traits/object_safety.rs b/src/librustc/middle/traits/object_safety.rs
index 203330437957e7cb8e4d19f59bfd541c9c524a9a..6b7bf82af929355c76e38504f6aa9d95ba192b1f 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(),
+ /// e.g., `fn foo()`
Generic,
}
diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs
index 6a69c878a762fde1e72f16399d26938900802efa..ca4bf7863be4fe7129965a57f8f389fe681e1d33 100644
--- a/src/librustc/middle/traits/select.rs
+++ b/src/librustc/middle/traits/select.rs
@@ -1045,15 +1045,10 @@ fn assemble_candidates_from_object_ty(&mut self,
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);
}
}