From 1350a65736d66ff771010442258c1cbf499b1842 Mon Sep 17 00:00:00 2001 From: Veera Date: Thu, 8 Aug 2024 15:21:15 -0400 Subject: [PATCH] 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. --- compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs index d865357b82900..2fb1bcf2dbfff 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs @@ -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)