From ab679473210e329e4cf76872c73a1bcd81cdd948 Mon Sep 17 00:00:00 2001 From: n4n5 Date: Sun, 30 Jun 2024 16:27:08 +0200 Subject: [PATCH] fix clippy tests --- tests/by-util/test_cat.rs | 2 +- tests/by-util/test_chcon.rs | 2 +- tests/by-util/test_chmod.rs | 26 +- tests/by-util/test_chown.rs | 3 +- tests/by-util/test_cp.rs | 22 +- tests/by-util/test_date.rs | 13 +- tests/by-util/test_df.rs | 7 + tests/by-util/test_dircolors.rs | 8 +- tests/by-util/test_du.rs | 2 +- tests/by-util/test_env.rs | 45 +- tests/by-util/test_factor.rs | 1807 ++++++++++++++++++------------- tests/by-util/test_id.rs | 7 +- tests/by-util/test_kill.rs | 2 +- tests/by-util/test_ln.rs | 2 + tests/by-util/test_ls.rs | 10 +- tests/by-util/test_mkdir.rs | 2 + tests/by-util/test_od.rs | 2 +- tests/by-util/test_paste.rs | 8 +- tests/by-util/test_rm.rs | 2 + tests/by-util/test_shuf.rs | 16 +- tests/by-util/test_sort.rs | 1 + tests/by-util/test_stat.rs | 4 +- tests/by-util/test_tail.rs | 37 +- tests/by-util/test_tee.rs | 2 + tests/by-util/test_test.rs | 9 +- tests/by-util/test_tsort.rs | 2 + tests/by-util/test_uniq.rs | 1 + tests/by-util/test_uptime.rs | 2 + tests/by-util/test_wc.rs | 35 +- tests/common/random.rs | 54 +- tests/common/util.rs | 12 +- 31 files changed, 1259 insertions(+), 888 deletions(-) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index b11c0ec0c..d67ecb0b1 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -485,7 +485,7 @@ fn test_dev_random() { } /// Reading from /dev/full should return an infinite amount of zero bytes. -/// Wikipedia says there is support on Linux, FreeBSD, and NetBSD. +/// Wikipedia says there is support on Linux, FreeBSD, and `NetBSD`. #[test] #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))] fn test_dev_full() { diff --git a/tests/by-util/test_chcon.rs b/tests/by-util/test_chcon.rs index a8dae9aed..1fd356e5b 100644 --- a/tests/by-util/test_chcon.rs +++ b/tests/by-util/test_chcon.rs @@ -3,7 +3,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // spell-checker:ignore (jargon) xattributes - +#![allow(clippy::missing_errors_doc, clippy::similar_names)] #![cfg(feature = "feat_selinux")] use std::ffi::CString; diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index 32bb7a966..167e79cd0 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -2,6 +2,7 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. + use crate::common::util::{AtPath, TestScenario, UCommand}; use std::fs::{metadata, set_permissions, OpenOptions, Permissions}; use std::os::unix::fs::{OpenOptionsExt, PermissionsExt}; @@ -32,12 +33,14 @@ fn make_file(file: &str, mode: u32) { fn run_single_test(test: &TestCase, at: &AtPath, mut ucmd: UCommand) { make_file(&at.plus_as_string(TEST_FILE), test.before); let perms = at.metadata(TEST_FILE).permissions().mode(); - if perms != test.before { - panic!( - "{}: expected: {:o} got: {:o}", - "setting permissions on test files before actual test run failed", test.after, perms - ); - } + + assert!( + perms == test.before, + "{}: expected: {:o} got: {:o}", + "setting permissions on test files before actual test run failed", + test.after, + perms + ); for arg in &test.args { ucmd.arg(arg); @@ -52,9 +55,13 @@ fn run_single_test(test: &TestCase, at: &AtPath, mut ucmd: UCommand) { } let perms = at.metadata(TEST_FILE).permissions().mode(); - if perms != test.after { - panic!("{}: expected: {:o} got: {:o}", ucmd, test.after, perms); - } + assert!( + perms == test.after, + "{}: expected: {:o} got: {:o}", + ucmd, + test.after, + perms + ); } fn run_tests(tests: Vec) { @@ -128,6 +135,7 @@ fn test_chmod_octal() { #[test] #[allow(clippy::unreadable_literal)] +#[allow(clippy::too_many_lines)] // spell-checker:disable-next-line fn test_chmod_ugoa() { let tests = vec![ diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index f893d2611..3fb6d69c3 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -29,9 +29,8 @@ fn skipping_test_is_okay(result: &CmdResult, needle: &str) -> bool { if is_ci() && result.stderr_str().contains(needle) { println!("test skipped:"); return true; - } else { - result.success(); } + result.success(); } false } diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 3b4ec74f7..0837fda4e 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -2298,9 +2298,9 @@ fn test_closes_file_descriptors() { #[cfg(any(target_os = "linux", target_os = "android"))] #[test] fn test_cp_sparse_never_empty() { + const BUFFER_SIZE: usize = 4096 * 4; let (at, mut ucmd) = at_and_ucmd!(); - const BUFFER_SIZE: usize = 4096 * 4; let buf: [u8; BUFFER_SIZE] = [0; BUFFER_SIZE]; at.make_file("src_file1"); @@ -2318,10 +2318,10 @@ fn test_cp_sparse_never_empty() { #[cfg(any(target_os = "linux", target_os = "android"))] #[test] fn test_cp_sparse_always_empty() { + const BUFFER_SIZE: usize = 4096 * 4; for argument in ["--sparse=always", "--sparse=alway", "--sparse=al"] { let (at, mut ucmd) = at_and_ucmd!(); - const BUFFER_SIZE: usize = 4096 * 4; let buf: [u8; BUFFER_SIZE] = [0; BUFFER_SIZE]; at.make_file("src_file1"); @@ -2338,9 +2338,9 @@ fn test_cp_sparse_always_empty() { #[cfg(any(target_os = "linux", target_os = "android"))] #[test] fn test_cp_sparse_always_non_empty() { + const BUFFER_SIZE: usize = 4096 * 16 + 3; let (at, mut ucmd) = at_and_ucmd!(); - const BUFFER_SIZE: usize = 4096 * 16 + 3; let mut buf: [u8; BUFFER_SIZE] = [0; BUFFER_SIZE]; let blocks_to_touch = [buf.len() / 3, 2 * (buf.len() / 3)]; @@ -2408,12 +2408,11 @@ fn test_cp_sparse_never_reflink_always() { #[cfg(feature = "truncate")] #[test] fn test_cp_reflink_always_override() { - let scene = TestScenario::new(util_name!()); - const DISK: &str = "disk.img"; const ROOTDIR: &str = "disk_root/"; const USERDIR: &str = "dir/"; const MOUNTPOINT: &str = "mountpoint/"; + let scene = TestScenario::new(util_name!()); let src1_path: &str = &[MOUNTPOINT, USERDIR, "src1"].concat(); let src2_path: &str = &[MOUNTPOINT, USERDIR, "src2"].concat(); @@ -2545,12 +2544,12 @@ fn test_no_preserve_mode() { let umask: u16 = 0o022; ucmd.arg("file") .arg("dest") - .umask(umask as libc::mode_t) + .umask(libc::mode_t::from(umask)) .succeeds() .no_stderr() .no_stdout(); // remove sticky bit, setuid and setgid bit; apply umask - let expected_perms = PERMS_ALL & !0o7000 & !umask as u32; + let expected_perms = PERMS_ALL & !0o7000 & u32::from(!umask); assert_eq!( at.plus("dest").metadata().unwrap().mode() & 0o7777, expected_perms @@ -5477,16 +5476,17 @@ fn test_dir_perm_race_with_preserve_mode_and_ownership() { let start_time = std::time::Instant::now(); // wait for cp to create dirs loop { - if start_time.elapsed() >= timeout { - panic!("timed out: cp took too long to create destination directory") - } + assert!( + start_time.elapsed() < timeout, + "timed out: cp took too long to create destination directory" + ); if at.dir_exists(&format!("{}/{}", DEST_DIR, SRC_DIR)) { break; } std::thread::sleep(Duration::from_millis(100)); } let mode = at.metadata(&format!("{}/{}", DEST_DIR, SRC_DIR)).mode(); - #[allow(clippy::unnecessary_cast)] + #[allow(clippy::unnecessary_cast, clippy::cast_lossless)] let mask = if attr == "mode" { libc::S_IWGRP | libc::S_IWOTH } else { diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 16a01c655..b9c4a2017 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -263,7 +263,7 @@ fn test_date_set_mac_unavailable() { #[test] #[cfg(all(unix, not(target_os = "macos")))] -/// TODO: expected to fail currently; change to succeeds() when required. +/// TODO: expected to fail currently; change to `succeeds()` when required. fn test_date_set_valid_2() { if geteuid() == 0 { let result = new_ucmd!() @@ -288,10 +288,11 @@ fn test_date_for_invalid_file() { #[test] #[cfg(unix)] fn test_date_for_no_permission_file() { - let (at, mut ucmd) = at_and_ucmd!(); + use std::os::unix::fs::PermissionsExt; const FILE: &str = "file-no-perm-1"; - use std::os::unix::fs::PermissionsExt; + let (at, mut ucmd) = at_and_ucmd!(); + let file = std::fs::OpenOptions::new() .create(true) .truncate(true) @@ -328,7 +329,7 @@ fn test_date_for_file() { #[test] #[cfg(all(unix, not(target_os = "macos")))] -/// TODO: expected to fail currently; change to succeeds() when required. +/// TODO: expected to fail currently; change to `succeeds()` when required. fn test_date_set_valid_3() { if geteuid() == 0 { let result = new_ucmd!() @@ -342,7 +343,7 @@ fn test_date_set_valid_3() { #[test] #[cfg(all(unix, not(target_os = "macos")))] -/// TODO: expected to fail currently; change to succeeds() when required. +/// TODO: expected to fail currently; change to `succeeds()` when required. fn test_date_set_valid_4() { if geteuid() == 0 { let result = new_ucmd!() @@ -412,8 +413,8 @@ fn test_date_overflow() { #[test] fn test_date_parse_from_format() { - let (at, mut ucmd) = at_and_ucmd!(); const FILE: &str = "file-with-dates"; + let (at, mut ucmd) = at_and_ucmd!(); at.write( FILE, diff --git a/tests/by-util/test_df.rs b/tests/by-util/test_df.rs index 996b8dc29..c67af5cba 100644 --- a/tests/by-util/test_df.rs +++ b/tests/by-util/test_df.rs @@ -3,6 +3,13 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // spell-checker:ignore udev pcent iuse itotal iused ipcent +#![allow( + clippy::similar_names, + clippy::cast_possible_truncation, + clippy::cast_sign_loss, + clippy::float_cmp +)] + use std::collections::HashSet; use crate::common::util::TestScenario; diff --git a/tests/by-util/test_dircolors.rs b/tests/by-util/test_dircolors.rs index d67368154..06d490c4a 100644 --- a/tests/by-util/test_dircolors.rs +++ b/tests/by-util/test_dircolors.rs @@ -200,15 +200,15 @@ TERM {term_pattern} .no_stderr(); } - let expectation_if_match = r#" + let expectation_if_match = r" LS_COLORS='*.term_matching=00;38;5;61:'; export LS_COLORS -"# +" .trim_start(); - let expectation_if_no_match = r#" + let expectation_if_no_match = r" LS_COLORS=''; export LS_COLORS -"# +" .trim_start(); // sanity checks diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 4527b3d5a..c1cd356a1 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -545,7 +545,7 @@ fn test_du_h_flag_empty_file() { #[test] fn test_du_h_precision() { let test_cases = [ - (133456345, "128M"), + (133_456_345, "128M"), (12 * 1024 * 1024, "12M"), (8500, "8.4K"), ]; diff --git a/tests/by-util/test_env.rs b/tests/by-util/test_env.rs index f8c5c66d1..0a509c5d7 100644 --- a/tests/by-util/test_env.rs +++ b/tests/by-util/test_env.rs @@ -3,6 +3,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // spell-checker:ignore (words) bamf chdir rlimit prlimit COMSPEC cout cerr FFFD +#![allow(clippy::missing_errors_doc)] use crate::common::util::TestScenario; #[cfg(unix)] @@ -555,28 +556,28 @@ fn test_env_parsing_errors() { .stderr_is("env: invalid sequence '\\a' in -S\n"); ts.ucmd() - .arg(r#"-S\|\&\;"#) // no quotes, invalid escape sequence | + .arg(r"-S\|\&\;") // no quotes, invalid escape sequence | .fails() .code_is(125) .no_stdout() .stderr_is("env: invalid sequence '\\|' in -S\n"); ts.ucmd() - .arg(r#"-S\<\&\;"#) // no quotes, invalid escape sequence < + .arg(r"-S\<\&\;") // no quotes, invalid escape sequence < .fails() .code_is(125) .no_stdout() .stderr_is("env: invalid sequence '\\<' in -S\n"); ts.ucmd() - .arg(r#"-S\>\&\;"#) // no quotes, invalid escape sequence > + .arg(r"-S\>\&\;") // no quotes, invalid escape sequence > .fails() .code_is(125) .no_stdout() .stderr_is("env: invalid sequence '\\>' in -S\n"); ts.ucmd() - .arg(r#"-S\`\&\;"#) // no quotes, invalid escape sequence ` + .arg(r"-S\`\&\;") // no quotes, invalid escape sequence ` .fails() .code_is(125) .no_stdout() @@ -590,14 +591,14 @@ fn test_env_parsing_errors() { .stderr_is("env: invalid sequence '\\`' in -S\n"); ts.ucmd() - .arg(r#"-S'\`\&\;'"#) // single quotes, invalid escape sequence ` + .arg(r"-S'\`\&\;'") // single quotes, invalid escape sequence ` .fails() .code_is(125) .no_stdout() .stderr_is("env: invalid sequence '\\`' in -S\n"); ts.ucmd() - .arg(r#"-S\`"#) // ` escaped without quotes + .arg(r"-S\`") // ` escaped without quotes .fails() .code_is(125) .no_stdout() @@ -611,14 +612,14 @@ fn test_env_parsing_errors() { .stderr_is("env: invalid sequence '\\`' in -S\n"); ts.ucmd() - .arg(r#"-S'\`'"#) // ` escaped in single quotes + .arg(r"-S'\`'") // ` escaped in single quotes .fails() .code_is(125) .no_stdout() .stderr_is("env: invalid sequence '\\`' in -S\n"); ts.ucmd() - .args(&[r#"-S\🦉"#]) // ` escaped in single quotes + .args(&[r"-S\🦉"]) // ` escaped in single quotes .fails() .code_is(125) .no_stdout() @@ -1068,11 +1069,11 @@ mod tests_split_iterator { #[test] fn split_single_quotes() { split_ok(&[ - (r#"''"#, &[r#""#]), - (r#"'a'"#, &[r#"a"#]), - (r#"'\\'"#, &[r#"\"#]), - (r#"' \\ '"#, &[r#" \ "#]), - (r#"'#'"#, &[r#"#"#]), + (r"''", &[r""]), + (r"'a'", &[r"a"]), + (r"'\\'", &[r"\"]), + (r"' \\ '", &[r" \ "]), + (r"'#'", &[r"#"]), ]); } @@ -1094,12 +1095,12 @@ mod tests_split_iterator { #[test] fn split_unquoted() { split_ok(&[ - (r#"\\|\\&\\;"#, &[r#"\|\&\;"#]), - (r#"\\<\\>"#, &[r#"\<\>"#]), - (r#"\\(\\)"#, &[r#"\(\)"#]), - (r#"\$"#, &[r#"$"#]), + (r"\\|\\&\\;", &[r"\|\&\;"]), + (r"\\<\\>", &[r"\<\>"]), + (r"\\(\\)", &[r"\(\)"]), + (r"\$", &[r"$"]), (r#"\""#, &[r#"""#]), - (r#"\'"#, &[r#"'"#]), + (r"\'", &[r"'"]), ("\\\n", &[]), (" \\\n \n", &[]), ("a\nb\nc", &["a", "b", "c"]), @@ -1179,7 +1180,7 @@ mod tests_split_iterator { Err(ParseError::InvalidSequenceBackslashXInMinusS { pos: 2, c: 'a' }) ); assert_eq!( - split(r#"\🦉"#), + split(r"\🦉"), Err(ParseError::InvalidSequenceBackslashXInMinusS { pos: 1, c: '\u{FFFD}' @@ -1190,9 +1191,9 @@ mod tests_split_iterator { #[test] fn split_comments() { split_ok(&[ - (r#" x # comment "#, &["x"]), - (r#" w1#w2 "#, &["w1#w2"]), - (r#"'not really a # comment'"#, &["not really a # comment"]), + (r" x # comment ", &["x"]), + (r" w1#w2 ", &["w1#w2"]), + (r"'not really a # comment'", &["not really a # comment"]), (" a # very long comment \n b # another comment", &["a", "b"]), ]); } diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index f643a4049..36c2ccab8 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -4,6 +4,11 @@ // file that was distributed with this source code. // spell-checker:ignore (methods) hexdigest funcs nprimes +#![allow( + clippy::similar_names, + clippy::cast_possible_truncation, + clippy::cast_sign_loss +)] use crate::common::util::TestScenario; @@ -379,55 +384,55 @@ const PRIMES_BY_BITS: &[&[u64]] = &[ ]; const PRIMES64: &[u64] = &[ - 18446744073709551557, - 18446744073709551533, - 18446744073709551521, - 18446744073709551437, - 18446744073709551427, - 18446744073709551359, - 18446744073709551337, - 18446744073709551293, - 18446744073709551263, - 18446744073709551253, - 18446744073709551191, - 18446744073709551163, - 18446744073709551113, - 18446744073709550873, - 18446744073709550791, - 18446744073709550773, - 18446744073709550771, - 18446744073709550719, - 18446744073709550717, - 18446744073709550681, - 18446744073709550671, - 18446744073709550593, - 18446744073709550591, - 18446744073709550539, - 18446744073709550537, - 18446744073709550381, - 18446744073709550341, - 18446744073709550293, - 18446744073709550237, - 18446744073709550147, - 18446744073709550141, - 18446744073709550129, - 18446744073709550111, - 18446744073709550099, - 18446744073709550047, - 18446744073709550033, - 18446744073709550009, - 18446744073709549951, - 18446744073709549861, - 18446744073709549817, - 18446744073709549811, - 18446744073709549777, - 18446744073709549757, - 18446744073709549733, - 18446744073709549667, - 18446744073709549621, - 18446744073709549613, - 18446744073709549583, - 18446744073709549571, + 18_446_744_073_709_551_557, + 18_446_744_073_709_551_533, + 18_446_744_073_709_551_521, + 18_446_744_073_709_551_437, + 18_446_744_073_709_551_427, + 18_446_744_073_709_551_359, + 18_446_744_073_709_551_337, + 18_446_744_073_709_551_293, + 18_446_744_073_709_551_263, + 18_446_744_073_709_551_253, + 18_446_744_073_709_551_191, + 18_446_744_073_709_551_163, + 18_446_744_073_709_551_113, + 18_446_744_073_709_550_873, + 18_446_744_073_709_550_791, + 18_446_744_073_709_550_773, + 18_446_744_073_709_550_771, + 18_446_744_073_709_550_719, + 18_446_744_073_709_550_717, + 18_446_744_073_709_550_681, + 18_446_744_073_709_550_671, + 18_446_744_073_709_550_593, + 18_446_744_073_709_550_591, + 18_446_744_073_709_550_539, + 18_446_744_073_709_550_537, + 18_446_744_073_709_550_381, + 18_446_744_073_709_550_341, + 18_446_744_073_709_550_293, + 18_446_744_073_709_550_237, + 18_446_744_073_709_550_147, + 18_446_744_073_709_550_141, + 18_446_744_073_709_550_129, + 18_446_744_073_709_550_111, + 18_446_744_073_709_550_099, + 18_446_744_073_709_550_047, + 18_446_744_073_709_550_033, + 18_446_744_073_709_550_009, + 18_446_744_073_709_549_951, + 18_446_744_073_709_549_861, + 18_446_744_073_709_549_817, + 18_446_744_073_709_549_811, + 18_446_744_073_709_549_777, + 18_446_744_073_709_549_757, + 18_446_744_073_709_549_733, + 18_446_744_073_709_549_667, + 18_446_744_073_709_549_621, + 18_446_744_073_709_549_613, + 18_446_744_073_709_549_583, + 18_446_744_073_709_549_571, ]; const PRIMES14: &[u64] = &[ @@ -464,801 +469,1113 @@ const PRIMES16: &[u64] = &[ ]; const PRIMES17: &[u64] = &[ - 131071, 131063, 131059, 131041, 131023, 131011, 131009, 130987, 130981, 130973, 130969, 130957, - 130927, 130873, 130859, 130843, 130841, 130829, 130817, 130811, 130807, 130787, 130783, 130769, - 130729, 130699, 130693, 130687, 130681, 130657, 130651, 130649, 130643, 130639, 130633, 130631, - 130621, 130619, 130589, 130579, 130553, 130547, 130531, 130523, 130517, 130513, 130489, 130483, - 130477, 130469, 130457, 130447, 130439, 130423, 130411, 130409, 130399, 130379, 130369, 130367, - 130363, 130349, 130343, 130337, 130307, 130303, 130279, 130267, 130261, 130259, 130253, 130241, - 130223, 130211, 130201, 130199, 130183, 130171, 130147, 130127, 130121, 130099, 130087, 130079, - 130073, 130069, 130057, 130051, + 131_071, 131_063, 131_059, 131_041, 131_023, 131_011, 131_009, 130_987, 130_981, 130_973, + 130_969, 130_957, 130_927, 130_873, 130_859, 130_843, 130_841, 130_829, 130_817, 130_811, + 130_807, 130_787, 130_783, 130_769, 130_729, 130_699, 130_693, 130_687, 130_681, 130_657, + 130_651, 130_649, 130_643, 130_639, 130_633, 130_631, 130_621, 130_619, 130_589, 130_579, + 130_553, 130_547, 130_531, 130_523, 130_517, 130_513, 130_489, 130_483, 130_477, 130_469, + 130_457, 130_447, 130_439, 130_423, 130_411, 130_409, 130_399, 130_379, 130_369, 130_367, + 130_363, 130_349, 130_343, 130_337, 130_307, 130_303, 130_279, 130_267, 130_261, 130_259, + 130_253, 130_241, 130_223, 130_211, 130_201, 130_199, 130_183, 130_171, 130_147, 130_127, + 130_121, 130_099, 130_087, 130_079, 130_073, 130_069, 130_057, 130_051, ]; const PRIMES18: &[u64] = &[ - 262139, 262133, 262127, 262121, 262111, 262109, 262103, 262079, 262069, 262051, 262049, 262027, - 262007, 261983, 261977, 261973, 261971, 261959, 261917, 261887, 261881, 261847, 261823, 261799, - 261791, 261787, 261773, 261761, 261757, 261739, 261721, 261713, 261707, 261697, 261673, 261643, - 261641, 261637, 261631, 261619, 261601, 261593, 261587, 261581, 261577, 261563, 261557, 261529, - 261523, 261509, 261467, 261463, 261451, 261439, 261433, 261431, 261427, 261407, 261389, 261379, - 261353, 261347, 261337, 261329, 261323, 261301, 261281, 261271, 261251, 261241, 261229, 261223, - 261169, 261167, 261127, + 262_139, 262_133, 262_127, 262_121, 262_111, 262_109, 262_103, 262_079, 262_069, 262_051, + 262_049, 262_027, 262_007, 261_983, 261_977, 261_973, 261_971, 261_959, 261_917, 261_887, + 261_881, 261_847, 261_823, 261_799, 261_791, 261_787, 261_773, 261_761, 261_757, 261_739, + 261_721, 261_713, 261_707, 261_697, 261_673, 261_643, 261_641, 261_637, 261_631, 261_619, + 261_601, 261_593, 261_587, 261_581, 261_577, 261_563, 261_557, 261_529, 261_523, 261_509, + 261_467, 261_463, 261_451, 261_439, 261_433, 261_431, 261_427, 261_407, 261_389, 261_379, + 261_353, 261_347, 261_337, 261_329, 261_323, 261_301, 261_281, 261_271, 261_251, 261_241, + 261_229, 261_223, 261_169, 261_167, 261_127, ]; const PRIMES19: &[u64] = &[ - 524287, 524269, 524261, 524257, 524243, 524231, 524221, 524219, 524203, 524201, 524197, 524189, - 524171, 524149, 524123, 524119, 524113, 524099, 524087, 524081, 524071, 524063, 524057, 524053, - 524047, 523997, 523987, 523969, 523949, 523937, 523927, 523907, 523903, 523877, 523867, 523847, - 523829, 523801, 523793, 523777, 523771, 523763, 523759, 523741, 523729, 523717, 523681, 523673, - 523669, 523667, 523657, 523639, 523637, 523631, 523603, 523597, 523577, 523573, 523571, 523553, - 523543, 523541, 523519, 523511, 523493, 523489, 523487, 523463, 523459, 523433, 523427, 523417, - 523403, 523387, 523357, 523351, 523349, 523333, 523307, 523297, + 524_287, 524_269, 524_261, 524_257, 524_243, 524_231, 524_221, 524_219, 524_203, 524_201, + 524_197, 524_189, 524_171, 524_149, 524_123, 524_119, 524_113, 524_099, 524_087, 524_081, + 524_071, 524_063, 524_057, 524_053, 524_047, 523_997, 523_987, 523_969, 523_949, 523_937, + 523_927, 523_907, 523_903, 523_877, 523_867, 523_847, 523_829, 523_801, 523_793, 523_777, + 523_771, 523_763, 523_759, 523_741, 523_729, 523_717, 523_681, 523_673, 523_669, 523_667, + 523_657, 523_639, 523_637, 523_631, 523_603, 523_597, 523_577, 523_573, 523_571, 523_553, + 523_543, 523_541, 523_519, 523_511, 523_493, 523_489, 523_487, 523_463, 523_459, 523_433, + 523_427, 523_417, 523_403, 523_387, 523_357, 523_351, 523_349, 523_333, 523_307, 523_297, ]; const PRIMES20: &[u64] = &[ - 1048573, 1048571, 1048559, 1048549, 1048517, 1048507, 1048447, 1048433, 1048423, 1048391, - 1048387, 1048367, 1048361, 1048357, 1048343, 1048309, 1048291, 1048273, 1048261, 1048219, - 1048217, 1048213, 1048193, 1048189, 1048139, 1048129, 1048127, 1048123, 1048063, 1048051, - 1048049, 1048043, 1048027, 1048013, 1048009, 1048007, 1047997, 1047989, 1047979, 1047971, - 1047961, 1047941, 1047929, 1047923, 1047887, 1047883, 1047881, 1047859, 1047841, 1047833, - 1047821, 1047779, 1047773, 1047763, 1047751, 1047737, 1047721, 1047713, 1047703, 1047701, - 1047691, 1047689, 1047671, 1047667, 1047653, 1047649, 1047647, 1047589, 1047587, 1047559, + 1_048_573, 1_048_571, 1_048_559, 1_048_549, 1_048_517, 1_048_507, 1_048_447, 1_048_433, + 1_048_423, 1_048_391, 1_048_387, 1_048_367, 1_048_361, 1_048_357, 1_048_343, 1_048_309, + 1_048_291, 1_048_273, 1_048_261, 1_048_219, 1_048_217, 1_048_213, 1_048_193, 1_048_189, + 1_048_139, 1_048_129, 1_048_127, 1_048_123, 1_048_063, 1_048_051, 1_048_049, 1_048_043, + 1_048_027, 1_048_013, 1_048_009, 1_048_007, 1_047_997, 1_047_989, 1_047_979, 1_047_971, + 1_047_961, 1_047_941, 1_047_929, 1_047_923, 1_047_887, 1_047_883, 1_047_881, 1_047_859, + 1_047_841, 1_047_833, 1_047_821, 1_047_779, 1_047_773, 1_047_763, 1_047_751, 1_047_737, + 1_047_721, 1_047_713, 1_047_703, 1_047_701, 1_047_691, 1_047_689, 1_047_671, 1_047_667, + 1_047_653, 1_047_649, 1_047_647, 1_047_589, 1_047_587, 1_047_559, ]; const PRIMES21: &[u64] = &[ - 2097143, 2097133, 2097131, 2097097, 2097091, 2097083, 2097047, 2097041, 2097031, 2097023, - 2097013, 2096993, 2096987, 2096971, 2096959, 2096957, 2096947, 2096923, 2096911, 2096909, - 2096893, 2096881, 2096873, 2096867, 2096851, 2096837, 2096807, 2096791, 2096789, 2096777, - 2096761, 2096741, 2096737, 2096713, 2096693, 2096687, 2096681, 2096639, 2096629, 2096621, - 2096599, 2096597, 2096569, 2096539, 2096533, 2096483, 2096449, 2096431, 2096429, 2096411, - 2096407, 2096401, 2096399, 2096377, 2096357, 2096291, 2096273, 2096261, 2096233, 2096231, - 2096221, 2096209, 2096191, 2096183, 2096147, + 2_097_143, 2_097_133, 2_097_131, 2_097_097, 2_097_091, 2_097_083, 2_097_047, 2_097_041, + 2_097_031, 2_097_023, 2_097_013, 2_096_993, 2_096_987, 2_096_971, 2_096_959, 2_096_957, + 2_096_947, 2_096_923, 2_096_911, 2_096_909, 2_096_893, 2_096_881, 2_096_873, 2_096_867, + 2_096_851, 2_096_837, 2_096_807, 2_096_791, 2_096_789, 2_096_777, 2_096_761, 2_096_741, + 2_096_737, 2_096_713, 2_096_693, 2_096_687, 2_096_681, 2_096_639, 2_096_629, 2_096_621, + 2_096_599, 2_096_597, 2_096_569, 2_096_539, 2_096_533, 2_096_483, 2_096_449, 2_096_431, + 2_096_429, 2_096_411, 2_096_407, 2_096_401, 2_096_399, 2_096_377, 2_096_357, 2_096_291, + 2_096_273, 2_096_261, 2_096_233, 2_096_231, 2_096_221, 2_096_209, 2_096_191, 2_096_183, + 2_096_147, ]; const PRIMES22: &[u64] = &[ - 4194301, 4194287, 4194277, 4194271, 4194247, 4194217, 4194199, 4194191, 4194187, 4194181, - 4194173, 4194167, 4194143, 4194137, 4194131, 4194107, 4194103, 4194023, 4194011, 4194007, - 4193977, 4193971, 4193963, 4193957, 4193939, 4193929, 4193909, 4193869, 4193807, 4193803, - 4193801, 4193789, 4193759, 4193753, 4193743, 4193701, 4193663, 4193633, 4193573, 4193569, - 4193551, 4193549, 4193531, 4193513, 4193507, 4193459, 4193447, 4193443, 4193417, 4193411, - 4193393, 4193389, 4193381, 4193377, 4193369, 4193359, 4193353, 4193327, 4193309, 4193303, - 4193297, + 4_194_301, 4_194_287, 4_194_277, 4_194_271, 4_194_247, 4_194_217, 4_194_199, 4_194_191, + 4_194_187, 4_194_181, 4_194_173, 4_194_167, 4_194_143, 4_194_137, 4_194_131, 4_194_107, + 4_194_103, 4_194_023, 4_194_011, 4_194_007, 4_193_977, 4_193_971, 4_193_963, 4_193_957, + 4_193_939, 4_193_929, 4_193_909, 4_193_869, 4_193_807, 4_193_803, 4_193_801, 4_193_789, + 4_193_759, 4_193_753, 4_193_743, 4_193_701, 4_193_663, 4_193_633, 4_193_573, 4_193_569, + 4_193_551, 4_193_549, 4_193_531, 4_193_513, 4_193_507, 4_193_459, 4_193_447, 4_193_443, + 4_193_417, 4_193_411, 4_193_393, 4_193_389, 4_193_381, 4_193_377, 4_193_369, 4_193_359, + 4_193_353, 4_193_327, 4_193_309, 4_193_303, 4_193_297, ]; const PRIMES23: &[u64] = &[ - 8388593, 8388587, 8388581, 8388571, 8388547, 8388539, 8388473, 8388461, 8388451, 8388449, - 8388439, 8388427, 8388421, 8388409, 8388377, 8388371, 8388319, 8388301, 8388287, 8388283, - 8388277, 8388239, 8388209, 8388187, 8388113, 8388109, 8388091, 8388071, 8388059, 8388019, - 8388013, 8387999, 8387993, 8387959, 8387957, 8387947, 8387933, 8387921, 8387917, 8387891, - 8387879, 8387867, 8387861, 8387857, 8387839, 8387831, 8387809, 8387807, 8387741, 8387737, - 8387723, 8387707, 8387671, 8387611, 8387609, 8387591, + 8_388_593, 8_388_587, 8_388_581, 8_388_571, 8_388_547, 8_388_539, 8_388_473, 8_388_461, + 8_388_451, 8_388_449, 8_388_439, 8_388_427, 8_388_421, 8_388_409, 8_388_377, 8_388_371, + 8_388_319, 8_388_301, 8_388_287, 8_388_283, 8_388_277, 8_388_239, 8_388_209, 8_388_187, + 8_388_113, 8_388_109, 8_388_091, 8_388_071, 8_388_059, 8_388_019, 8_388_013, 8_387_999, + 8_387_993, 8_387_959, 8_387_957, 8_387_947, 8_387_933, 8_387_921, 8_387_917, 8_387_891, + 8_387_879, 8_387_867, 8_387_861, 8_387_857, 8_387_839, 8_387_831, 8_387_809, 8_387_807, + 8_387_741, 8_387_737, 8_387_723, 8_387_707, 8_387_671, 8_387_611, 8_387_609, 8_387_591, ]; const PRIMES24: &[u64] = &[ - 16777213, 16777199, 16777183, 16777153, 16777141, 16777139, 16777127, 16777121, 16777099, - 16777049, 16777027, 16776989, 16776973, 16776971, 16776967, 16776961, 16776941, 16776937, - 16776931, 16776919, 16776901, 16776899, 16776869, 16776857, 16776839, 16776833, 16776817, - 16776763, 16776731, 16776719, 16776713, 16776691, 16776689, 16776679, 16776659, 16776631, - 16776623, 16776619, 16776607, 16776593, 16776581, 16776547, 16776521, 16776491, 16776481, - 16776469, 16776451, 16776401, 16776391, 16776379, 16776371, 16776367, 16776343, 16776337, - 16776317, 16776313, 16776289, 16776217, 16776211, + 16_777_213, 16_777_199, 16_777_183, 16_777_153, 16_777_141, 16_777_139, 16_777_127, 16_777_121, + 16_777_099, 16_777_049, 16_777_027, 16_776_989, 16_776_973, 16_776_971, 16_776_967, 16_776_961, + 16_776_941, 16_776_937, 16_776_931, 16_776_919, 16_776_901, 16_776_899, 16_776_869, 16_776_857, + 16_776_839, 16_776_833, 16_776_817, 16_776_763, 16_776_731, 16_776_719, 16_776_713, 16_776_691, + 16_776_689, 16_776_679, 16_776_659, 16_776_631, 16_776_623, 16_776_619, 16_776_607, 16_776_593, + 16_776_581, 16_776_547, 16_776_521, 16_776_491, 16_776_481, 16_776_469, 16_776_451, 16_776_401, + 16_776_391, 16_776_379, 16_776_371, 16_776_367, 16_776_343, 16_776_337, 16_776_317, 16_776_313, + 16_776_289, 16_776_217, 16_776_211, ]; const PRIMES25: &[u64] = &[ - 33554393, 33554383, 33554371, 33554347, 33554341, 33554317, 33554291, 33554273, 33554267, - 33554249, 33554239, 33554221, 33554201, 33554167, 33554159, 33554137, 33554123, 33554093, - 33554083, 33554077, 33554051, 33554021, 33554011, 33554009, 33553999, 33553991, 33553969, - 33553967, 33553909, 33553901, 33553879, 33553837, 33553799, 33553787, 33553771, 33553769, - 33553759, 33553747, 33553739, 33553727, 33553697, 33553693, 33553679, 33553661, 33553657, - 33553651, 33553649, 33553633, 33553613, 33553607, 33553577, 33553549, 33553547, 33553537, - 33553519, 33553517, 33553511, 33553489, 33553463, 33553451, 33553417, + 33_554_393, 33_554_383, 33_554_371, 33_554_347, 33_554_341, 33_554_317, 33_554_291, 33_554_273, + 33_554_267, 33_554_249, 33_554_239, 33_554_221, 33_554_201, 33_554_167, 33_554_159, 33_554_137, + 33_554_123, 33_554_093, 33_554_083, 33_554_077, 33_554_051, 33_554_021, 33_554_011, 33_554_009, + 33_553_999, 33_553_991, 33_553_969, 33_553_967, 33_553_909, 33_553_901, 33_553_879, 33_553_837, + 33_553_799, 33_553_787, 33_553_771, 33_553_769, 33_553_759, 33_553_747, 33_553_739, 33_553_727, + 33_553_697, 33_553_693, 33_553_679, 33_553_661, 33_553_657, 33_553_651, 33_553_649, 33_553_633, + 33_553_613, 33_553_607, 33_553_577, 33_553_549, 33_553_547, 33_553_537, 33_553_519, 33_553_517, + 33_553_511, 33_553_489, 33_553_463, 33_553_451, 33_553_417, ]; const PRIMES26: &[u64] = &[ - 67108859, 67108837, 67108819, 67108777, 67108763, 67108757, 67108753, 67108747, 67108739, - 67108729, 67108721, 67108709, 67108693, 67108669, 67108667, 67108661, 67108649, 67108633, - 67108597, 67108579, 67108529, 67108511, 67108507, 67108493, 67108471, 67108463, 67108453, - 67108439, 67108387, 67108373, 67108369, 67108351, 67108331, 67108313, 67108303, 67108289, - 67108271, 67108219, 67108207, 67108201, 67108199, 67108187, 67108183, 67108177, 67108127, - 67108109, 67108081, 67108049, 67108039, 67108037, 67108033, 67108009, 67108007, 67108003, - 67107983, 67107977, 67107967, 67107941, 67107919, 67107913, 67107883, 67107881, 67107871, - 67107863, + 67_108_859, 67_108_837, 67_108_819, 67_108_777, 67_108_763, 67_108_757, 67_108_753, 67_108_747, + 67_108_739, 67_108_729, 67_108_721, 67_108_709, 67_108_693, 67_108_669, 67_108_667, 67_108_661, + 67_108_649, 67_108_633, 67_108_597, 67_108_579, 67_108_529, 67_108_511, 67_108_507, 67_108_493, + 67_108_471, 67_108_463, 67_108_453, 67_108_439, 67_108_387, 67_108_373, 67_108_369, 67_108_351, + 67_108_331, 67_108_313, 67_108_303, 67_108_289, 67_108_271, 67_108_219, 67_108_207, 67_108_201, + 67_108_199, 67_108_187, 67_108_183, 67_108_177, 67_108_127, 67_108_109, 67_108_081, 67_108_049, + 67_108_039, 67_108_037, 67_108_033, 67_108_009, 67_108_007, 67_108_003, 67_107_983, 67_107_977, + 67_107_967, 67_107_941, 67_107_919, 67_107_913, 67_107_883, 67_107_881, 67_107_871, 67_107_863, ]; const PRIMES27: &[u64] = &[ - 134217689, 134217649, 134217617, 134217613, 134217593, 134217541, 134217529, 134217509, - 134217497, 134217493, 134217487, 134217467, 134217439, 134217437, 134217409, 134217403, - 134217401, 134217367, 134217361, 134217353, 134217323, 134217301, 134217277, 134217257, - 134217247, 134217221, 134217199, 134217173, 134217163, 134217157, 134217131, 134217103, - 134217089, 134217079, 134217049, 134217047, 134217043, 134217001, 134216987, 134216947, - 134216939, 134216933, 134216911, 134216899, 134216881, 134216869, 134216867, 134216861, - 134216837, 134216827, 134216807, 134216801, 134216791, 134216783, 134216777, 134216759, - 134216737, 134216729, + 134_217_689, + 134_217_649, + 134_217_617, + 134_217_613, + 134_217_593, + 134_217_541, + 134_217_529, + 134_217_509, + 134_217_497, + 134_217_493, + 134_217_487, + 134_217_467, + 134_217_439, + 134_217_437, + 134_217_409, + 134_217_403, + 134_217_401, + 134_217_367, + 134_217_361, + 134_217_353, + 134_217_323, + 134_217_301, + 134_217_277, + 134_217_257, + 134_217_247, + 134_217_221, + 134_217_199, + 134_217_173, + 134_217_163, + 134_217_157, + 134_217_131, + 134_217_103, + 134_217_089, + 134_217_079, + 134_217_049, + 134_217_047, + 134_217_043, + 134_217_001, + 134_216_987, + 134_216_947, + 134_216_939, + 134_216_933, + 134_216_911, + 134_216_899, + 134_216_881, + 134_216_869, + 134_216_867, + 134_216_861, + 134_216_837, + 134_216_827, + 134_216_807, + 134_216_801, + 134_216_791, + 134_216_783, + 134_216_777, + 134_216_759, + 134_216_737, + 134_216_729, ]; const PRIMES28: &[u64] = &[ - 268435399, 268435367, 268435361, 268435337, 268435331, 268435313, 268435291, 268435273, - 268435243, 268435183, 268435171, 268435157, 268435147, 268435133, 268435129, 268435121, - 268435109, 268435091, 268435067, 268435043, 268435039, 268435033, 268435019, 268435009, - 268435007, 268434997, 268434979, 268434977, 268434961, 268434949, 268434941, 268434937, - 268434857, 268434841, 268434827, 268434821, 268434787, 268434781, 268434779, 268434773, - 268434731, 268434721, 268434713, 268434707, 268434703, 268434697, 268434659, 268434623, - 268434619, 268434581, 268434577, 268434563, 268434557, 268434547, 268434511, 268434499, - 268434479, 268434461, + 268_435_399, + 268_435_367, + 268_435_361, + 268_435_337, + 268_435_331, + 268_435_313, + 268_435_291, + 268_435_273, + 268_435_243, + 268_435_183, + 268_435_171, + 268_435_157, + 268_435_147, + 268_435_133, + 268_435_129, + 268_435_121, + 268_435_109, + 268_435_091, + 268_435_067, + 268_435_043, + 268_435_039, + 268_435_033, + 268_435_019, + 268_435_009, + 268_435_007, + 268_434_997, + 268_434_979, + 268_434_977, + 268_434_961, + 268_434_949, + 268_434_941, + 268_434_937, + 268_434_857, + 268_434_841, + 268_434_827, + 268_434_821, + 268_434_787, + 268_434_781, + 268_434_779, + 268_434_773, + 268_434_731, + 268_434_721, + 268_434_713, + 268_434_707, + 268_434_703, + 268_434_697, + 268_434_659, + 268_434_623, + 268_434_619, + 268_434_581, + 268_434_577, + 268_434_563, + 268_434_557, + 268_434_547, + 268_434_511, + 268_434_499, + 268_434_479, + 268_434_461, ]; const PRIMES29: &[u64] = &[ - 536870909, 536870879, 536870869, 536870849, 536870839, 536870837, 536870819, 536870813, - 536870791, 536870779, 536870767, 536870743, 536870729, 536870723, 536870717, 536870701, - 536870683, 536870657, 536870641, 536870627, 536870611, 536870603, 536870599, 536870573, - 536870569, 536870563, 536870561, 536870513, 536870501, 536870497, 536870473, 536870401, - 536870363, 536870317, 536870303, 536870297, 536870273, 536870267, 536870239, 536870233, - 536870219, 536870171, 536870167, 536870153, 536870123, 536870063, 536870057, 536870041, - 536870027, 536869999, 536869951, 536869943, 536869937, 536869919, 536869901, 536869891, + 536_870_909, + 536_870_879, + 536_870_869, + 536_870_849, + 536_870_839, + 536_870_837, + 536_870_819, + 536_870_813, + 536_870_791, + 536_870_779, + 536_870_767, + 536_870_743, + 536_870_729, + 536_870_723, + 536_870_717, + 536_870_701, + 536_870_683, + 536_870_657, + 536_870_641, + 536_870_627, + 536_870_611, + 536_870_603, + 536_870_599, + 536_870_573, + 536_870_569, + 536_870_563, + 536_870_561, + 536_870_513, + 536_870_501, + 536_870_497, + 536_870_473, + 536_870_401, + 536_870_363, + 536_870_317, + 536_870_303, + 536_870_297, + 536_870_273, + 536_870_267, + 536_870_239, + 536_870_233, + 536_870_219, + 536_870_171, + 536_870_167, + 536_870_153, + 536_870_123, + 536_870_063, + 536_870_057, + 536_870_041, + 536_870_027, + 536_869_999, + 536_869_951, + 536_869_943, + 536_869_937, + 536_869_919, + 536_869_901, + 536_869_891, ]; const PRIMES30: &[u64] = &[ - 1073741789, 1073741783, 1073741741, 1073741723, 1073741719, 1073741717, 1073741689, 1073741671, - 1073741663, 1073741651, 1073741621, 1073741567, 1073741561, 1073741527, 1073741503, 1073741477, - 1073741467, 1073741441, 1073741419, 1073741399, 1073741387, 1073741381, 1073741371, 1073741329, - 1073741311, 1073741309, 1073741287, 1073741237, 1073741213, 1073741197, 1073741189, 1073741173, - 1073741101, 1073741077, 1073741047, 1073740963, 1073740951, 1073740933, 1073740909, 1073740879, - 1073740853, 1073740847, 1073740819, 1073740807, + 1_073_741_789, + 1_073_741_783, + 1_073_741_741, + 1_073_741_723, + 1_073_741_719, + 1_073_741_717, + 1_073_741_689, + 1_073_741_671, + 1_073_741_663, + 1_073_741_651, + 1_073_741_621, + 1_073_741_567, + 1_073_741_561, + 1_073_741_527, + 1_073_741_503, + 1_073_741_477, + 1_073_741_467, + 1_073_741_441, + 1_073_741_419, + 1_073_741_399, + 1_073_741_387, + 1_073_741_381, + 1_073_741_371, + 1_073_741_329, + 1_073_741_311, + 1_073_741_309, + 1_073_741_287, + 1_073_741_237, + 1_073_741_213, + 1_073_741_197, + 1_073_741_189, + 1_073_741_173, + 1_073_741_101, + 1_073_741_077, + 1_073_741_047, + 1_073_740_963, + 1_073_740_951, + 1_073_740_933, + 1_073_740_909, + 1_073_740_879, + 1_073_740_853, + 1_073_740_847, + 1_073_740_819, + 1_073_740_807, ]; const PRIMES31: &[u64] = &[ - 2147483647, 2147483629, 2147483587, 2147483579, 2147483563, 2147483549, 2147483543, 2147483497, - 2147483489, 2147483477, 2147483423, 2147483399, 2147483353, 2147483323, 2147483269, 2147483249, - 2147483237, 2147483179, 2147483171, 2147483137, 2147483123, 2147483077, 2147483069, 2147483059, - 2147483053, 2147483033, 2147483029, 2147482951, 2147482949, 2147482943, 2147482937, 2147482921, - 2147482877, 2147482873, 2147482867, 2147482859, 2147482819, 2147482817, 2147482811, 2147482801, - 2147482763, 2147482739, 2147482697, 2147482693, 2147482681, 2147482663, 2147482661, + 2_147_483_647, + 2_147_483_629, + 2_147_483_587, + 2_147_483_579, + 2_147_483_563, + 2_147_483_549, + 2_147_483_543, + 2_147_483_497, + 2_147_483_489, + 2_147_483_477, + 2_147_483_423, + 2_147_483_399, + 2_147_483_353, + 2_147_483_323, + 2_147_483_269, + 2_147_483_249, + 2_147_483_237, + 2_147_483_179, + 2_147_483_171, + 2_147_483_137, + 2_147_483_123, + 2_147_483_077, + 2_147_483_069, + 2_147_483_059, + 2_147_483_053, + 2_147_483_033, + 2_147_483_029, + 2_147_482_951, + 2_147_482_949, + 2_147_482_943, + 2_147_482_937, + 2_147_482_921, + 2_147_482_877, + 2_147_482_873, + 2_147_482_867, + 2_147_482_859, + 2_147_482_819, + 2_147_482_817, + 2_147_482_811, + 2_147_482_801, + 2_147_482_763, + 2_147_482_739, + 2_147_482_697, + 2_147_482_693, + 2_147_482_681, + 2_147_482_663, + 2_147_482_661, ]; const PRIMES32: &[u64] = &[ - 4294967291, 4294967279, 4294967231, 4294967197, 4294967189, 4294967161, 4294967143, 4294967111, - 4294967087, 4294967029, 4294966997, 4294966981, 4294966943, 4294966927, 4294966909, 4294966877, - 4294966829, 4294966813, 4294966769, 4294966667, 4294966661, 4294966657, 4294966651, 4294966639, - 4294966619, 4294966591, 4294966583, 4294966553, 4294966477, 4294966447, 4294966441, 4294966427, - 4294966373, 4294966367, 4294966337, 4294966297, + 4_294_967_291, + 4_294_967_279, + 4_294_967_231, + 4_294_967_197, + 4_294_967_189, + 4_294_967_161, + 4_294_967_143, + 4_294_967_111, + 4_294_967_087, + 4_294_967_029, + 4_294_966_997, + 4_294_966_981, + 4_294_966_943, + 4_294_966_927, + 4_294_966_909, + 4_294_966_877, + 4_294_966_829, + 4_294_966_813, + 4_294_966_769, + 4_294_966_667, + 4_294_966_661, + 4_294_966_657, + 4_294_966_651, + 4_294_966_639, + 4_294_966_619, + 4_294_966_591, + 4_294_966_583, + 4_294_966_553, + 4_294_966_477, + 4_294_966_447, + 4_294_966_441, + 4_294_966_427, + 4_294_966_373, + 4_294_966_367, + 4_294_966_337, + 4_294_966_297, ]; const PRIMES33: &[u64] = &[ - 8589934583, 8589934567, 8589934543, 8589934513, 8589934487, 8589934307, 8589934291, 8589934289, - 8589934271, 8589934237, 8589934211, 8589934207, 8589934201, 8589934187, 8589934151, 8589934141, - 8589934139, 8589934117, 8589934103, 8589934099, 8589934091, 8589934069, 8589934049, 8589934027, - 8589934007, 8589933973, 8589933971, 8589933967, 8589933931, 8589933917, 8589933907, 8589933853, - 8589933827, 8589933823, 8589933787, 8589933773, 8589933733, 8589933731, 8589933721, 8589933683, - 8589933647, 8589933641, 8589933637, 8589933631, 8589933629, 8589933619, 8589933601, 8589933581, + 8_589_934_583, + 8_589_934_567, + 8_589_934_543, + 8_589_934_513, + 8_589_934_487, + 8_589_934_307, + 8_589_934_291, + 8_589_934_289, + 8_589_934_271, + 8_589_934_237, + 8_589_934_211, + 8_589_934_207, + 8_589_934_201, + 8_589_934_187, + 8_589_934_151, + 8_589_934_141, + 8_589_934_139, + 8_589_934_117, + 8_589_934_103, + 8_589_934_099, + 8_589_934_091, + 8_589_934_069, + 8_589_934_049, + 8_589_934_027, + 8_589_934_007, + 8_589_933_973, + 8_589_933_971, + 8_589_933_967, + 8_589_933_931, + 8_589_933_917, + 8_589_933_907, + 8_589_933_853, + 8_589_933_827, + 8_589_933_823, + 8_589_933_787, + 8_589_933_773, + 8_589_933_733, + 8_589_933_731, + 8_589_933_721, + 8_589_933_683, + 8_589_933_647, + 8_589_933_641, + 8_589_933_637, + 8_589_933_631, + 8_589_933_629, + 8_589_933_619, + 8_589_933_601, + 8_589_933_581, ]; const PRIMES34: &[u64] = &[ - 17179869143, - 17179869107, - 17179869071, - 17179869053, - 17179869041, - 17179869019, - 17179868999, - 17179868977, - 17179868957, - 17179868903, - 17179868899, - 17179868887, - 17179868879, - 17179868873, - 17179868869, - 17179868861, - 17179868843, - 17179868833, - 17179868809, - 17179868807, - 17179868777, - 17179868759, - 17179868729, - 17179868711, - 17179868683, - 17179868681, - 17179868597, - 17179868549, - 17179868543, - 17179868521, - 17179868513, - 17179868479, - 17179868443, - 17179868437, - 17179868429, - 17179868383, - 17179868369, - 17179868357, - 17179868353, - 17179868351, - 17179868333, - 17179868317, - 17179868309, - 17179868297, - 17179868287, - 17179868249, - 17179868243, - 17179868183, + 17_179_869_143, + 17_179_869_107, + 17_179_869_071, + 17_179_869_053, + 17_179_869_041, + 17_179_869_019, + 17_179_868_999, + 17_179_868_977, + 17_179_868_957, + 17_179_868_903, + 17_179_868_899, + 17_179_868_887, + 17_179_868_879, + 17_179_868_873, + 17_179_868_869, + 17_179_868_861, + 17_179_868_843, + 17_179_868_833, + 17_179_868_809, + 17_179_868_807, + 17_179_868_777, + 17_179_868_759, + 17_179_868_729, + 17_179_868_711, + 17_179_868_683, + 17_179_868_681, + 17_179_868_597, + 17_179_868_549, + 17_179_868_543, + 17_179_868_521, + 17_179_868_513, + 17_179_868_479, + 17_179_868_443, + 17_179_868_437, + 17_179_868_429, + 17_179_868_383, + 17_179_868_369, + 17_179_868_357, + 17_179_868_353, + 17_179_868_351, + 17_179_868_333, + 17_179_868_317, + 17_179_868_309, + 17_179_868_297, + 17_179_868_287, + 17_179_868_249, + 17_179_868_243, + 17_179_868_183, ]; const PRIMES35: &[u64] = &[ - 34359738337, - 34359738319, - 34359738307, - 34359738299, - 34359738289, - 34359738247, - 34359738227, - 34359738121, - 34359738059, - 34359738043, - 34359738011, - 34359737917, - 34359737869, - 34359737849, - 34359737837, - 34359737821, - 34359737813, - 34359737791, - 34359737777, - 34359737771, - 34359737717, - 34359737591, - 34359737567, - 34359737549, - 34359737519, - 34359737497, - 34359737479, - 34359737407, - 34359737393, - 34359737371, + 34_359_738_337, + 34_359_738_319, + 34_359_738_307, + 34_359_738_299, + 34_359_738_289, + 34_359_738_247, + 34_359_738_227, + 34_359_738_121, + 34_359_738_059, + 34_359_738_043, + 34_359_738_011, + 34_359_737_917, + 34_359_737_869, + 34_359_737_849, + 34_359_737_837, + 34_359_737_821, + 34_359_737_813, + 34_359_737_791, + 34_359_737_777, + 34_359_737_771, + 34_359_737_717, + 34_359_737_591, + 34_359_737_567, + 34_359_737_549, + 34_359_737_519, + 34_359_737_497, + 34_359_737_479, + 34_359_737_407, + 34_359_737_393, + 34_359_737_371, ]; const PRIMES36: &[u64] = &[ - 68719476731, - 68719476719, - 68719476713, - 68719476671, - 68719476619, - 68719476599, - 68719476577, - 68719476563, - 68719476547, - 68719476503, - 68719476493, - 68719476479, - 68719476433, - 68719476407, - 68719476391, - 68719476389, - 68719476377, - 68719476361, - 68719476323, - 68719476307, - 68719476281, - 68719476271, - 68719476257, - 68719476247, - 68719476209, - 68719476197, - 68719476181, - 68719476169, - 68719476157, - 68719476149, - 68719476109, - 68719476053, - 68719476047, - 68719476019, - 68719475977, - 68719475947, - 68719475933, - 68719475911, - 68719475893, - 68719475879, - 68719475837, - 68719475827, - 68719475809, - 68719475791, - 68719475779, - 68719475771, - 68719475767, - 68719475731, - 68719475729, + 68_719_476_731, + 68_719_476_719, + 68_719_476_713, + 68_719_476_671, + 68_719_476_619, + 68_719_476_599, + 68_719_476_577, + 68_719_476_563, + 68_719_476_547, + 68_719_476_503, + 68_719_476_493, + 68_719_476_479, + 68_719_476_433, + 68_719_476_407, + 68_719_476_391, + 68_719_476_389, + 68_719_476_377, + 68_719_476_361, + 68_719_476_323, + 68_719_476_307, + 68_719_476_281, + 68_719_476_271, + 68_719_476_257, + 68_719_476_247, + 68_719_476_209, + 68_719_476_197, + 68_719_476_181, + 68_719_476_169, + 68_719_476_157, + 68_719_476_149, + 68_719_476_109, + 68_719_476_053, + 68_719_476_047, + 68_719_476_019, + 68_719_475_977, + 68_719_475_947, + 68_719_475_933, + 68_719_475_911, + 68_719_475_893, + 68_719_475_879, + 68_719_475_837, + 68_719_475_827, + 68_719_475_809, + 68_719_475_791, + 68_719_475_779, + 68_719_475_771, + 68_719_475_767, + 68_719_475_731, + 68_719_475_729, ]; const PRIMES37: &[u64] = &[ - 137438953447, - 137438953441, - 137438953427, - 137438953403, - 137438953349, - 137438953331, - 137438953273, - 137438953271, - 137438953121, - 137438953097, - 137438953037, - 137438953009, - 137438952953, - 137438952901, - 137438952887, - 137438952869, - 137438952853, - 137438952731, - 137438952683, - 137438952611, - 137438952529, - 137438952503, - 137438952491, + 137_438_953_447, + 137_438_953_441, + 137_438_953_427, + 137_438_953_403, + 137_438_953_349, + 137_438_953_331, + 137_438_953_273, + 137_438_953_271, + 137_438_953_121, + 137_438_953_097, + 137_438_953_037, + 137_438_953_009, + 137_438_952_953, + 137_438_952_901, + 137_438_952_887, + 137_438_952_869, + 137_438_952_853, + 137_438_952_731, + 137_438_952_683, + 137_438_952_611, + 137_438_952_529, + 137_438_952_503, + 137_438_952_491, ]; const PRIMES38: &[u64] = &[ - 274877906899, - 274877906857, - 274877906837, - 274877906813, - 274877906791, - 274877906759, - 274877906753, - 274877906717, - 274877906713, - 274877906687, - 274877906647, - 274877906629, - 274877906627, - 274877906573, - 274877906543, - 274877906491, - 274877906477, - 274877906473, - 274877906431, - 274877906419, - 274877906341, - 274877906333, - 274877906327, - 274877906321, - 274877906309, - 274877906267, - 274877906243, - 274877906213, - 274877906209, - 274877906203, - 274877906179, - 274877906167, - 274877906119, - 274877906063, - 274877906053, - 274877906021, - 274877905931, + 274_877_906_899, + 274_877_906_857, + 274_877_906_837, + 274_877_906_813, + 274_877_906_791, + 274_877_906_759, + 274_877_906_753, + 274_877_906_717, + 274_877_906_713, + 274_877_906_687, + 274_877_906_647, + 274_877_906_629, + 274_877_906_627, + 274_877_906_573, + 274_877_906_543, + 274_877_906_491, + 274_877_906_477, + 274_877_906_473, + 274_877_906_431, + 274_877_906_419, + 274_877_906_341, + 274_877_906_333, + 274_877_906_327, + 274_877_906_321, + 274_877_906_309, + 274_877_906_267, + 274_877_906_243, + 274_877_906_213, + 274_877_906_209, + 274_877_906_203, + 274_877_906_179, + 274_877_906_167, + 274_877_906_119, + 274_877_906_063, + 274_877_906_053, + 274_877_906_021, + 274_877_905_931, ]; const PRIMES39: &[u64] = &[ - 549755813881, - 549755813869, - 549755813821, - 549755813797, - 549755813753, - 549755813723, - 549755813669, - 549755813657, - 549755813647, - 549755813587, - 549755813561, - 549755813513, - 549755813507, - 549755813461, - 549755813417, - 549755813401, - 549755813371, - 549755813359, - 549755813357, - 549755813351, - 549755813339, - 549755813317, - 549755813311, - 549755813281, - 549755813239, - 549755813231, - 549755813213, - 549755813207, - 549755813197, - 549755813183, - 549755813161, - 549755813149, - 549755813147, - 549755813143, - 549755813141, - 549755813059, - 549755813027, - 549755813003, - 549755812951, - 549755812937, - 549755812933, - 549755812889, - 549755812867, + 549_755_813_881, + 549_755_813_869, + 549_755_813_821, + 549_755_813_797, + 549_755_813_753, + 549_755_813_723, + 549_755_813_669, + 549_755_813_657, + 549_755_813_647, + 549_755_813_587, + 549_755_813_561, + 549_755_813_513, + 549_755_813_507, + 549_755_813_461, + 549_755_813_417, + 549_755_813_401, + 549_755_813_371, + 549_755_813_359, + 549_755_813_357, + 549_755_813_351, + 549_755_813_339, + 549_755_813_317, + 549_755_813_311, + 549_755_813_281, + 549_755_813_239, + 549_755_813_231, + 549_755_813_213, + 549_755_813_207, + 549_755_813_197, + 549_755_813_183, + 549_755_813_161, + 549_755_813_149, + 549_755_813_147, + 549_755_813_143, + 549_755_813_141, + 549_755_813_059, + 549_755_813_027, + 549_755_813_003, + 549_755_812_951, + 549_755_812_937, + 549_755_812_933, + 549_755_812_889, + 549_755_812_867, ]; const PRIMES40: &[u64] = &[ - 1099511627689, - 1099511627609, - 1099511627581, - 1099511627573, - 1099511627563, - 1099511627491, - 1099511627483, - 1099511627477, - 1099511627387, - 1099511627339, - 1099511627321, - 1099511627309, - 1099511627297, - 1099511627293, - 1099511627261, - 1099511627213, - 1099511627191, - 1099511627177, - 1099511627173, - 1099511627143, - 1099511627089, - 1099511626987, - 1099511626949, - 1099511626937, - 1099511626793, - 1099511626781, - 1099511626771, + 1_099_511_627_689, + 1_099_511_627_609, + 1_099_511_627_581, + 1_099_511_627_573, + 1_099_511_627_563, + 1_099_511_627_491, + 1_099_511_627_483, + 1_099_511_627_477, + 1_099_511_627_387, + 1_099_511_627_339, + 1_099_511_627_321, + 1_099_511_627_309, + 1_099_511_627_297, + 1_099_511_627_293, + 1_099_511_627_261, + 1_099_511_627_213, + 1_099_511_627_191, + 1_099_511_627_177, + 1_099_511_627_173, + 1_099_511_627_143, + 1_099_511_627_089, + 1_099_511_626_987, + 1_099_511_626_949, + 1_099_511_626_937, + 1_099_511_626_793, + 1_099_511_626_781, + 1_099_511_626_771, ]; const PRIMES41: &[u64] = &[ - 2199023255531, - 2199023255521, - 2199023255497, - 2199023255489, - 2199023255479, - 2199023255477, - 2199023255461, - 2199023255441, - 2199023255419, - 2199023255413, - 2199023255357, - 2199023255327, - 2199023255291, - 2199023255279, - 2199023255267, - 2199023255243, - 2199023255203, - 2199023255171, - 2199023255137, - 2199023255101, - 2199023255087, - 2199023255081, - 2199023255069, - 2199023255027, - 2199023255021, - 2199023254979, - 2199023254933, - 2199023254913, - 2199023254907, - 2199023254903, - 2199023254843, - 2199023254787, - 2199023254699, - 2199023254693, - 2199023254657, - 2199023254567, + 2_199_023_255_531, + 2_199_023_255_521, + 2_199_023_255_497, + 2_199_023_255_489, + 2_199_023_255_479, + 2_199_023_255_477, + 2_199_023_255_461, + 2_199_023_255_441, + 2_199_023_255_419, + 2_199_023_255_413, + 2_199_023_255_357, + 2_199_023_255_327, + 2_199_023_255_291, + 2_199_023_255_279, + 2_199_023_255_267, + 2_199_023_255_243, + 2_199_023_255_203, + 2_199_023_255_171, + 2_199_023_255_137, + 2_199_023_255_101, + 2_199_023_255_087, + 2_199_023_255_081, + 2_199_023_255_069, + 2_199_023_255_027, + 2_199_023_255_021, + 2_199_023_254_979, + 2_199_023_254_933, + 2_199_023_254_913, + 2_199_023_254_907, + 2_199_023_254_903, + 2_199_023_254_843, + 2_199_023_254_787, + 2_199_023_254_699, + 2_199_023_254_693, + 2_199_023_254_657, + 2_199_023_254_567, ]; const PRIMES42: &[u64] = &[ - 4398046511093, - 4398046511087, - 4398046511071, - 4398046511051, - 4398046511039, - 4398046510961, - 4398046510943, - 4398046510939, - 4398046510889, - 4398046510877, - 4398046510829, - 4398046510787, - 4398046510771, - 4398046510751, - 4398046510733, - 4398046510721, - 4398046510643, - 4398046510639, - 4398046510597, - 4398046510577, - 4398046510547, - 4398046510531, - 4398046510463, - 4398046510397, - 4398046510391, - 4398046510379, - 4398046510357, - 4398046510331, - 4398046510327, - 4398046510313, - 4398046510283, - 4398046510279, - 4398046510217, - 4398046510141, - 4398046510133, - 4398046510103, - 4398046510093, + 4_398_046_511_093, + 4_398_046_511_087, + 4_398_046_511_071, + 4_398_046_511_051, + 4_398_046_511_039, + 4_398_046_510_961, + 4_398_046_510_943, + 4_398_046_510_939, + 4_398_046_510_889, + 4_398_046_510_877, + 4_398_046_510_829, + 4_398_046_510_787, + 4_398_046_510_771, + 4_398_046_510_751, + 4_398_046_510_733, + 4_398_046_510_721, + 4_398_046_510_643, + 4_398_046_510_639, + 4_398_046_510_597, + 4_398_046_510_577, + 4_398_046_510_547, + 4_398_046_510_531, + 4_398_046_510_463, + 4_398_046_510_397, + 4_398_046_510_391, + 4_398_046_510_379, + 4_398_046_510_357, + 4_398_046_510_331, + 4_398_046_510_327, + 4_398_046_510_313, + 4_398_046_510_283, + 4_398_046_510_279, + 4_398_046_510_217, + 4_398_046_510_141, + 4_398_046_510_133, + 4_398_046_510_103, + 4_398_046_510_093, ]; const PRIMES43: &[u64] = &[ - 8796093022151, - 8796093022141, - 8796093022091, - 8796093022033, - 8796093021953, - 8796093021941, - 8796093021917, - 8796093021899, - 8796093021889, - 8796093021839, - 8796093021803, - 8796093021791, - 8796093021769, - 8796093021763, - 8796093021743, - 8796093021671, - 8796093021607, - 8796093021587, - 8796093021533, - 8796093021523, - 8796093021517, - 8796093021493, - 8796093021467, - 8796093021461, - 8796093021449, - 8796093021409, - 8796093021407, - 8796093021371, - 8796093021347, - 8796093021337, - 8796093021281, - 8796093021269, + 8_796_093_022_151, + 8_796_093_022_141, + 8_796_093_022_091, + 8_796_093_022_033, + 8_796_093_021_953, + 8_796_093_021_941, + 8_796_093_021_917, + 8_796_093_021_899, + 8_796_093_021_889, + 8_796_093_021_839, + 8_796_093_021_803, + 8_796_093_021_791, + 8_796_093_021_769, + 8_796_093_021_763, + 8_796_093_021_743, + 8_796_093_021_671, + 8_796_093_021_607, + 8_796_093_021_587, + 8_796_093_021_533, + 8_796_093_021_523, + 8_796_093_021_517, + 8_796_093_021_493, + 8_796_093_021_467, + 8_796_093_021_461, + 8_796_093_021_449, + 8_796_093_021_409, + 8_796_093_021_407, + 8_796_093_021_371, + 8_796_093_021_347, + 8_796_093_021_337, + 8_796_093_021_281, + 8_796_093_021_269, ]; const PRIMES44: &[u64] = &[ - 17592186044399, - 17592186044299, - 17592186044297, - 17592186044287, - 17592186044273, - 17592186044267, - 17592186044129, - 17592186044089, - 17592186044057, - 17592186044039, - 17592186043987, - 17592186043921, - 17592186043889, - 17592186043877, - 17592186043841, - 17592186043829, - 17592186043819, - 17592186043813, - 17592186043807, - 17592186043741, - 17592186043693, - 17592186043667, - 17592186043631, - 17592186043591, - 17592186043577, - 17592186043547, - 17592186043483, - 17592186043451, - 17592186043433, - 17592186043409, + 17_592_186_044_399, + 17_592_186_044_299, + 17_592_186_044_297, + 17_592_186_044_287, + 17_592_186_044_273, + 17_592_186_044_267, + 17_592_186_044_129, + 17_592_186_044_089, + 17_592_186_044_057, + 17_592_186_044_039, + 17_592_186_043_987, + 17_592_186_043_921, + 17_592_186_043_889, + 17_592_186_043_877, + 17_592_186_043_841, + 17_592_186_043_829, + 17_592_186_043_819, + 17_592_186_043_813, + 17_592_186_043_807, + 17_592_186_043_741, + 17_592_186_043_693, + 17_592_186_043_667, + 17_592_186_043_631, + 17_592_186_043_591, + 17_592_186_043_577, + 17_592_186_043_547, + 17_592_186_043_483, + 17_592_186_043_451, + 17_592_186_043_433, + 17_592_186_043_409, ]; const PRIMES45: &[u64] = &[ - 35184372088777, - 35184372088763, - 35184372088751, - 35184372088739, - 35184372088711, - 35184372088699, - 35184372088693, - 35184372088673, - 35184372088639, - 35184372088603, - 35184372088571, - 35184372088517, - 35184372088493, - 35184372088471, - 35184372088403, - 35184372088391, - 35184372088379, - 35184372088363, - 35184372088321, - 35184372088319, - 35184372088279, - 35184372088259, - 35184372088249, - 35184372088241, - 35184372088223, - 35184372088183, - 35184372088097, - 35184372088081, - 35184372088079, - 35184372088051, - 35184372088043, - 35184372088039, - 35184372087937, - 35184372087929, - 35184372087923, - 35184372087881, - 35184372087877, - 35184372087869, + 35_184_372_088_777, + 35_184_372_088_763, + 35_184_372_088_751, + 35_184_372_088_739, + 35_184_372_088_711, + 35_184_372_088_699, + 35_184_372_088_693, + 35_184_372_088_673, + 35_184_372_088_639, + 35_184_372_088_603, + 35_184_372_088_571, + 35_184_372_088_517, + 35_184_372_088_493, + 35_184_372_088_471, + 35_184_372_088_403, + 35_184_372_088_391, + 35_184_372_088_379, + 35_184_372_088_363, + 35_184_372_088_321, + 35_184_372_088_319, + 35_184_372_088_279, + 35_184_372_088_259, + 35_184_372_088_249, + 35_184_372_088_241, + 35_184_372_088_223, + 35_184_372_088_183, + 35_184_372_088_097, + 35_184_372_088_081, + 35_184_372_088_079, + 35_184_372_088_051, + 35_184_372_088_043, + 35_184_372_088_039, + 35_184_372_087_937, + 35_184_372_087_929, + 35_184_372_087_923, + 35_184_372_087_881, + 35_184_372_087_877, + 35_184_372_087_869, ]; const PRIMES46: &[u64] = &[ - 70368744177643, - 70368744177607, - 70368744177601, - 70368744177587, - 70368744177497, - 70368744177467, - 70368744177427, - 70368744177377, - 70368744177359, - 70368744177353, - 70368744177331, - 70368744177289, - 70368744177283, - 70368744177271, - 70368744177257, - 70368744177227, - 70368744177167, - 70368744177113, - 70368744177029, - 70368744176959, - 70368744176921, - 70368744176909, - 70368744176879, - 70368744176867, - 70368744176833, - 70368744176827, - 70368744176807, - 70368744176779, - 70368744176777, - 70368744176729, - 70368744176719, - 70368744176711, + 70_368_744_177_643, + 70_368_744_177_607, + 70_368_744_177_601, + 70_368_744_177_587, + 70_368_744_177_497, + 70_368_744_177_467, + 70_368_744_177_427, + 70_368_744_177_377, + 70_368_744_177_359, + 70_368_744_177_353, + 70_368_744_177_331, + 70_368_744_177_289, + 70_368_744_177_283, + 70_368_744_177_271, + 70_368_744_177_257, + 70_368_744_177_227, + 70_368_744_177_167, + 70_368_744_177_113, + 70_368_744_177_029, + 70_368_744_176_959, + 70_368_744_176_921, + 70_368_744_176_909, + 70_368_744_176_879, + 70_368_744_176_867, + 70_368_744_176_833, + 70_368_744_176_827, + 70_368_744_176_807, + 70_368_744_176_779, + 70_368_744_176_777, + 70_368_744_176_729, + 70_368_744_176_719, + 70_368_744_176_711, ]; const PRIMES47: &[u64] = &[ - 140737488355213, - 140737488355201, - 140737488355181, - 140737488355049, - 140737488355031, - 140737488354989, - 140737488354893, - 140737488354787, - 140737488354709, - 140737488354679, - 140737488354613, - 140737488354557, - 140737488354511, - 140737488354431, - 140737488354413, - 140737488354409, - 140737488354373, - 140737488354347, - 140737488354329, + 140_737_488_355_213, + 140_737_488_355_201, + 140_737_488_355_181, + 140_737_488_355_049, + 140_737_488_355_031, + 140_737_488_354_989, + 140_737_488_354_893, + 140_737_488_354_787, + 140_737_488_354_709, + 140_737_488_354_679, + 140_737_488_354_613, + 140_737_488_354_557, + 140_737_488_354_511, + 140_737_488_354_431, + 140_737_488_354_413, + 140_737_488_354_409, + 140_737_488_354_373, + 140_737_488_354_347, + 140_737_488_354_329, ]; const PRIMES48: &[u64] = &[ - 281474976710597, - 281474976710591, - 281474976710567, - 281474976710563, - 281474976710509, - 281474976710491, - 281474976710467, - 281474976710423, - 281474976710413, - 281474976710399, - 281474976710339, - 281474976710327, - 281474976710287, - 281474976710197, - 281474976710143, - 281474976710131, - 281474976710129, - 281474976710107, - 281474976710089, - 281474976710087, - 281474976710029, - 281474976709987, - 281474976709891, - 281474976709859, - 281474976709831, - 281474976709757, - 281474976709741, - 281474976709711, - 281474976709649, - 281474976709637, + 281_474_976_710_597, + 281_474_976_710_591, + 281_474_976_710_567, + 281_474_976_710_563, + 281_474_976_710_509, + 281_474_976_710_491, + 281_474_976_710_467, + 281_474_976_710_423, + 281_474_976_710_413, + 281_474_976_710_399, + 281_474_976_710_339, + 281_474_976_710_327, + 281_474_976_710_287, + 281_474_976_710_197, + 281_474_976_710_143, + 281_474_976_710_131, + 281_474_976_710_129, + 281_474_976_710_107, + 281_474_976_710_089, + 281_474_976_710_087, + 281_474_976_710_029, + 281_474_976_709_987, + 281_474_976_709_891, + 281_474_976_709_859, + 281_474_976_709_831, + 281_474_976_709_757, + 281_474_976_709_741, + 281_474_976_709_711, + 281_474_976_709_649, + 281_474_976_709_637, ]; const PRIMES49: &[u64] = &[ - 562949953421231, - 562949953421201, - 562949953421189, - 562949953421173, - 562949953421131, - 562949953421111, - 562949953421099, - 562949953421047, - 562949953421029, - 562949953420973, - 562949953420871, - 562949953420867, - 562949953420837, - 562949953420793, - 562949953420747, - 562949953420741, - 562949953420733, - 562949953420727, - 562949953420609, - 562949953420571, - 562949953420559, - 562949953420553, - 562949953420523, - 562949953420507, - 562949953420457, - 562949953420403, - 562949953420373, - 562949953420369, - 562949953420343, - 562949953420303, - 562949953420297, + 562_949_953_421_231, + 562_949_953_421_201, + 562_949_953_421_189, + 562_949_953_421_173, + 562_949_953_421_131, + 562_949_953_421_111, + 562_949_953_421_099, + 562_949_953_421_047, + 562_949_953_421_029, + 562_949_953_420_973, + 562_949_953_420_871, + 562_949_953_420_867, + 562_949_953_420_837, + 562_949_953_420_793, + 562_949_953_420_747, + 562_949_953_420_741, + 562_949_953_420_733, + 562_949_953_420_727, + 562_949_953_420_609, + 562_949_953_420_571, + 562_949_953_420_559, + 562_949_953_420_553, + 562_949_953_420_523, + 562_949_953_420_507, + 562_949_953_420_457, + 562_949_953_420_403, + 562_949_953_420_373, + 562_949_953_420_369, + 562_949_953_420_343, + 562_949_953_420_303, + 562_949_953_420_297, ]; const PRIMES50: &[u64] = &[ - 1125899906842597, - 1125899906842589, - 1125899906842573, - 1125899906842553, - 1125899906842511, - 1125899906842507, - 1125899906842493, - 1125899906842463, - 1125899906842429, - 1125899906842391, - 1125899906842357, - 1125899906842283, - 1125899906842273, - 1125899906842247, - 1125899906842201, - 1125899906842177, - 1125899906842079, - 1125899906842033, - 1125899906842021, - 1125899906842013, - 1125899906841973, - 1125899906841971, - 1125899906841959, - 1125899906841949, - 1125899906841943, - 1125899906841917, - 1125899906841901, - 1125899906841883, - 1125899906841859, - 1125899906841811, - 1125899906841803, - 1125899906841751, - 1125899906841713, - 1125899906841673, - 1125899906841653, - 1125899906841623, - 1125899906841613, + 1_125_899_906_842_597, + 1_125_899_906_842_589, + 1_125_899_906_842_573, + 1_125_899_906_842_553, + 1_125_899_906_842_511, + 1_125_899_906_842_507, + 1_125_899_906_842_493, + 1_125_899_906_842_463, + 1_125_899_906_842_429, + 1_125_899_906_842_391, + 1_125_899_906_842_357, + 1_125_899_906_842_283, + 1_125_899_906_842_273, + 1_125_899_906_842_247, + 1_125_899_906_842_201, + 1_125_899_906_842_177, + 1_125_899_906_842_079, + 1_125_899_906_842_033, + 1_125_899_906_842_021, + 1_125_899_906_842_013, + 1_125_899_906_841_973, + 1_125_899_906_841_971, + 1_125_899_906_841_959, + 1_125_899_906_841_949, + 1_125_899_906_841_943, + 1_125_899_906_841_917, + 1_125_899_906_841_901, + 1_125_899_906_841_883, + 1_125_899_906_841_859, + 1_125_899_906_841_811, + 1_125_899_906_841_803, + 1_125_899_906_841_751, + 1_125_899_906_841_713, + 1_125_899_906_841_673, + 1_125_899_906_841_653, + 1_125_899_906_841_623, + 1_125_899_906_841_613, ]; #[test] diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index 070ed011e..c4f60e82d 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -16,11 +16,12 @@ fn test_invalid_arg() { #[test] #[cfg(unix)] +#[allow(unused_mut)] fn test_id_no_specified_user() { let ts = TestScenario::new(util_name!()); let result = ts.ucmd().run(); let exp_result = unwrap_or_return!(expected_result(&ts, &[])); - let mut _exp_stdout = exp_result.stdout_str().to_string(); + let mut exp_stdout = exp_result.stdout_str().to_string(); #[cfg(not(feature = "feat_selinux"))] { @@ -29,12 +30,12 @@ fn test_id_no_specified_user() { // uid=1001(runner) gid=121(docker) groups=121(docker),4(adm),101(systemd-journal) \ // context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 if let Some(context_offset) = exp_result.stdout_str().find(" context=") { - _exp_stdout.replace_range(context_offset.._exp_stdout.len() - 1, ""); + exp_stdout.replace_range(context_offset..exp_stdout.len() - 1, ""); } } result - .stdout_is(_exp_stdout) + .stdout_is(exp_stdout) .stderr_is(exp_result.stderr_str()) .code_is(exp_result.code()); } diff --git a/tests/by-util/test_kill.rs b/tests/by-util/test_kill.rs index 3915a7090..e07def513 100644 --- a/tests/by-util/test_kill.rs +++ b/tests/by-util/test_kill.rs @@ -98,7 +98,7 @@ fn test_kill_table_lists_all_vertically() { let signals = command .stdout_str() .split('\n') - .flat_map(|line| line.trim().split(' ').nth(1)) + .filter_map(|line| line.trim().split(' ').nth(1)) .collect::>(); assert!(signals.contains(&"KILL")); diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index b315630ce..36baef640 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -2,6 +2,8 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +#![allow(clippy::similar_names)] + use crate::common::util::TestScenario; use std::path::PathBuf; diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index cf73ba5d6..d9f21d8dc 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -3,6 +3,11 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // spell-checker:ignore (words) READMECAREFULLY birthtime doesntexist oneline somebackup lrwx somefile somegroup somehiddenbackup somehiddenfile tabsize aaaaaaaa bbbb cccc dddddddd ncccc neee naaaaa nbcdef nfffff dired subdired tmpfs mdir COLORTERM mexe bcdef mfoo +#![allow( + clippy::similar_names, + clippy::too_many_lines, + clippy::cast_possible_truncation +)] #[cfg(any(unix, feature = "feat_selinux"))] use crate::common::util::expected_result; @@ -160,7 +165,7 @@ fn get_filesystem_type(scene: &TestScenario, path: &Path) -> String { let output = cmd.succeeds(); let stdout_str = String::from_utf8_lossy(output.stdout()); println!("output of stat call ({cmd:?}):\n{stdout_str}"); - let regex_str = r#"Filesystem\s+Type\s+.+[\r\n]+([^\s]+)\s+(?[^\s]+)\s+"#; + let regex_str = r"Filesystem\s+Type\s+.+[\r\n]+([^\s]+)\s+(?[^\s]+)\s+"; let regex = Regex::new(regex_str).unwrap(); let m = regex.captures(&stdout_str).unwrap(); let fstype = m["fstype"].to_owned(); @@ -1150,6 +1155,7 @@ fn test_ls_long_padding_of_size_column_with_multiple_files() { #[cfg(all(feature = "ln", feature = "mkdir", feature = "touch"))] #[test] #[cfg(all(feature = "ln", feature = "mkdir", feature = "touch"))] +#[allow(clippy::items_after_statements)] fn test_ls_long_symlink_color() { // If you break this test after breaking mkdir, touch, or ln, do not be alarmed! // This test is made for ls, but it attempts to run those utils in the process. @@ -1378,7 +1384,7 @@ fn test_ls_long_symlink_color() { /// This test is for "ls -l --color=auto|--color=always" /// We use "--color=always" as the colors are the same regardless of the color option being "auto" or "always" -/// tests whether the specific color of the target and the dangling_symlink are equal and checks +/// tests whether the specific color of the target and the `dangling_symlink` are equal and checks /// whether checks whether ls outputs the correct path for the symlink and the file it points to and applies the color code to it. #[test] fn test_ls_long_dangling_symlink_color() { diff --git a/tests/by-util/test_mkdir.rs b/tests/by-util/test_mkdir.rs index 04d392220..9547f63b9 100644 --- a/tests/by-util/test_mkdir.rs +++ b/tests/by-util/test_mkdir.rs @@ -2,6 +2,8 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +#![allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)] + use crate::common::util::TestScenario; #[cfg(not(windows))] use libc::mode_t; diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index 20a23bb6e..5703c4371 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -560,8 +560,8 @@ fn test_dec_offset() { #[test] fn test_no_offset() { - let input = [0u8; 31]; const LINE: &str = " 00000000 00000000 00000000 00000000\n"; + let input = [0u8; 31]; let expected_output = [LINE, LINE, LINE, LINE].join(""); new_ucmd!() diff --git a/tests/by-util/test_paste.rs b/tests/by-util/test_paste.rs index 0fbdb75d2..f39193094 100644 --- a/tests/by-util/test_paste.rs +++ b/tests/by-util/test_paste.rs @@ -167,9 +167,9 @@ fn test_delimiter_list_ending_with_escaped_backslash() { for d in ["-d", "--delimiters"] { let (at, mut ucmd) = at_and_ucmd!(); let mut ins = vec![]; - for (i, _in) in ["a\n", "b\n"].iter().enumerate() { + for (i, one_in) in ["a\n", "b\n"].iter().enumerate() { let file = format!("in{}", i); - at.write(&file, _in); + at.write(&file, one_in); ins.push(file); } ucmd.args(&[d, "\\\\"]) @@ -198,9 +198,9 @@ fn test_data() { for example in EXAMPLE_DATA { let (at, mut ucmd) = at_and_ucmd!(); let mut ins = vec![]; - for (i, _in) in example.ins.iter().enumerate() { + for (i, one_in) in example.ins.iter().enumerate() { let file = format!("in{i}"); - at.write(&file, _in); + at.write(&file, one_in); ins.push(file); } println!("{}", example.name); diff --git a/tests/by-util/test_rm.rs b/tests/by-util/test_rm.rs index 65d631e4c..8a9021c75 100644 --- a/tests/by-util/test_rm.rs +++ b/tests/by-util/test_rm.rs @@ -2,6 +2,8 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +#![allow(clippy::stable_sort_primitive)] + use std::process::Stdio; use crate::common::util::TestScenario; diff --git a/tests/by-util/test_shuf.rs b/tests/by-util/test_shuf.rs index 3208eadb4..40ece0f13 100644 --- a/tests/by-util/test_shuf.rs +++ b/tests/by-util/test_shuf.rs @@ -106,7 +106,7 @@ fn test_very_large_range() { .collect(); assert_eq!(result_seq.len(), num_samples, "Miscounted output length!"); assert!( - result_seq.iter().all(|x| (0..=1234567890).contains(x)), + result_seq.iter().all(|x| (0..=1_234_567_890).contains(x)), "Output includes element not from range: {}", result.stdout_str() ); @@ -132,7 +132,7 @@ fn test_very_large_range_offset() { assert!( result_seq .iter() - .all(|x| (1234567890..=2147483647).contains(x)), + .all(|x| (1_234_567_890..=2_147_483_647).contains(x)), "Output includes element not from range: {}", result.stdout_str() ); @@ -234,7 +234,13 @@ fn test_range_permute_no_overflow_0_max() { #[test] fn test_very_high_range_full() { let input_seq = vec![ - 2147483641, 2147483642, 2147483643, 2147483644, 2147483645, 2147483646, 2147483647, + 2_147_483_641, + 2_147_483_642, + 2_147_483_643, + 2_147_483_644, + 2_147_483_645, + 2_147_483_646, + 2_147_483_647, ]; let result = new_ucmd!().arg("-i2147483641-2147483647").succeeds(); result.no_stderr(); @@ -320,7 +326,7 @@ fn test_echo_multi() { .stdout_str() .split('\n') .filter(|x| !x.is_empty()) - .map(|x| x.into()) + .map(std::convert::Into::into) .collect(); result_seq.sort_unstable(); assert_eq!(result_seq, ["a", "b", "c"], "Output is not a permutation"); @@ -335,7 +341,7 @@ fn test_echo_postfix() { .stdout_str() .split('\n') .filter(|x| !x.is_empty()) - .map(|x| x.into()) + .map(std::convert::Into::into) .collect(); result_seq.sort_unstable(); assert_eq!(result_seq, ["a", "b", "c"], "Output is not a permutation"); diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index a37a01ec6..7308f243a 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -4,6 +4,7 @@ // file that was distributed with this source code. // spell-checker:ignore (words) ints +#![allow(clippy::cast_possible_wrap)] use std::time::Duration; diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 189b1d441..0efb82c9a 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -160,9 +160,7 @@ fn test_symlinks() { ts.ucmd().args(&args).succeeds().stdout_is(expected_stdout); } } - if !tested { - panic!("No symlink found to test in this environment"); - } + assert!(tested, "No symlink found to test in this environment"); } #[cfg(any(target_os = "linux", target_os = "android", target_vendor = "apple"))] diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 1df5eade9..e7207b7da 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -6,8 +6,13 @@ // spell-checker:ignore (ToDO) abcdefghijklmnopqrstuvwxyz efghijklmnopqrstuvwxyz vwxyz emptyfile file siette ocho nueve diez MULT // spell-checker:ignore (libs) kqueue // spell-checker:ignore (jargon) tailable untailable datasame runneradmin tmpi +#![allow( + clippy::unicode_not_nfc, + clippy::cast_lossless, + clippy::cast_possible_truncation +)] -use crate::common::random::{AlphanumericNewline, RandomString}; +use crate::common::random::{AlphanumericNewline, RandomizedString}; #[cfg(unix)] use crate::common::util::expected_result; #[cfg(not(windows))] @@ -192,12 +197,12 @@ fn test_nc_0_wo_follow() { #[test] #[cfg(all(unix, not(target_os = "freebsd")))] fn test_nc_0_wo_follow2() { + use std::os::unix::fs::PermissionsExt; // verify that -[nc]0 without -f, exit without reading let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; - use std::os::unix::fs::PermissionsExt; at.make_file("unreadable") .set_permissions(PermissionsExt::from_mode(0o000)) .unwrap(); @@ -220,10 +225,11 @@ fn test_nc_0_wo_follow2() { #[test] #[cfg(unix)] fn test_permission_denied() { + use std::os::unix::fs::PermissionsExt; + let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; - use std::os::unix::fs::PermissionsExt; at.make_file("unreadable") .set_permissions(PermissionsExt::from_mode(0o000)) .unwrap(); @@ -240,13 +246,14 @@ fn test_permission_denied() { #[test] #[cfg(unix)] fn test_permission_denied_multiple() { + use std::os::unix::fs::PermissionsExt; + let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; at.touch("file1"); at.touch("file2"); - use std::os::unix::fs::PermissionsExt; at.make_file("unreadable") .set_permissions(PermissionsExt::from_mode(0o000)) .unwrap(); @@ -2804,7 +2811,7 @@ fn test_pipe_when_lines_option_given_multibyte_utf8_characters() { #[test] fn test_pipe_when_lines_option_given_input_size_is_equal_to_buffer_size_no_newline_at_eof() { let total_lines = 1; - let random_string = RandomString::generate_with_delimiter( + let random_string = RandomizedString::generate_with_delimiter( Alphanumeric, b'\n', total_lines, @@ -2834,7 +2841,7 @@ fn test_pipe_when_lines_option_given_input_size_is_equal_to_buffer_size_no_newli #[test] fn test_pipe_when_lines_option_given_input_size_is_equal_to_buffer_size() { let total_lines = 100; - let random_string = RandomString::generate_with_delimiter( + let random_string = RandomizedString::generate_with_delimiter( Alphanumeric, b'\n', total_lines, @@ -2894,7 +2901,7 @@ fn test_pipe_when_lines_option_given_input_size_is_equal_to_buffer_size() { #[test] fn test_pipe_when_lines_option_given_input_size_is_one_byte_greater_than_buffer_size() { let total_lines = 100; - let random_string = RandomString::generate_with_delimiter( + let random_string = RandomizedString::generate_with_delimiter( Alphanumeric, b'\n', total_lines, @@ -2942,7 +2949,7 @@ fn test_pipe_when_lines_option_given_input_size_is_one_byte_greater_than_buffer_ #[cfg(not(target_os = "windows"))] fn test_pipe_when_lines_option_given_input_size_has_multiple_size_of_buffer_size() { let total_lines = 100; - let random_string = RandomString::generate_with_delimiter( + let random_string = RandomizedString::generate_with_delimiter( Alphanumeric, b'\n', total_lines, @@ -3134,7 +3141,7 @@ fn test_pipe_when_bytes_option_given_multibyte_utf8_characters() { #[test] fn test_pipe_when_bytes_option_given_input_size_is_equal_to_buffer_size() { - let random_string = RandomString::generate(AlphanumericNewline, CHUNK_BUFFER_SIZE); + let random_string = RandomizedString::generate(AlphanumericNewline, CHUNK_BUFFER_SIZE); let random_string = random_string.as_str(); new_ucmd!() @@ -3193,7 +3200,7 @@ fn test_pipe_when_bytes_option_given_input_size_is_equal_to_buffer_size() { #[test] fn test_pipe_when_bytes_option_given_input_size_is_one_byte_greater_than_buffer_size() { - let random_string = RandomString::generate(AlphanumericNewline, CHUNK_BUFFER_SIZE + 1); + let random_string = RandomizedString::generate(AlphanumericNewline, CHUNK_BUFFER_SIZE + 1); let random_string = random_string.as_str(); new_ucmd!() @@ -3248,7 +3255,7 @@ fn test_pipe_when_bytes_option_given_input_size_is_one_byte_greater_than_buffer_ #[test] #[cfg(not(target_os = "windows"))] fn test_pipe_when_bytes_option_given_input_size_has_multiple_size_of_buffer_size() { - let random_string = RandomString::generate(AlphanumericNewline, CHUNK_BUFFER_SIZE * 3); + let random_string = RandomizedString::generate(AlphanumericNewline, CHUNK_BUFFER_SIZE * 3); let random_string = random_string.as_str(); new_ucmd!() @@ -3364,7 +3371,7 @@ fn test_seek_bytes_forward_outside_file() { #[cfg(all(not(target_os = "android"), not(target_os = "windows")))] // FIXME: #[test] fn test_args_when_presume_input_pipe_given_input_is_pipe() { - let random_string = RandomString::generate(AlphanumericNewline, 1000); + let random_string = RandomizedString::generate(AlphanumericNewline, 1000); let random_string = random_string.as_str(); new_ucmd!() @@ -3400,7 +3407,7 @@ fn test_args_when_presume_input_pipe_given_input_is_pipe() { #[test] fn test_args_when_presume_input_pipe_given_input_is_file() { - let random_string = RandomString::generate(AlphanumericNewline, 1000); + let random_string = RandomizedString::generate(AlphanumericNewline, 1000); let random_string = random_string.as_str(); let ts = TestScenario::new(util_name!()); @@ -3481,7 +3488,7 @@ fn test_when_argument_file_is_a_symlink() { .no_stdout() .no_stderr(); - let random_string = RandomString::generate(AlphanumericNewline, 100); + let random_string = RandomizedString::generate(AlphanumericNewline, 100); let result = file.write_all(random_string.as_bytes()); assert!(result.is_ok()); @@ -3593,7 +3600,7 @@ fn test_when_argument_file_is_non_existent_unix_socket_address_then_error() { let path = "file"; let mut file = at.make_file(path); - let random_string = RandomString::generate(AlphanumericNewline, 100); + let random_string = RandomizedString::generate(AlphanumericNewline, 100); let result = file.write_all(random_string.as_bytes()); assert!(result.is_ok()); diff --git a/tests/by-util/test_tee.rs b/tests/by-util/test_tee.rs index f3c678b2a..c32759ed4 100644 --- a/tests/by-util/test_tee.rs +++ b/tests/by-util/test_tee.rs @@ -2,6 +2,8 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +#![allow(clippy::borrow_as_ptr)] + use crate::common::util::TestScenario; use regex::Regex; #[cfg(target_os = "linux")] diff --git a/tests/by-util/test_test.rs b/tests/by-util/test_test.rs index 1999634ef..c5e06d4c8 100644 --- a/tests/by-util/test_test.rs +++ b/tests/by-util/test_test.rs @@ -677,9 +677,6 @@ fn test_file_not_owned_by_euid() { #[test] #[cfg(not(windows))] fn test_file_owned_by_egid() { - let scene = TestScenario::new(util_name!()); - let at = &scene.fixtures; - // On some platforms (mostly the BSDs) the test fixture files copied to the // /tmp directory will have a different gid than the current egid (due to // the sticky bit set on the /tmp directory). Fix this before running the @@ -688,15 +685,17 @@ fn test_file_owned_by_egid() { use std::os::unix::ffi::OsStrExt; use std::os::unix::fs::MetadataExt; use uucore::process::getegid; + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; let metadata = at.metadata("regular_file"); let file_gid = metadata.gid(); let user_gid = getegid(); if user_gid != file_gid { - let file_uid = metadata.uid(); + let file_metadata_uid = metadata.uid(); let path = CString::new(at.plus("regular_file").as_os_str().as_bytes()).expect("bad path"); - let r = unsafe { libc::chown(path.as_ptr(), file_uid, user_gid) }; + let r = unsafe { libc::chown(path.as_ptr(), file_metadata_uid, user_gid) }; assert_ne!(r, -1); } diff --git a/tests/by-util/test_tsort.rs b/tests/by-util/test_tsort.rs index 79195efa2..49809e0df 100644 --- a/tests/by-util/test_tsort.rs +++ b/tests/by-util/test_tsort.rs @@ -2,6 +2,8 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +#![allow(clippy::cast_possible_wrap)] + use crate::common::util::TestScenario; #[test] diff --git a/tests/by-util/test_uniq.rs b/tests/by-util/test_uniq.rs index 8585ebd83..30cf73b84 100644 --- a/tests/by-util/test_uniq.rs +++ b/tests/by-util/test_uniq.rs @@ -357,6 +357,7 @@ struct TestCase { } #[test] +#[allow(clippy::too_many_lines)] fn gnu_tests() { let cases = [ TestCase { diff --git a/tests/by-util/test_uptime.rs b/tests/by-util/test_uptime.rs index 382d5f2ef..b2542a934 100644 --- a/tests/by-util/test_uptime.rs +++ b/tests/by-util/test_uptime.rs @@ -4,6 +4,7 @@ // file that was distributed with this source code. // // spell-checker:ignore bincode serde utmp runlevel testusr testx +#![allow(clippy::cast_possible_wrap, clippy::unreadable_literal)] use crate::common::util::TestScenario; @@ -99,6 +100,7 @@ fn test_uptime_with_non_existent_file() { // This will pass #[test] #[cfg(not(any(target_os = "openbsd", target_os = "macos")))] +#[allow(clippy::too_many_lines, clippy::items_after_statements)] fn test_uptime_with_file_containing_valid_boot_time_utmpx_record() { // This test will pass for freebsd but we currently don't support changing the utmpx file for // freebsd. diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index 71b10e191..0bdb5c843 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -2,10 +2,10 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. + use crate::common::util::{vec_of_size, TestScenario}; // spell-checker:ignore (flags) lwmcL clmwL ; (path) bogusfile emptyfile manyemptylines moby notrailingnewline onelongemptyline onelongword weirdchars - #[test] fn test_invalid_arg() { new_ucmd!().arg("--definitely-invalid").fails().code_is(1); @@ -357,6 +357,19 @@ fn test_file_one_long_word() { /// bytes are displayed. #[test] fn test_file_bytes_dictate_width() { + // . is a directory, so minimum_width should get set to 7 + #[cfg(not(windows))] + const STDOUT: &str = concat!( + " 0 0 0 emptyfile.txt\n", + " 0 0 0 .\n", + " 0 0 0 total\n", + ); + #[cfg(windows)] + const STDOUT: &str = concat!( + " 0 0 0 emptyfile.txt\n", + " 0 0 0 total\n", + ); + // This file has 10,001 bytes. Five digits are required to // represent that. Even though the number of lines is 1 and the // number of words is 0, each of those counts is formatted with @@ -384,18 +397,6 @@ fn test_file_bytes_dictate_width() { " 18 166 1074 total\n", )); - // . is a directory, so minimum_width should get set to 7 - #[cfg(not(windows))] - const STDOUT: &str = concat!( - " 0 0 0 emptyfile.txt\n", - " 0 0 0 .\n", - " 0 0 0 total\n", - ); - #[cfg(windows)] - const STDOUT: &str = concat!( - " 0 0 0 emptyfile.txt\n", - " 0 0 0 total\n", - ); new_ucmd!() .args(&["-lwc", "emptyfile.txt", "."]) .run() @@ -737,6 +738,10 @@ fn files0_from_dir() { concat!("wc: cannot open ", $p, " for reading: Permission denied\n") }; } + #[cfg(windows)] + const DOT_ERR: &str = dir_err!("'.'"); + #[cfg(not(windows))] + const DOT_ERR: &str = dir_err!("."); new_ucmd!() .args(&["--files0-from=dir with spaces"]) @@ -744,10 +749,6 @@ fn files0_from_dir() { .stderr_only(dir_err!("'dir with spaces'")); // Those contexts have different rules about quoting in errors... - #[cfg(windows)] - const DOT_ERR: &str = dir_err!("'.'"); - #[cfg(not(windows))] - const DOT_ERR: &str = dir_err!("."); new_ucmd!() .args(&["--files0-from=."]) .fails() diff --git a/tests/common/random.rs b/tests/common/random.rs index 82a58578e..066d6b89f 100644 --- a/tests/common/random.rs +++ b/tests/common/random.rs @@ -2,6 +2,7 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +#![allow(clippy::naive_bytecount)] use rand::distributions::{Distribution, Uniform}; use rand::{thread_rng, Rng}; @@ -54,20 +55,20 @@ impl Distribution for AlphanumericNewline { /// # Examples /// /// ```rust,ignore -/// use crate::common::random::{AlphanumericNewline, RandomString}; +/// use crate::common::random::{AlphanumericNewline, RandomizedString}; /// use rand::distributions::Alphanumeric; /// /// // generates a 100 byte string with characters from AlphanumericNewline -/// let random_string = RandomString::generate(AlphanumericNewline, 100); +/// let random_string = RandomizedString::generate(AlphanumericNewline, 100); /// assert_eq!(100, random_string.len()); /// /// // generates a 100 byte string with 10 newline characters not ending with a newline -/// let string = RandomString::generate_with_delimiter(Alphanumeric, b'\n', 10, false, 100); +/// let string = RandomizedString::generate_with_delimiter(Alphanumeric, b'\n', 10, false, 100); /// assert_eq!(100, random_string.len()); /// ``` -pub struct RandomString; +pub struct RandomizedString; -impl RandomString { +impl RandomizedString { /// Generate a random string from the given [`Distribution`] with the given `length` in bytes. /// /// # Arguments @@ -105,10 +106,10 @@ impl RandomString { /// # Examples /// /// ```rust,ignore - /// use crate::common::random::{AlphanumericNewline, RandomString}; + /// use crate::common::random::{AlphanumericNewline, RandomizedString}; /// /// // generates a 100 byte string with 10 '\0' byte characters not ending with a '\0' byte - /// let string = RandomString::generate_with_delimiter(AlphanumericNewline, 0, 10, false, 100); + /// let string = RandomizedString::generate_with_delimiter(AlphanumericNewline, 0, 10, false, 100); /// assert_eq!(100, random_string.len()); /// assert_eq!( /// 10, @@ -183,25 +184,25 @@ mod tests { #[test] fn test_random_string_generate() { - let random_string = RandomString::generate(AlphanumericNewline, 0); + let random_string = RandomizedString::generate(AlphanumericNewline, 0); assert_eq!(0, random_string.len()); - let random_string = RandomString::generate(AlphanumericNewline, 1); + let random_string = RandomizedString::generate(AlphanumericNewline, 1); assert_eq!(1, random_string.len()); - let random_string = RandomString::generate(AlphanumericNewline, 100); + let random_string = RandomizedString::generate(AlphanumericNewline, 100); assert_eq!(100, random_string.len()); } #[test] fn test_random_string_generate_with_delimiter_when_length_is_zero() { - let random_string = RandomString::generate_with_delimiter(Alphanumeric, 0, 0, false, 0); + let random_string = RandomizedString::generate_with_delimiter(Alphanumeric, 0, 0, false, 0); assert_eq!(0, random_string.len()); } #[test] fn test_random_string_generate_with_delimiter_when_num_delimiter_is_greater_than_length() { - let random_string = RandomString::generate_with_delimiter(Alphanumeric, 0, 2, false, 1); + let random_string = RandomizedString::generate_with_delimiter(Alphanumeric, 0, 2, false, 1); assert_eq!(1, random_string.len()); assert!(random_string.as_bytes().contains(&0)); assert!(random_string.as_bytes().ends_with(&[0])); @@ -210,7 +211,7 @@ 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 = RandomString::generate_with_delimiter(Alphanumeric, 0, 1, true, 1); + let random_string = RandomizedString::generate_with_delimiter(Alphanumeric, 0, 1, true, 1); assert_eq!(1, random_string.len()); assert_eq!( 1, @@ -218,7 +219,7 @@ mod tests { ); assert!(random_string.as_bytes().ends_with(&[0])); - let random_string = RandomString::generate_with_delimiter(Alphanumeric, 0, 1, false, 1); + let random_string = RandomizedString::generate_with_delimiter(Alphanumeric, 0, 1, false, 1); assert_eq!(1, random_string.len()); assert_eq!( 1, @@ -226,7 +227,7 @@ mod tests { ); assert!(random_string.as_bytes().ends_with(&[0])); - let random_string = RandomString::generate_with_delimiter(Alphanumeric, 0, 1, true, 2); + let random_string = RandomizedString::generate_with_delimiter(Alphanumeric, 0, 1, true, 2); assert_eq!(2, random_string.len()); assert_eq!( 1, @@ -234,7 +235,7 @@ mod tests { ); assert!(random_string.as_bytes().ends_with(&[0])); - let random_string = RandomString::generate_with_delimiter(Alphanumeric, 0, 2, true, 2); + let random_string = RandomizedString::generate_with_delimiter(Alphanumeric, 0, 2, true, 2); assert_eq!(2, random_string.len()); assert_eq!( 2, @@ -242,7 +243,7 @@ mod tests { ); assert!(random_string.as_bytes().ends_with(&[0])); - let random_string = RandomString::generate_with_delimiter(Alphanumeric, 0, 1, true, 3); + let random_string = RandomizedString::generate_with_delimiter(Alphanumeric, 0, 1, true, 3); assert_eq!(3, random_string.len()); assert_eq!( 1, @@ -254,21 +255,21 @@ 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 = RandomString::generate_with_delimiter(Alphanumeric, 0, 0, false, 1); + let random_string = RandomizedString::generate_with_delimiter(Alphanumeric, 0, 0, false, 1); assert_eq!(1, random_string.len()); assert_eq!( 0, random_string.as_bytes().iter().filter(|p| **p == 0).count() ); - let random_string = RandomString::generate_with_delimiter(Alphanumeric, 0, 0, true, 1); + let random_string = RandomizedString::generate_with_delimiter(Alphanumeric, 0, 0, true, 1); assert_eq!(1, random_string.len()); assert_eq!( 0, random_string.as_bytes().iter().filter(|p| **p == 0).count() ); - let random_string = RandomString::generate_with_delimiter(Alphanumeric, 0, 1, false, 2); + let random_string = RandomizedString::generate_with_delimiter(Alphanumeric, 0, 1, false, 2); assert_eq!(2, random_string.len()); assert_eq!( 1, @@ -276,7 +277,7 @@ mod tests { ); assert!(!random_string.as_bytes().ends_with(&[0])); - let random_string = RandomString::generate_with_delimiter(Alphanumeric, 0, 1, false, 3); + let random_string = RandomizedString::generate_with_delimiter(Alphanumeric, 0, 1, false, 3); assert_eq!(3, random_string.len()); assert_eq!( 1, @@ -284,7 +285,7 @@ mod tests { ); assert!(!random_string.as_bytes().ends_with(&[0])); - let random_string = RandomString::generate_with_delimiter(Alphanumeric, 0, 2, false, 3); + let random_string = RandomizedString::generate_with_delimiter(Alphanumeric, 0, 2, false, 3); assert_eq!(3, random_string.len()); assert_eq!( 2, @@ -296,7 +297,7 @@ mod tests { #[test] fn test_generate_with_delimiter_with_greater_length() { let random_string = - RandomString::generate_with_delimiter(Alphanumeric, 0, 100, false, 1000); + RandomizedString::generate_with_delimiter(Alphanumeric, 0, 100, false, 1000); assert_eq!(1000, random_string.len()); assert_eq!( 100, @@ -304,7 +305,8 @@ mod tests { ); assert!(!random_string.as_bytes().ends_with(&[0])); - let random_string = RandomString::generate_with_delimiter(Alphanumeric, 0, 100, true, 1000); + let random_string = + RandomizedString::generate_with_delimiter(Alphanumeric, 0, 100, true, 1000); assert_eq!(1000, random_string.len()); assert_eq!( 100, @@ -321,12 +323,12 @@ mod tests { #[test] fn test_generate_random_strings_when_length_is_around_critical_buffer_sizes() { let length = 8192 * 3; - let random_string = RandomString::generate(AlphanumericNewline, length); + let random_string = RandomizedString::generate(AlphanumericNewline, length); assert_eq!(length, random_string.len()); let length = 8192 * 3 + 1; let random_string = - RandomString::generate_with_delimiter(Alphanumeric, b'\n', 100, true, length); + RandomizedString::generate_with_delimiter(Alphanumeric, b'\n', 100, true, length); assert_eq!(length, random_string.len()); assert_eq!( 100, diff --git a/tests/common/util.rs b/tests/common/util.rs index 275a6ae68..82f49556b 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -7,6 +7,11 @@ //spell-checker: ignore (linux) winsize xpixel ypixel setrlimit FSIZE #![allow(dead_code)] +#![allow( + clippy::too_many_lines, + clippy::should_panic_without_expect, + clippy::missing_errors_doc +)] #[cfg(unix)] use libc::mode_t; @@ -793,7 +798,7 @@ pub fn compare_xattrs>(path1: P, path2: P) -> bool { attrs.sort(); attrs }) - .unwrap_or_else(|_| Vec::new()) + .unwrap_or_default() }; get_sorted_xattrs(path1) == get_sorted_xattrs(path2) @@ -1491,7 +1496,6 @@ impl UCommand { #[cfg(unix)] fn spawn_reader_thread( - &self, captured_output: Option, pty_fd_master: OwnedFd, name: String, @@ -1678,7 +1682,7 @@ impl UCommand { slave: po_slave, master: po_master, } = nix::pty::openpty(&terminal_size, None).unwrap(); - captured_stdout = self.spawn_reader_thread( + captured_stdout = Self::spawn_reader_thread( captured_stdout, po_master, "stdout_reader".to_string(), @@ -1691,7 +1695,7 @@ impl UCommand { slave: pe_slave, master: pe_master, } = nix::pty::openpty(&terminal_size, None).unwrap(); - captured_stderr = self.spawn_reader_thread( + captured_stderr = Self::spawn_reader_thread( captured_stderr, pe_master, "stderr_reader".to_string(),