diff --git a/src/bin/coreutils.rs b/src/bin/coreutils.rs index f451780250a..a5924d48345 100644 --- a/src/bin/coreutils.rs +++ b/src/bin/coreutils.rs @@ -49,7 +49,6 @@ Currently defined functions: } } -#[allow(clippy::cognitive_complexity)] fn main() { let utils = util_map(); let mut args = uucore::args_os(); diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 2e9ae6b62ef..d7e5ef56fc1 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1012,7 +1012,6 @@ impl Attributes { } impl Options { - #[allow(clippy::cognitive_complexity)] fn from_matches(matches: &ArgMatches) -> CopyResult { let not_implemented_opts = vec![ #[cfg(not(any(windows, unix)))] diff --git a/src/uu/csplit/src/csplit.rs b/src/uu/csplit/src/csplit.rs index 3a4b43e881e..461b0b80ec2 100644 --- a/src/uu/csplit/src/csplit.rs +++ b/src/uu/csplit/src/csplit.rs @@ -406,7 +406,6 @@ impl SplitWriter<'_> { /// - if no line matched, an [`CsplitError::MatchNotFound`]. /// - if there are not enough lines to accommodate the offset, an /// [`CsplitError::LineOutOfRange`]. - #[allow(clippy::cognitive_complexity)] fn do_to_match( &mut self, pattern_as_str: &str, @@ -723,7 +722,6 @@ mod tests { use super::*; #[test] - #[allow(clippy::cognitive_complexity)] fn input_splitter() { let input = vec![ Ok(String::from("aaa")), @@ -796,7 +794,7 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] + #[expect(clippy::cognitive_complexity)] fn input_splitter_interrupt_rewind() { let input = vec![ Ok(String::from("aaa")), diff --git a/src/uu/csplit/src/patterns.rs b/src/uu/csplit/src/patterns.rs index e13d3c1f226..f86a4e88fb3 100644 --- a/src/uu/csplit/src/patterns.rs +++ b/src/uu/csplit/src/patterns.rs @@ -209,7 +209,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn up_to_match_pattern() { let input = [ "/test1.*end$/", @@ -268,7 +267,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn skip_to_match_pattern() { let input = [ "%test1.*end$%", diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index ab7cbf680c6..dd5c8876104 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -281,7 +281,7 @@ fn parse_military_timezone_with_offset(s: &str) -> Option<(i32, DayDelta)> { } #[uucore::main] -#[allow(clippy::cognitive_complexity)] +#[expect(clippy::cognitive_complexity)] pub fn uumain(args: impl uucore::Args) -> UResult<()> { let matches = uucore::clap_localization::handle_clap_result(uu_app(), args)?; diff --git a/src/uu/dd/src/dd.rs b/src/uu/dd/src/dd.rs index 8071cae64a1..5c2c0a4669a 100644 --- a/src/uu/dd/src/dd.rs +++ b/src/uu/dd/src/dd.rs @@ -1322,7 +1322,6 @@ fn finalize( } #[cfg(any(target_os = "linux", target_os = "android"))] -#[allow(clippy::cognitive_complexity)] fn make_linux_oflags(oflags: &OFlags) -> Option { let mut flag = 0; diff --git a/src/uu/dd/src/numbers.rs b/src/uu/dd/src/numbers.rs index 36d141f66e6..017b1e4d590 100644 --- a/src/uu/dd/src/numbers.rs +++ b/src/uu/dd/src/numbers.rs @@ -89,7 +89,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn test_to_magnitude_and_suffix_not_powers_of_1024() { assert_eq!(to_magnitude_and_suffix(1, SuffixType::Si), "1.0 B"); assert_eq!(to_magnitude_and_suffix(999, SuffixType::Si), "999 B"); diff --git a/src/uu/dd/src/parseargs.rs b/src/uu/dd/src/parseargs.rs index a2bc1103651..54e623042c8 100644 --- a/src/uu/dd/src/parseargs.rs +++ b/src/uu/dd/src/parseargs.rs @@ -338,7 +338,6 @@ impl Parser { } } - #[allow(clippy::cognitive_complexity)] fn parse_input_flags(&mut self, val: &str) -> Result<(), ParseError> { let i = &mut self.iflag; for f in val.split(',') { @@ -370,7 +369,6 @@ impl Parser { Ok(()) } - #[allow(clippy::cognitive_complexity)] fn parse_output_flags(&mut self, val: &str) -> Result<(), ParseError> { let o = &mut self.oflag; for f in val.split(',') { diff --git a/src/uu/dd/src/parseargs/unit_tests.rs b/src/uu/dd/src/parseargs/unit_tests.rs index cde0ef0cc1f..3f5a781d2c3 100644 --- a/src/uu/dd/src/parseargs/unit_tests.rs +++ b/src/uu/dd/src/parseargs/unit_tests.rs @@ -88,7 +88,6 @@ fn test_status_level_none() { } #[test] -#[allow(clippy::cognitive_complexity)] fn test_all_top_level_args_no_leading_dashes() { let args = [ "if=foo.file", diff --git a/src/uu/df/src/blocks.rs b/src/uu/df/src/blocks.rs index 708709c6464..31324cb911a 100644 --- a/src/uu/df/src/blocks.rs +++ b/src/uu/df/src/blocks.rs @@ -277,7 +277,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn test_to_magnitude_and_suffix_not_powers_of_1024() { assert_eq!(to_magnitude_and_suffix(1, SuffixType::Si, true), "1.0B"); assert_eq!(to_magnitude_and_suffix(999, SuffixType::Si, true), "999B"); diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index a7e84468d0f..2d4aeea19bb 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -565,7 +565,7 @@ fn safe_du( // Only used on non-Linux platforms // Regular traversal using std::fs // Used on non-Linux platforms and as fallback for symlinks on Linux -#[allow(clippy::cognitive_complexity)] +#[expect(clippy::cognitive_complexity)] fn du_regular( mut my_stat: Stat, options: &TraversalOptions, @@ -1005,7 +1005,6 @@ fn parse_size_format(matches: &ArgMatches) -> UResult { } #[uucore::main] -#[allow(clippy::cognitive_complexity)] pub fn uumain(args: impl uucore::Args) -> UResult<()> { let matches = uucore::clap_localization::handle_clap_result(uu_app(), args)?; diff --git a/src/uu/fmt/src/linebreak.rs b/src/uu/fmt/src/linebreak.rs index da6d7340f68..70daf8aee8e 100644 --- a/src/uu/fmt/src/linebreak.rs +++ b/src/uu/fmt/src/linebreak.rs @@ -214,7 +214,6 @@ struct LineBreak<'a> { fresh: bool, } -#[allow(clippy::cognitive_complexity)] fn find_kp_breakpoints<'a, T: Clone + Iterator>>( iter: T, args: &BreakArgs<'a>, diff --git a/src/uu/fmt/src/parasplit.rs b/src/uu/fmt/src/parasplit.rs index 67673747dd3..f94c8f643c4 100644 --- a/src/uu/fmt/src/parasplit.rs +++ b/src/uu/fmt/src/parasplit.rs @@ -393,7 +393,6 @@ impl ParagraphStream<'_> { impl Iterator for ParagraphStream<'_> { type Item = Result>; - #[allow(clippy::cognitive_complexity)] fn next(&mut self) -> Option>> { // return a NoFormatLine in an Err; it should immediately be output let noformat = match self.lines.peek()? { diff --git a/src/uu/fold/src/fold.rs b/src/uu/fold/src/fold.rs index e7b1688579b..b898c1d75f5 100644 --- a/src/uu/fold/src/fold.rs +++ b/src/uu/fold/src/fold.rs @@ -654,7 +654,6 @@ fn process_pending_chunk( /// /// If `spaces` is `true`, attempt to break lines at whitespace boundaries. #[allow(unused_assignments)] -#[allow(clippy::cognitive_complexity)] fn fold_file( mut file: BufReader, spaces: bool, diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 3b5cbd0a9d4..64f98b11de2 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -399,7 +399,6 @@ fn head_file(input: &mut File, options: &HeadOptions) -> io::Result { } } -#[allow(clippy::cognitive_complexity)] fn uu_head(options: &HeadOptions) -> UResult<()> { let mut first = true; for file in &options.files { @@ -531,7 +530,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn all_args_test() { assert!(options("--silent").unwrap().quiet); assert!(options("--quiet").unwrap().quiet); diff --git a/src/uu/head/src/parse.rs b/src/uu/head/src/parse.rs index daf87c54d87..de0f93a9651 100644 --- a/src/uu/head/src/parse.rs +++ b/src/uu/head/src/parse.rs @@ -144,7 +144,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn test_parse_numbers_obsolete() { assert_eq!(obsolete("-5"), obsolete_result(&["-n", "5"])); assert_eq!(obsolete("-100"), obsolete_result(&["-n", "100"])); diff --git a/src/uu/head/src/take.rs b/src/uu/head/src/take.rs index 552a624cc5a..45e5f3431d5 100644 --- a/src/uu/head/src/take.rs +++ b/src/uu/head/src/take.rs @@ -469,7 +469,7 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] + #[expect(clippy::cognitive_complexity)] fn test_take_all_lines_buffer() { // 3 lines with new-lines and one partial line. let input_buffer = "a\nb\nc\ndef"; diff --git a/src/uu/id/src/id.rs b/src/uu/id/src/id.rs index 78b0ad2d390..12b2d44068d 100644 --- a/src/uu/id/src/id.rs +++ b/src/uu/id/src/id.rs @@ -122,7 +122,6 @@ struct State { } #[uucore::main(no_signals)] -#[allow(clippy::cognitive_complexity)] pub fn uumain(args: impl uucore::Args) -> UResult<()> { let matches = uucore::clap_localization::handle_clap_result(uu_app(), args)?; let mut lock = io::stdout().lock(); diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index f19f8aca249..047809002d6 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -557,7 +557,7 @@ fn is_potential_directory_path(path: &Path) -> bool { /// /// Returns a Result type with the Err variant containing the error message. /// -#[allow(clippy::cognitive_complexity)] +#[expect(clippy::cognitive_complexity)] fn standard(mut paths: Vec, b: &Behavior) -> UResult<()> { // first check that paths contains at least one element if paths.is_empty() { diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 5fb75a86730..458b0d13ffb 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -284,7 +284,6 @@ fn exec(files: &[PathBuf], settings: &Settings) -> UResult<()> { link(&files[0], &files[1], settings) } -#[allow(clippy::cognitive_complexity)] fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) -> UResult<()> { if !target_dir.is_dir() { return Err(LnError::TargetIsNotADirectory(target_dir.to_owned()).into()); @@ -386,7 +385,6 @@ fn relative_path<'a>(src: &'a Path, dst: &Path) -> Cow<'a, Path> { src.into() } -#[allow(clippy::cognitive_complexity)] fn link(src: &Path, dst: &Path, settings: &Settings) -> UResult<()> { let mut backup_path = None; let source: Cow<'_, Path> = if settings.relative { diff --git a/src/uu/ls/src/config.rs b/src/uu/ls/src/config.rs index 383d3645148..7ccda4091d7 100644 --- a/src/uu/ls/src/config.rs +++ b/src/uu/ls/src/config.rs @@ -675,7 +675,7 @@ fn parse_width(width_match: Option<&String>) -> Result { } impl Config { - #[allow(clippy::cognitive_complexity)] + #[expect(clippy::cognitive_complexity)] pub fn from(options: &clap::ArgMatches) -> UResult { let context = options.get_flag(options::CONTEXT); let (mut format, opt) = extract_format(options); diff --git a/src/uu/ls/src/display.rs b/src/uu/ls/src/display.rs index a0b0b2eeb8f..e1573cc681b 100644 --- a/src/uu/ls/src/display.rs +++ b/src/uu/ls/src/display.rs @@ -312,7 +312,6 @@ fn pad_left(string: &str, count: usize) -> String { format!("{string:>count$}") } -#[allow(clippy::cognitive_complexity)] pub fn display_items( items: &[PathData], config: &Config, @@ -674,7 +673,6 @@ pub fn display_size(size: u64, config: &Config) -> String { /// /// Note that non-unicode sequences in symlink targets are dealt with using /// [`std::path::Path::to_string_lossy`]. -#[allow(clippy::cognitive_complexity)] fn display_item_name( path: &PathData, config: &Config, @@ -870,7 +868,6 @@ fn display_item_name( /// ``` /// that decide the maximum possible character count of each field. #[allow(clippy::write_literal)] -#[allow(clippy::cognitive_complexity)] fn display_item_long( item: &PathData, padding: &PaddingCollection, diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index b750428f7e5..43747e831fb 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -572,7 +572,6 @@ pub fn mv(files: &[OsString], opts: &Options) -> UResult<()> { } } -#[allow(clippy::cognitive_complexity)] fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, options: &Options) -> UResult<()> { // remember the moved destinations for further usage let mut moved_destinations: FxHashSet = diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index 6bbec85f444..5d90c6b4d3e 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -11,7 +11,6 @@ use uucore::translate; // parse_options loads the options into the settings, returning an array of // error messages. -#[allow(clippy::cognitive_complexity)] pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) -> Vec { // This vector holds error messages encountered. let mut errs: Vec = vec![]; diff --git a/src/uu/numfmt/src/format.rs b/src/uu/numfmt/src/format.rs index 28e32631c39..193ead3eb63 100644 --- a/src/uu/numfmt/src/format.rs +++ b/src/uu/numfmt/src/format.rs @@ -805,7 +805,6 @@ mod tests { use super::*; #[test] - #[allow(clippy::cognitive_complexity)] fn test_round_with_precision() { let rm = RoundMethod::FromZero; assert_eq!(1.0, round_with_precision(0.12345, rm, 0)); diff --git a/src/uu/numfmt/src/options.rs b/src/uu/numfmt/src/options.rs index ced2d4b6493..aea3690bdc7 100644 --- a/src/uu/numfmt/src/options.rs +++ b/src/uu/numfmt/src/options.rs @@ -119,7 +119,7 @@ impl FromStr for FormatOptions { // An optional zero (%010f) will zero pad the number. // An optional negative value (%-10f) will left align. // An optional precision (%.1f) determines the precision of the number. - #[allow(clippy::cognitive_complexity)] + #[expect(clippy::cognitive_complexity)] fn from_str(s: &str) -> Result { let mut iter = s.chars().peekable(); let mut options = Self::default(); @@ -274,7 +274,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn test_parse_format_with_invalid_formats() { assert!("".parse::().is_err()); assert!("hello".parse::().is_err()); diff --git a/src/uu/od/src/input_decoder.rs b/src/uu/od/src/input_decoder.rs index 416badb444b..689d355e27c 100644 --- a/src/uu/od/src/input_decoder.rs +++ b/src/uu/od/src/input_decoder.rs @@ -231,7 +231,6 @@ mod tests { #[test] #[allow(clippy::float_cmp)] - #[allow(clippy::cognitive_complexity)] fn smoke_test() { let data = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xff, 0xff]; let mut input = PeekReader::new(Cursor::new(&data)); diff --git a/src/uu/od/src/output_info.rs b/src/uu/od/src/output_info.rs index 86c481b0d78..0f8759bc7a8 100644 --- a/src/uu/od/src/output_info.rs +++ b/src/uu/od/src/output_info.rs @@ -234,7 +234,6 @@ fn assert_alignment( } #[test] -#[allow(clippy::cognitive_complexity)] fn test_calculate_alignment() { // For this example `byte_size_block` is 8 and 'print_width_block' is 23: // 1777777777777777777777 1777777777777777777777 diff --git a/src/uu/od/src/parse_formats.rs b/src/uu/od/src/parse_formats.rs index b6cd91b4d0d..115df38143a 100644 --- a/src/uu/od/src/parse_formats.rs +++ b/src/uu/od/src/parse_formats.rs @@ -110,7 +110,6 @@ fn od_argument_with_option(ch: char) -> bool { /// arguments with parameters like -w16 can only appear at the end: -fvoxw16 /// parameters of -t/--format specify 1 or more formats. /// if -- appears on the command line, parsing should stop. -#[allow(clippy::cognitive_complexity)] pub fn parse_format_flags(args: &[String]) -> Result, String> { let mut formats = Vec::new(); diff --git a/src/uu/od/src/parse_inputs.rs b/src/uu/od/src/parse_inputs.rs index 414e11768ab..4aa523ce2a1 100644 --- a/src/uu/od/src/parse_inputs.rs +++ b/src/uu/od/src/parse_inputs.rs @@ -271,7 +271,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn test_parse_inputs_with_offset() { // offset is found without filename, so stdin will be used. assert_eq!( @@ -414,7 +413,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn test_parse_offset_operand() { assert_eq!(8, parse_offset_operand_str("10").unwrap()); // default octal assert_eq!(0, parse_offset_operand_str("0").unwrap()); diff --git a/src/uu/od/src/parse_nrofbytes.rs b/src/uu/od/src/parse_nrofbytes.rs index 241e1c6e7ca..d99928ded5e 100644 --- a/src/uu/od/src/parse_nrofbytes.rs +++ b/src/uu/od/src/parse_nrofbytes.rs @@ -79,7 +79,6 @@ pub fn parse_number_of_bytes(s: &str) -> Result { } #[test] -#[allow(clippy::cognitive_complexity)] fn test_parse_number_of_bytes() { // octal input assert_eq!(8, parse_number_of_bytes("010").unwrap()); diff --git a/src/uu/od/src/peek_reader.rs b/src/uu/od/src/peek_reader.rs index 6287306ef76..72f107d1f32 100644 --- a/src/uu/od/src/peek_reader.rs +++ b/src/uu/od/src/peek_reader.rs @@ -187,7 +187,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn test_peek_read_with_smaller_buffer() { let mut sut = PeekReader::new(Cursor::new(&b"abcdefghij"[..])); diff --git a/src/uu/od/src/prn_char.rs b/src/uu/od/src/prn_char.rs index 85392766ec0..03dab1c43fc 100644 --- a/src/uu/od/src/prn_char.rs +++ b/src/uu/od/src/prn_char.rs @@ -78,7 +78,6 @@ pub fn format_ascii_dump(bytes: &[u8]) -> String { } #[test] -#[allow(clippy::cognitive_complexity)] fn test_format_item_a() { assert_eq!(" nul", format_item_a(0x00)); assert_eq!(" soh", format_item_a(0x01)); @@ -94,7 +93,6 @@ fn test_format_item_a() { } #[test] -#[allow(clippy::cognitive_complexity)] fn test_format_item_c() { assert_eq!(" \\0", format_item_c(&[0x00])); assert_eq!(" 001", format_item_c(&[0x01])); diff --git a/src/uu/od/src/prn_float.rs b/src/uu/od/src/prn_float.rs index c93b02d25cb..a6727bd8faa 100644 --- a/src/uu/od/src/prn_float.rs +++ b/src/uu/od/src/prn_float.rs @@ -239,7 +239,7 @@ fn format_long_double(f: f64) -> String { #[test] #[allow(clippy::excessive_precision)] -#[allow(clippy::cognitive_complexity)] +#[expect(clippy::cognitive_complexity)] fn test_format_f32() { assert_eq!(format_f32(1.0), " 1.0000000"); assert_eq!(format_f32(9.999_999_0), " 9.9999990"); @@ -316,7 +316,6 @@ fn test_format_f32() { } #[test] -#[allow(clippy::cognitive_complexity)] fn test_format_f64() { assert_eq!(format_f64(1.0), " 1.0000000000000000"); assert_eq!(format_f64(10.0), " 10.000000000000000"); @@ -349,7 +348,6 @@ fn test_format_f64() { } #[test] -#[allow(clippy::cognitive_complexity)] fn test_format_f16() { assert_eq!(format_f16(f16::from_bits(0x8400u16)), " -6.1035156e-5"); assert_eq!(format_f16(f16::from_bits(0x8401u16)), " -6.1094761e-5"); diff --git a/src/uu/od/src/prn_int.rs b/src/uu/od/src/prn_int.rs index 1ed26b76c24..9dd92a44002 100644 --- a/src/uu/od/src/prn_int.rs +++ b/src/uu/od/src/prn_int.rs @@ -89,7 +89,6 @@ int_writer_signed!(FORMAT_ITEM_DEC32S, 4, 12, format_item_dec_s32, DEC!()); // m int_writer_signed!(FORMAT_ITEM_DEC64S, 8, 21, format_item_dec_s64, DEC!()); // max: -9223372036854775808 #[test] -#[allow(clippy::cognitive_complexity)] fn test_sign_extend() { assert_eq!( 0xffff_ffff_ffff_ff80u64 as i64, @@ -180,7 +179,6 @@ fn test_format_item_dec_u() { } #[test] -#[allow(clippy::cognitive_complexity)] fn test_format_item_dec_s() { assert_eq!(" 0", format_item_dec_s8(0)); assert_eq!(" 127", format_item_dec_s8(0x7f)); diff --git a/src/uu/paste/src/paste.rs b/src/uu/paste/src/paste.rs index 95638c30bb4..f2f5f8cf501 100644 --- a/src/uu/paste/src/paste.rs +++ b/src/uu/paste/src/paste.rs @@ -82,7 +82,6 @@ pub fn uu_app() -> Command { ) } -#[allow(clippy::cognitive_complexity)] fn paste( filenames: Vec, serial: bool, diff --git a/src/uu/pr/src/pr.rs b/src/uu/pr/src/pr.rs index def105ae50d..54141af63b4 100644 --- a/src/uu/pr/src/pr.rs +++ b/src/uu/pr/src/pr.rs @@ -503,7 +503,6 @@ fn get_date_format(matches: &ArgMatches) -> String { .to_string() } -#[allow(clippy::cognitive_complexity)] fn build_options( matches: &ArgMatches, paths: &[&str], @@ -1188,7 +1187,6 @@ fn to_table_short_file( table } -#[allow(clippy::cognitive_complexity)] fn write_columns( lines: &[FileLine], options: &OutputOptions, diff --git a/src/uu/ptx/src/ptx.rs b/src/uu/ptx/src/ptx.rs index 64a5e2bacbe..6fb82e7e8f9 100644 --- a/src/uu/ptx/src/ptx.rs +++ b/src/uu/ptx/src/ptx.rs @@ -114,7 +114,6 @@ struct WordFilter { } impl WordFilter { - #[allow(clippy::cognitive_complexity)] fn new(matches: &clap::ArgMatches, config: &Config) -> UResult { let (o, oset): (bool, HashSet) = if matches.contains_id(options::ONLY_FILE) { let words = diff --git a/src/uu/seq/src/numberparse.rs b/src/uu/seq/src/numberparse.rs index ba4ab4e4eba..24d36f9db6a 100644 --- a/src/uu/seq/src/numberparse.rs +++ b/src/uu/seq/src/numberparse.rs @@ -282,7 +282,7 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] + #[expect(clippy::cognitive_complexity)] fn test_num_integral_digits() { // no decimal, no exponent assert_eq!(num_integral_digits("123"), 3); @@ -323,7 +323,7 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] + #[expect(clippy::cognitive_complexity)] fn test_num_fractional_digits() { // no decimal, no exponent assert_eq!(num_fractional_digits("123"), 0); diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index f35b1a0db2c..2dd034e71cd 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -614,7 +614,6 @@ fn create_compatible_sequence( } #[allow(clippy::too_many_arguments)] -#[allow(clippy::cognitive_complexity)] fn wipe_file( path_str: &OsString, n_passes: usize, diff --git a/src/uu/sort/src/numeric_str_cmp.rs b/src/uu/sort/src/numeric_str_cmp.rs index 40530cc5145..48fe7bbc2dd 100644 --- a/src/uu/sort/src/numeric_str_cmp.rs +++ b/src/uu/sort/src/numeric_str_cmp.rs @@ -50,7 +50,6 @@ impl NumInfo { /// an empty range (idx..idx) is returned so that idx is the char after the last zero. /// If the input is not a number (which has to be treated as zero), the returned empty range /// will be 0..0. - #[allow(clippy::cognitive_complexity)] pub fn parse(num: &[u8], parse_settings: &NumInfoParseSettings) -> (Self, Range) { let mut exponent = -1; let mut had_decimal_pt = false; diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 8b321b55d53..61d0d728218 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1995,7 +1995,7 @@ fn emit_debug_warnings( } #[uucore::main] -#[allow(clippy::cognitive_complexity)] +#[expect(clippy::cognitive_complexity)] pub fn uumain(args: impl uucore::Args) -> UResult<()> { let mut settings = GlobalSettings { numeric_locale: detect_numeric_locale(), @@ -2832,7 +2832,6 @@ fn ascii_case_insensitive_cmp(a: &[u8], b: &[u8]) -> Ordering { // In contrast to numeric compare, GNU general numeric/FP sort *should* recognize positive signs and // scientific notation, so we strip those lines only after the end of the following numeric string. // For example, 5e10KFD would be 5e10 or 5x10^10 and +10000HFKJFK would become 10000. -#[allow(clippy::cognitive_complexity)] fn get_leading_gen(inp: &[u8], decimal_pt: u8) -> Range { let trimmed = inp.trim_ascii_start(); let leading_whitespace_len = inp.len() - trimmed.len(); diff --git a/src/uu/split/src/number.rs b/src/uu/split/src/number.rs index 58c08d12bac..ca7ee18bdfc 100644 --- a/src/uu/split/src/number.rs +++ b/src/uu/split/src/number.rs @@ -399,7 +399,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn test_dynamic_width_number_display_alphabetic() { fn num(n: usize) -> Number { let mut number = Number::DynamicWidth(DynamicWidthNumber::new(26, 0)); @@ -445,7 +444,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn test_dynamic_width_number_display_numeric_hexadecimal() { fn num(n: usize) -> Number { let mut number = Number::DynamicWidth(DynamicWidthNumber::new(16, 0)); @@ -470,7 +468,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn test_fixed_width_number_increment() { let mut n = Number::FixedWidth(FixedWidthNumber::new(3, 2, 0).unwrap()); assert_eq!(n.digits(), vec![0, 0]); @@ -494,7 +491,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn test_fixed_width_number_display_alphabetic() { fn num(n: usize) -> Result { let mut number = Number::FixedWidth(FixedWidthNumber::new(26, 2, 0).unwrap()); diff --git a/src/uu/split/src/split.rs b/src/uu/split/src/split.rs index 596e6ffb986..a29afab0c63 100644 --- a/src/uu/split/src/split.rs +++ b/src/uu/split/src/split.rs @@ -1531,7 +1531,6 @@ where Ok(()) } -#[allow(clippy::cognitive_complexity)] fn split(settings: &Settings) -> UResult<()> { let r_box = if settings.input == "-" { Box::new(stdin()) as Box diff --git a/src/uu/split/src/strategy.rs b/src/uu/split/src/strategy.rs index 6d567637d07..44f0aa5df31 100644 --- a/src/uu/split/src/strategy.rs +++ b/src/uu/split/src/strategy.rs @@ -302,7 +302,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn test_number_type_from_error() { assert_eq!( NumberType::from("xyz").unwrap_err(), diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index df5ee8ff743..52c22790525 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -1441,7 +1441,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] fn test_group_num() { assert_eq!("12,379,821,234", group_num("12379821234")); assert_eq!("21,234", group_num("21234")); diff --git a/src/uu/tac/src/tac.rs b/src/uu/tac/src/tac.rs index 50e615c988b..e9c51b12eba 100644 --- a/src/uu/tac/src/tac.rs +++ b/src/uu/tac/src/tac.rs @@ -321,7 +321,6 @@ fn translate_regex_flavor(bytes: &[u8]) -> String { String::from_utf8(result).expect("produces ASCII bytes") } -#[allow(clippy::cognitive_complexity)] fn tac(filenames: &[OsString], before: bool, regex: bool, separator: &OsStr) -> UResult<()> { // Compile the regular expression pattern if it is provided. let maybe_pattern = if regex { diff --git a/src/uu/tail/src/follow/watch.rs b/src/uu/tail/src/follow/watch.rs index 7300e954087..acb9dc1ce60 100644 --- a/src/uu/tail/src/follow/watch.rs +++ b/src/uu/tail/src/follow/watch.rs @@ -292,7 +292,7 @@ impl Observer { Ok(()) } - #[allow(clippy::cognitive_complexity)] + #[expect(clippy::cognitive_complexity)] fn handle_event( &mut self, event: ¬ify::Event, @@ -478,7 +478,6 @@ impl Observer { } } -#[allow(clippy::cognitive_complexity)] pub fn follow(mut observer: Observer, settings: &Settings) -> UResult<()> { if observer.files.no_files_remaining(settings) && !observer.files.only_stdin_remaining() { return Err(USimpleError::new(1, translate!("tail-no-files-remaining"))); diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index 840858c6519..a129410406d 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -444,7 +444,6 @@ impl PrintState { } } -#[allow(clippy::cognitive_complexity)] fn unexpand_buf( buf: &[u8], output: &mut BufWriter, diff --git a/src/uu/wc/src/utf8/read.rs b/src/uu/wc/src/utf8/read.rs index 6364c45df17..373a09ce8b8 100644 --- a/src/uu/wc/src/utf8/read.rs +++ b/src/uu/wc/src/utf8/read.rs @@ -45,7 +45,6 @@ impl BufReadDecoder { /// This is similar to `Iterator::next`, /// except that decoded chunks borrow the decoder (~iterator) /// so they need to be handled or copied before the next chunk can start decoding. - #[allow(clippy::cognitive_complexity)] pub fn next_strict(&mut self) -> Option>> { enum BytesSource { BufRead(usize), diff --git a/src/uu/who/src/platform/unix.rs b/src/uu/who/src/platform/unix.rs index 375715a40d8..fca32ed3249 100644 --- a/src/uu/who/src/platform/unix.rs +++ b/src/uu/who/src/platform/unix.rs @@ -193,7 +193,6 @@ fn current_tty() -> String { } impl Who { - #[allow(clippy::cognitive_complexity)] fn exec(&mut self) -> UResult<()> { #[cfg(target_os = "linux")] let run_level_chk = |record: i16| record == utmpx::RUN_LVL; diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index d165b8a9f68..cf9f18fc736 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -367,7 +367,6 @@ impl<'a> From> for OwningComponent { /// * [`ResolveMode::Logical`] makes this function resolve '..' components /// before symlinks /// -#[allow(clippy::cognitive_complexity)] pub fn canonicalize>( original: P, miss_mode: MissingHandling, @@ -559,7 +558,6 @@ fn get_file_display(mode: u32) -> char { // The logic below is more readable written this way. #[allow(clippy::if_not_else)] -#[allow(clippy::cognitive_complexity)] /// Display the unix permissions of a file pub fn display_permissions_unix(mode: u32, display_file_type: bool) -> String { use mode::{ diff --git a/src/uucore/src/lib/features/perms.rs b/src/uucore/src/lib/features/perms.rs index 79a51b0ccad..dc0e985ba8d 100644 --- a/src/uucore/src/lib/features/perms.rs +++ b/src/uucore/src/lib/features/perms.rs @@ -284,7 +284,6 @@ impl ChownExecutor { Ok(()) } - #[allow(clippy::cognitive_complexity)] fn traverse>(&self, root: P) -> i32 { let path = root.as_ref(); let Some(meta) = self.obtain_meta(path, self.dereference) else { @@ -557,7 +556,6 @@ impl ChownExecutor { } #[cfg(not(target_os = "linux"))] - #[allow(clippy::cognitive_complexity)] fn dive_into>(&self, root: P) -> i32 { let root = root.as_ref(); @@ -848,7 +846,6 @@ pub fn configure_symlink_and_recursion( /// `parse_gid_uid_and_filter` will be called to obtain the target gid and uid, and the filter, /// from `ArgMatches`. /// `groups_only` determines whether verbose output will only mention the group. -#[allow(clippy::cognitive_complexity)] pub fn chown_base( mut command: Command, args: impl crate::Args, diff --git a/tests/by-util/test_env.rs b/tests/by-util/test_env.rs index 1a1d504a13a..55916cc940f 100644 --- a/tests/by-util/test_env.rs +++ b/tests/by-util/test_env.rs @@ -608,7 +608,6 @@ fn test_gnu_e20() { } #[test] -#[allow(clippy::cognitive_complexity)] // Ignore clippy lint of too long function sign fn test_env_parsing_errors() { let ts = TestScenario::new(util_name!()); diff --git a/tests/uutests/src/lib/random.rs b/tests/uutests/src/lib/random.rs index cdb64a1097c..21c79c97d5c 100644 --- a/tests/uutests/src/lib/random.rs +++ b/tests/uutests/src/lib/random.rs @@ -213,7 +213,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] // Ignore clippy lint of too long function sign fn test_random_string_generate_with_delimiter_should_end_with_delimiter() { let random_string = RandomizedString::generate_with_delimiter(Alphanumeric, 0, 1, true, 1); assert_eq!(1, random_string.len()); @@ -257,7 +256,6 @@ mod tests { } #[test] - #[allow(clippy::cognitive_complexity)] // Ignore clippy lint of too long function sign fn test_random_string_generate_with_delimiter_should_not_end_with_delimiter() { let random_string = RandomizedString::generate_with_delimiter(Alphanumeric, 0, 0, false, 1); assert_eq!(1, random_string.len());