Skip to content

Commit f996e18

Browse files
committed
remove unnecessary if
while it could potentially not trigger due to a `default` assoc type with specialization, it's only a perf improvement anyways
1 parent 2ccd78d commit f996e18

File tree

1 file changed

+13
-15
lines changed
  • compiler/rustc_trait_selection/src/traits/select

1 file changed

+13
-15
lines changed

compiler/rustc_trait_selection/src/traits/select/mod.rs

+13-15
Original file line numberDiff line numberDiff line change
@@ -1076,22 +1076,20 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
10761076
obligation.predicate,
10771077
&mut nested_obligations,
10781078
);
1079-
if predicate != obligation.predicate {
1080-
let mut nested_result = EvaluationResult::EvaluatedToOk;
1081-
for obligation in nested_obligations {
1082-
nested_result = cmp::max(
1083-
this.evaluate_predicate_recursively(previous_stack, obligation)?,
1084-
nested_result,
1085-
);
1086-
}
1079+
let mut nested_result = EvaluationResult::EvaluatedToOk;
1080+
for obligation in nested_obligations {
1081+
nested_result = cmp::max(
1082+
this.evaluate_predicate_recursively(previous_stack, obligation)?,
1083+
nested_result,
1084+
);
1085+
}
10871086

1088-
if nested_result.must_apply_modulo_regions() {
1089-
let obligation = obligation.with(this.tcx(), predicate);
1090-
result = cmp::max(
1091-
nested_result,
1092-
this.evaluate_trait_predicate_recursively(previous_stack, obligation)?,
1093-
);
1094-
}
1087+
if nested_result.must_apply_modulo_regions() {
1088+
let obligation = obligation.with(this.tcx(), predicate);
1089+
result = cmp::max(
1090+
nested_result,
1091+
this.evaluate_trait_predicate_recursively(previous_stack, obligation)?,
1092+
);
10951093
}
10961094
}
10971095

0 commit comments

Comments
 (0)