1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 03:57:44 +00:00

Ignore more cognitive_complexity

This commit is contained in:
Sylvestre Ledru 2023-10-08 17:46:11 +02:00
parent 6d24549156
commit 8e8a91be5d
12 changed files with 17 additions and 0 deletions

View file

@ -447,6 +447,7 @@ mod tests {
use super::ends_with_slash_dot;
#[test]
#[allow(clippy::cognitive_complexity)]
fn test_ends_with_slash_dot() {
assert!(ends_with_slash_dot("/."));
assert!(ends_with_slash_dot("./."));

View file

@ -109,6 +109,7 @@ struct State {
}
#[uucore::main]
#[allow(clippy::cognitive_complexity)]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let matches = uu_app().after_help(AFTER_HELP).try_get_matches_from(args)?;

View file

@ -526,6 +526,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)]
fn standard(mut paths: Vec<String>, b: &Behavior) -> UResult<()> {
// first check that paths contains at least one element
if paths.is_empty() {

View file

@ -166,6 +166,7 @@ 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));

View file

@ -208,6 +208,7 @@ impl TypeSizeInfo for TypeInfo {
}
#[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

View file

@ -213,6 +213,7 @@ 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!(
@ -355,6 +356,7 @@ 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());

View file

@ -79,6 +79,7 @@ pub fn parse_number_of_bytes(s: &str) -> Result<u64, ParseSizeError> {
}
#[test]
#[allow(clippy::cognitive_complexity)]
fn test_parse_number_of_bytes() {
// octal input
assert_eq!(8, parse_number_of_bytes("010").unwrap());

View file

@ -186,6 +186,7 @@ mod tests {
}
#[test]
#[allow(clippy::cognitive_complexity)]
fn test_peek_read_with_smaller_buffer() {
let mut sut = PeekReader::new(Cursor::new(&b"abcdefghij"[..]));

View file

@ -99,6 +99,7 @@ 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));
@ -114,6 +115,7 @@ 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]));

View file

@ -91,6 +91,7 @@ fn format_float(f: f64, width: usize, precision: usize) -> String {
#[test]
#[allow(clippy::excessive_precision)]
#[allow(clippy::cognitive_complexity)]
fn test_format_flo32() {
assert_eq!(format_flo32(1.0), " 1.0000000");
assert_eq!(format_flo32(9.9999990), " 9.9999990");
@ -167,6 +168,7 @@ fn test_format_flo32() {
}
#[test]
#[allow(clippy::cognitive_complexity)]
fn test_format_flo64() {
assert_eq!(format_flo64(1.0), " 1.0000000000000000");
assert_eq!(format_flo64(10.0), " 10.000000000000000");

View file

@ -89,6 +89,7 @@ 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,
@ -179,6 +180,7 @@ 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));

View file

@ -404,6 +404,7 @@ fn print_unsigned_hex(
}
impl Stater {
#[allow(clippy::cognitive_complexity)]
fn generate_tokens(format_str: &str, use_printf: bool) -> UResult<Vec<Token>> {
let mut tokens = Vec::new();
let bound = format_str.len();
@ -609,6 +610,7 @@ impl Stater {
ret
}
#[allow(clippy::cognitive_complexity)]
fn do_stat(&self, file: &OsStr, stdin_is_fifo: bool) -> i32 {
let display_name = file.to_string_lossy();
let file = if cfg!(unix) && display_name == "-" {