Skip to content

Commit f0490a5

Browse files
authored
Unrolled build for rust-lang#128843
Rollup merge of rust-lang#128843 - veera-sivarajan:small-cleanup, r=davidtwco Minor Refactor: Remove a Redundant Conditional Check The existing code checks `where_bounds.is_empty()` twice when it can be combined into one. Now, after combining, the refactored code reads better and feels straightforward. The diff doesn't make it clear. So, the current code looks like this: ``` rust if !where_bounds.is_empty() { err.help(format!( "consider introducing a new type parameter `T` and adding `where` constraints:\ \n where\n T: {qself_str},\n{}", where_bounds.join(",\n"), )); } let reported = err.emit(); if !where_bounds.is_empty() { return Err(reported); } ``` The proposed changes: ``` rust if !where_bounds.is_empty() { err.help(format!( "consider introducing a new type parameter `T` and adding `where` constraints:\ \n where\n T: {qself_str},\n{}", where_bounds.join(",\n"), )); let reported = err.emit(); return Err(reported); } err.emit(); ```
2 parents 982c6f8 + 1350a65 commit f0490a5

File tree

1 file changed

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

1 file changed

+2
-3
lines changed

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)