mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Rollup merge of #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(); ```
This commit is contained in:
commit
48c9864a05
@ -959,11 +959,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
||||
\n where\n T: {qself_str},\n{}",
|
||||
where_bounds.join(",\n"),
|
||||
));
|
||||
}
|
||||
let reported = err.emit();
|
||||
if !where_bounds.is_empty() {
|
||||
let reported = err.emit();
|
||||
return Err(reported);
|
||||
}
|
||||
err.emit();
|
||||
}
|
||||
|
||||
Ok(bound)
|
||||
|
Loading…
Reference in New Issue
Block a user