diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-01-16 20:53:32 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-16 20:53:32 +0530 |
| commit | a529e70be1db5601b224eea741ccbab74f22b0c4 (patch) | |
| tree | 2319799a5a8a565bdf5f56cc148bbcee85a50f12 | |
| parent | 6e797ff8d942d3823725b2326b906425433f2624 (diff) | |
| parent | c4d91aae5a72733479bab8df1aee78bb049b9735 (diff) | |
| download | rust-a529e70be1db5601b224eea741ccbab74f22b0c4.tar.gz rust-a529e70be1db5601b224eea741ccbab74f22b0c4.zip | |
Rollup merge of #68274 - matthiaskrgr:dead_code, r=Dylan-DPC
remove dead code 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
| -rw-r--r-- | src/librustc/traits/select.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index e96697cc7e0..fb1c46834d3 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -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) } } |
