Skip to content

Commit

Permalink
Merge pull request #5401 from cakebaker/clippy_suppress_cognitive_com…
Browse files Browse the repository at this point in the history
…plexity_warning

clippy: suppress cognitive_complexity lint in some tests
  • Loading branch information
sylvestre authored Oct 13, 2023
2 parents 617de9b + a69d48f commit 3cd5f9d
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/uu/csplit/src/csplit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ mod tests {
use super::*;

#[test]
#[allow(clippy::cognitive_complexity)]
fn input_splitter() {
let input = vec![
Ok(String::from("aaa")),
Expand Down Expand Up @@ -736,6 +737,7 @@ mod tests {
}

#[test]
#[allow(clippy::cognitive_complexity)]
fn input_splitter_interrupt_rewind() {
let input = vec![
Ok(String::from("aaa")),
Expand Down
2 changes: 2 additions & 0 deletions src/uu/csplit/src/patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ mod tests {
}

#[test]
#[allow(clippy::cognitive_complexity)]
fn up_to_match_pattern() {
let input: Vec<String> = vec![
"/test1.*end$/",
Expand Down Expand Up @@ -264,6 +265,7 @@ mod tests {
}

#[test]
#[allow(clippy::cognitive_complexity)]
fn skip_to_match_pattern() {
let input: Vec<String> = vec![
"%test1.*end$%",
Expand Down
1 change: 1 addition & 0 deletions src/uu/dd/src/numbers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ 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");
Expand Down
1 change: 1 addition & 0 deletions src/uu/dd/src/parseargs/unit_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ fn test_status_level_none() {
}

#[test]
#[allow(clippy::cognitive_complexity)]
fn test_all_top_level_args_no_leading_dashes() {
let args = &[
"if=foo.file",
Expand Down
1 change: 1 addition & 0 deletions src/uu/df/src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ 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), "1B");
assert_eq!(to_magnitude_and_suffix(999, SuffixType::Si), "999B");
Expand Down
1 change: 1 addition & 0 deletions src/uu/head/src/head.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ mod tests {
}

#[test]
#[allow(clippy::cognitive_complexity)]
fn all_args_test() {
assert!(options("--silent").unwrap().quiet);
assert!(options("--quiet").unwrap().quiet);
Expand Down
1 change: 1 addition & 0 deletions src/uu/head/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ 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"]));
Expand Down
1 change: 1 addition & 0 deletions src/uu/nl/src/nl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ mod test {
use super::*;

#[test]
#[allow(clippy::cognitive_complexity)]
fn test_format() {
assert_eq!(NumberFormat::Left.format(12, 1), "12");
assert_eq!(NumberFormat::Left.format(-12, 1), "-12");
Expand Down
1 change: 1 addition & 0 deletions src/uu/numfmt/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ 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));
Expand Down
1 change: 1 addition & 0 deletions src/uu/numfmt/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ mod tests {
}

#[test]
#[allow(clippy::cognitive_complexity)]
fn test_parse_format_with_invalid_formats() {
assert!("".parse::<FormatOptions>().is_err());
assert!("hello".parse::<FormatOptions>().is_err());
Expand Down
1 change: 1 addition & 0 deletions src/uu/od/src/prn_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ fn test_format_flo64() {
}

#[test]
#[allow(clippy::cognitive_complexity)]
fn test_format_flo16() {
assert_eq!(format_flo16(f16::from_bits(0x8400u16)), "-6.104e-5");
assert_eq!(format_flo16(f16::from_bits(0x8401u16)), "-6.109e-5");
Expand Down
2 changes: 2 additions & 0 deletions src/uu/seq/src/numberparse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ mod tests {
}

#[test]
#[allow(clippy::cognitive_complexity)]
fn test_num_integral_digits() {
// no decimal, no exponent
assert_eq!(num_integral_digits("123"), 3);
Expand Down Expand Up @@ -578,6 +579,7 @@ mod tests {
}

#[test]
#[allow(clippy::cognitive_complexity)]
fn test_num_fractional_digits() {
// no decimal, no exponent
assert_eq!(num_fractional_digits("123"), 0);
Expand Down
4 changes: 4 additions & 0 deletions src/uu/split/src/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ 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));
Expand Down Expand Up @@ -443,6 +444,7 @@ 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));
Expand All @@ -467,6 +469,7 @@ 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]);
Expand All @@ -490,6 +493,7 @@ mod tests {
}

#[test]
#[allow(clippy::cognitive_complexity)]
fn test_fixed_width_number_display_alphabetic() {
fn num(n: usize) -> Result<Number, Overflow> {
let mut number = Number::FixedWidth(FixedWidthNumber::new(26, 2, 0).unwrap());
Expand Down
1 change: 1 addition & 0 deletions src/uu/split/src/split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1846,6 +1846,7 @@ mod tests {
}

#[test]
#[allow(clippy::cognitive_complexity)]
fn test_number_type_from_error() {
assert_eq!(
NumberType::from("xyz").unwrap_err(),
Expand Down
1 change: 1 addition & 0 deletions src/uu/stat/src/stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,7 @@ 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"));
Expand Down

0 comments on commit 3cd5f9d

Please sign in to comment.