Skip to content

Commit

Permalink
remove unnecessary if
Browse files Browse the repository at this point in the history
while it could potentially not trigger due to a `default` assoc type with specialization,
it's only a perf improvement anyways
  • Loading branch information
lcnr committed Jan 30, 2024
1 parent 2ccd78d commit f996e18
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1076,22 +1076,20 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
obligation.predicate,
&mut nested_obligations,
);
if predicate != obligation.predicate {
let mut nested_result = EvaluationResult::EvaluatedToOk;
for obligation in nested_obligations {
nested_result = cmp::max(
this.evaluate_predicate_recursively(previous_stack, obligation)?,
nested_result,
);
}
let mut nested_result = EvaluationResult::EvaluatedToOk;
for obligation in nested_obligations {
nested_result = cmp::max(
this.evaluate_predicate_recursively(previous_stack, obligation)?,
nested_result,
);
}

if nested_result.must_apply_modulo_regions() {
let obligation = obligation.with(this.tcx(), predicate);
result = cmp::max(
nested_result,
this.evaluate_trait_predicate_recursively(previous_stack, obligation)?,
);
}
if nested_result.must_apply_modulo_regions() {
let obligation = obligation.with(this.tcx(), predicate);
result = cmp::max(
nested_result,
this.evaluate_trait_predicate_recursively(previous_stack, obligation)?,
);
}
}

Expand Down

0 comments on commit f996e18

Please sign in to comment.