From 4cb145d542d7c7e175074ff783c879a5469b49c0 Mon Sep 17 00:00:00 2001 From: Devel Date: Thu, 1 Oct 2026 21:09:49 +0300 Subject: [PATCH] uucore: fix clippy warnings fix lint warnings --- src/uu/ls/src/colors.rs | 2 +- src/uucore/src/lib/features/encoding.rs | 4 ++-- src/uucore/src/lib/features/i18n/charmap.rs | 2 +- src/uucore/src/lib/mods/locale.rs | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/uu/ls/src/colors.rs b/src/uu/ls/src/colors.rs index cd0b7cccd24..11f4b8675c9 100644 --- a/src/uu/ls/src/colors.rs +++ b/src/uu/ls/src/colors.rs @@ -148,7 +148,7 @@ impl<'a> StyleManager<'a> { style_code: &mut String, ) { if let Some(raw) = self.indicator_codes.get(&indicator).cloned() { - debug_assert!(!raw.is_empty()); + debug_assert_ne!(raw, ""); style_code.push_str(self.reset(!self.initial_reset_is_done)); style_code.push_str(ANSI_CSI); style_code.push_str(&raw); diff --git a/src/uucore/src/lib/features/encoding.rs b/src/uucore/src/lib/features/encoding.rs index 4a6e3394835..f441e2e6def 100644 --- a/src/uucore/src/lib/features/encoding.rs +++ b/src/uucore/src/lib/features/encoding.rs @@ -44,7 +44,7 @@ impl Base64SimdWrapper { ) -> Self { assert!(valid_decoding_multiple > 0); assert!(unpadded_multiple > 0); - assert!(!alphabet.is_empty()); + assert_ne!(alphabet, []); Self { alphabet, @@ -195,7 +195,7 @@ impl EncodingWrapper { assert!(unpadded_multiple > 0); - assert!(!alphabet.is_empty()); + assert_ne!(alphabet, []); Self { alphabet, diff --git a/src/uucore/src/lib/features/i18n/charmap.rs b/src/uucore/src/lib/features/i18n/charmap.rs index e20d2d4c67e..44a23fa31a4 100644 --- a/src/uucore/src/lib/features/i18n/charmap.rs +++ b/src/uucore/src/lib/features/i18n/charmap.rs @@ -69,7 +69,7 @@ impl Encoding { /// `bytes.len()`, and never `0` for a non-empty slice. #[inline] pub fn char_len(self, bytes: &[u8]) -> usize { - debug_assert!(!bytes.is_empty()); + debug_assert_ne!(bytes, []); let b0 = bytes[0]; if b0 <= 0x7F { return 1; diff --git a/src/uucore/src/lib/mods/locale.rs b/src/uucore/src/lib/mods/locale.rs index 3c09978ab82..7ab6dc468a3 100644 --- a/src/uucore/src/lib/mods/locale.rs +++ b/src/uucore/src/lib/mods/locale.rs @@ -1748,7 +1748,7 @@ invalid-syntax = This is { $missing // Test that we can get messages (should use embedded English for "test" utility) let message = get_message("test-about"); // Since we're using embedded resources, we should get the expected message - assert!(!message.is_empty()); + assert_ne!(message, ""); // Restore original LANG value if let Some(val) = original_lang { @@ -1779,7 +1779,7 @@ invalid-syntax = This is { $missing // Should fall back to English embedded resources let message = get_message("test-about"); - assert!(!message.is_empty()); // Should get something, not just the key + assert_ne!(message, ""); // Should get something, not just the key // Restore original LANG value if let Some(val) = original_lang { @@ -1858,18 +1858,18 @@ invalid-syntax = This is { $missing // Test that common strings are available after initialization let error_after_init = get_message("common-error"); // Should either be translated or return the key (but not panic) - assert!(!error_after_init.is_empty()); + assert_ne!(error_after_init, ""); let tip_after_init = get_message("common-tip"); - assert!(!tip_after_init.is_empty()); + assert_ne!(tip_after_init, ""); // Test that clap error keys work with fallbacks let unknown_arg_key = get_message("clap-error-unexpected-argument"); - assert!(!unknown_arg_key.is_empty()); + assert_ne!(unknown_arg_key, ""); // Test usage key fallback let usage_key = get_message("common-usage"); - assert!(!usage_key.is_empty()); + assert_ne!(usage_key, ""); }) .join() .unwrap();