Skip to content

Commit

Permalink
Remove a Redundant Conditional Check
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
veera-sivarajan committed Aug 8, 2024
1 parent 006c8df commit 1350a65
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1350a65

Please sign in to comment.