Skip to content

Commit 1350a65

Browse files
Remove a Redundant Conditional Check
The existing code check for `where_bounds.is_empty()` twice when it can be combined into one. Moreover, the refactored code reads better and feels straightforward.
1 parent 006c8df commit 1350a65

File tree

1 file changed

+2
-3
lines changed
  • compiler/rustc_hir_analysis/src/hir_ty_lowering

1 file changed

+2
-3
lines changed

Diff for: compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -959,11 +959,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
959959
\n where\n T: {qself_str},\n{}",
960960
where_bounds.join(",\n"),
961961
));
962-
}
963-
let reported = err.emit();
964-
if !where_bounds.is_empty() {
962+
let reported = err.emit();
965963
return Err(reported);
966964
}
965+
err.emit();
967966
}
968967

969968
Ok(bound)

0 commit comments

Comments
 (0)