]> git.lizzy.rs Git - rust.git/commitdiff
remove dead code
authorMatthias Krüger <matthias.krueger@famsik.de>
Thu, 16 Jan 2020 07:27:41 +0000 (08:27 +0100)
committerMatthias Krüger <matthias.krueger@famsik.de>
Thu, 16 Jan 2020 07:27:41 +0000 (08:27 +0100)
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

src/librustc/traits/select.rs

index e96697cc7e09d4360581ea9fb4f24b2b5b9a719e..fb1c46834d3a04af79321b0e4b029df0bfe4e274 100644 (file)
@@ -3767,16 +3767,12 @@ pub fn derived_cause(
         // 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)
     }
 }