Skip to content

Commit 704ed4c

Browse files
committed
Address nits.
1 parent a535f2a commit 704ed4c

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

src/librustc/middle/traits/object_safety.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,16 @@ pub enum ObjectSafetyViolation<'tcx> {
3838
/// Reasons a method might not be object-safe.
3939
#[deriving(Copy,Clone,Show)]
4040
pub enum MethodViolationCode {
41-
/// fn(self),
41+
/// e.g., `fn(self)`
4242
ByValueSelf,
4343

44-
// fn foo()
44+
/// e.g., `fn foo()`
4545
StaticMethod,
4646

47-
// fn foo(&self, x: Self)
48-
// fn foo(&self) -> Self
47+
/// e.g., `fn foo(&self, x: Self)` or `fn foo(&self) -> Self`
4948
ReferencesSelf,
5049

51-
// fn foo<A>(),
50+
/// e.g., `fn foo<A>()`
5251
Generic,
5352
}
5453

src/librustc/middle/traits/select.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,15 +1045,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
10451045
upcast_trait_ref.repr(self.tcx()));
10461046

10471047
// check whether the upcast version of the trait-ref matches what we are looking for
1048-
match
1049-
self.infcx.probe(
1050-
|_| self.match_poly_trait_ref(obligation, upcast_trait_ref.clone()))
1051-
{
1052-
Ok(()) => {
1053-
debug!("assemble_candidates_from_object_ty: matched, pushing candidate");
1054-
candidates.vec.push(ObjectCandidate);
1055-
}
1056-
Err(()) => { }
1048+
if let Ok(()) = self.infcx.probe(|_| self.match_poly_trait_ref(obligation,
1049+
upcast_trait_ref.clone())) {
1050+
debug!("assemble_candidates_from_object_ty: matched, pushing candidate");
1051+
candidates.vec.push(ObjectCandidate);
10571052
}
10581053
}
10591054

0 commit comments

Comments
 (0)