From 28f58057b67525928b59185f75004c2ee2e2f37e Mon Sep 17 00:00:00 2001 From: Devyn Cairns Date: Thu, 22 Feb 2024 14:17:06 -0800 Subject: [PATCH] Replace debug_assert! with assert! in Signature::check_names (#11937) # Description Debug assertions don't run at release, which means that `cargo test --release` fails because the tests for name checks don't run properly. These checks are not really expensive, and there shouldn't be any noticeable difference to startup time, so there isn't much reason not to just leave them in. It's valuable to be able to run `cargo test --release`, as that can expose race conditions and dependencies on undefined behavior that aren't exposed in debug builds. # User-Facing Changes This shouldn't affect anything. Any violations of this rule were being caught with debug tests, which are run by the CI. # Tests + Formatting - :green_circle: `toolkit fmt` - :green_circle: `toolkit clippy` - :green_circle: `toolkit test` - :green_circle: `toolkit test stdlib` # After Submitting --- crates/nu-protocol/src/signature.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/nu-protocol/src/signature.rs b/crates/nu-protocol/src/signature.rs index 7e5b64b78f..f5acadc7da 100644 --- a/crates/nu-protocol/src/signature.rs +++ b/crates/nu-protocol/src/signature.rs @@ -471,7 +471,7 @@ impl Signature { /// Panics if one of them is found fn check_names(&self, name: impl Into, short: Option) -> (String, Option) { let s = short.map(|c| { - debug_assert!( + assert!( !self.get_shorts().contains(&c), "There may be duplicate short flags for '-{}'", c @@ -481,7 +481,7 @@ impl Signature { let name = { let name: String = name.into(); - debug_assert!( + assert!( !self.get_names().contains(&name.as_str()), "There may be duplicate name flags for '--{}'", name