Skip to content

Commit

Permalink
remove dead code
Browse files Browse the repository at this point in the history
The condition
if obligation.recursion_depth >= 0
is always true since recursion_depth is usize.

The else branch is dead code and can be removed.

Found by Clippy.

Fixes #68251
  • Loading branch information
matthiaskrgr committed Jan 16, 2020
1 parent e02c475 commit c4d91aa
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/librustc/traits/select.rs
Expand Up @@ -3767,16 +3767,12 @@ impl<'tcx> TraitObligation<'tcx> {
// NOTE(flaper87): As of now, it keeps track of the whole error
// chain. Ideally, we should have a way to configure this either
// by using -Z verbose or just a CLI argument.
if obligation.recursion_depth >= 0 {
let derived_cause = DerivedObligationCause {
parent_trait_ref: obligation.predicate.to_poly_trait_ref(),
parent_code: Rc::new(obligation.cause.code.clone()),
};
let derived_code = variant(derived_cause);
ObligationCause::new(obligation.cause.span, obligation.cause.body_id, derived_code)
} else {
obligation.cause.clone()
}
let derived_cause = DerivedObligationCause {
parent_trait_ref: obligation.predicate.to_poly_trait_ref(),
parent_code: Rc::new(obligation.cause.code.clone()),
};
let derived_code = variant(derived_cause);
ObligationCause::new(obligation.cause.span, obligation.cause.body_id, derived_code)
}
}

Expand Down

0 comments on commit c4d91aa

Please sign in to comment.