From a594f32cdcf1ff44d9216ea9b8fa92d0f706416a Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Tue, 2 Dec 2025 00:03:35 -0500 Subject: [PATCH] fix(lints): plural form correctly --- src/cargo/core/workspace.rs | 6 ++---- tests/testsuite/lints/blanket_hint_mostly_unused.rs | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cargo/core/workspace.rs b/src/cargo/core/workspace.rs index 8035ad742..6fd76e42e 100644 --- a/src/cargo/core/workspace.rs +++ b/src/cargo/core/workspace.rs @@ -1348,10 +1348,8 @@ impl<'gctx> Workspace<'gctx> { } if error_count > 0 { - Err(crate::util::errors::AlreadyPrintedError::new(anyhow!( - "encountered {error_count} errors(s) while running lints" - )) - .into()) + let plural = if error_count == 1 { "" } else { "s" }; + bail!("encountered {error_count} error{plural} while running lints") } else { Ok(()) } diff --git a/tests/testsuite/lints/blanket_hint_mostly_unused.rs b/tests/testsuite/lints/blanket_hint_mostly_unused.rs index 2422d3e63..70cc099c1 100644 --- a/tests/testsuite/lints/blanket_hint_mostly_unused.rs +++ b/tests/testsuite/lints/blanket_hint_mostly_unused.rs @@ -203,6 +203,7 @@ blanket_hint_mostly_unused = "deny" | 7 | [profile.dev.package.] | +++++++++++++++++++ +[ERROR] encountered 1 error while running lints "#]]) .run();