diff --git a/src/uu/dd/src/parseargs/unit_tests.rs b/src/uu/dd/src/parseargs/unit_tests.rs index 6a2ea5b54..95e783c58 100644 --- a/src/uu/dd/src/parseargs/unit_tests.rs +++ b/src/uu/dd/src/parseargs/unit_tests.rs @@ -10,7 +10,7 @@ fn unimplemented_flags_should_error_non_linux() { let mut succeeded = Vec::new(); // The following flags are only implemented in linux - for &flag in &[ + for flag in [ "direct", "directory", "dsync", @@ -47,7 +47,7 @@ fn unimplemented_flags_should_error() { let mut succeeded = Vec::new(); // The following flags are not implemented - for &flag in &["cio", "nocache", "nolinks", "text", "binary"] { + for flag in ["cio", "nocache", "nolinks", "text", "binary"] { let args = vec![ String::from("dd"), format!("--iflag={}", flag), diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 0690c6299..5a2e3ada1 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -253,7 +253,7 @@ fn read_block_size(s: Option<&str>) -> u64 { parse_size(s) .unwrap_or_else(|e| crash!(1, "{}", format_error_message(&e, s, options::BLOCK_SIZE))) } else { - for env_var in &["DU_BLOCK_SIZE", "BLOCK_SIZE", "BLOCKSIZE"] { + for env_var in ["DU_BLOCK_SIZE", "BLOCK_SIZE", "BLOCKSIZE"] { if let Ok(env_size) = env::var(env_var) { if let Ok(v) = parse_size(&env_size) { return v; diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 5c153ebae..77d81c54c 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -1636,7 +1636,7 @@ fn get_leading_gen(input: &str) -> Range { let leading_whitespace_len = input.len() - trimmed.len(); // check for inf, -inf and nan - for allowed_prefix in &["inf", "-inf", "nan"] { + for allowed_prefix in ["inf", "-inf", "nan"] { if trimmed.is_char_boundary(allowed_prefix.len()) && trimmed[..allowed_prefix.len()].eq_ignore_ascii_case(allowed_prefix) { diff --git a/tests/by-util/test_base32.rs b/tests/by-util/test_base32.rs index 0eceb4a66..ed1468abd 100644 --- a/tests/by-util/test_base32.rs +++ b/tests/by-util/test_base32.rs @@ -34,7 +34,7 @@ fn test_base32_encode_file() { #[test] fn test_decode() { - for decode_param in &["-d", "--decode", "--dec"] { + for decode_param in ["-d", "--decode", "--dec"] { let input = "JBSWY3DPFQQFO33SNRSCC===\n"; // spell-checker:disable-line new_ucmd!() .arg(decode_param) @@ -56,7 +56,7 @@ fn test_garbage() { #[test] fn test_ignore_garbage() { - for ignore_garbage_param in &["-i", "--ignore-garbage", "--ig"] { + for ignore_garbage_param in ["-i", "--ignore-garbage", "--ig"] { let input = "JBSWY\x013DPFQ\x02QFO33SNRSCC===\n"; // spell-checker:disable-line new_ucmd!() .arg("-d") @@ -69,7 +69,7 @@ fn test_ignore_garbage() { #[test] fn test_wrap() { - for wrap_param in &["-w", "--wrap", "--wr"] { + for wrap_param in ["-w", "--wrap", "--wr"] { let input = "The quick brown fox jumps over the lazy dog."; new_ucmd!() .arg(wrap_param) @@ -84,7 +84,7 @@ fn test_wrap() { #[test] fn test_wrap_no_arg() { - for wrap_param in &["-w", "--wrap"] { + for wrap_param in ["-w", "--wrap"] { let ts = TestScenario::new(util_name!()); let expected_stderr = &format!( "error: The argument '--wrap \' requires a value but none was \ @@ -102,7 +102,7 @@ fn test_wrap_no_arg() { #[test] fn test_wrap_bad_arg() { - for wrap_param in &["-w", "--wrap"] { + for wrap_param in ["-w", "--wrap"] { new_ucmd!() .arg(wrap_param) .arg("b") diff --git a/tests/by-util/test_base64.rs b/tests/by-util/test_base64.rs index a4b461f91..11d345347 100644 --- a/tests/by-util/test_base64.rs +++ b/tests/by-util/test_base64.rs @@ -26,7 +26,7 @@ fn test_base64_encode_file() { #[test] fn test_decode() { - for decode_param in &["-d", "--decode", "--dec"] { + for decode_param in ["-d", "--decode", "--dec"] { let input = "aGVsbG8sIHdvcmxkIQ=="; // spell-checker:disable-line new_ucmd!() .arg(decode_param) @@ -48,7 +48,7 @@ fn test_garbage() { #[test] fn test_ignore_garbage() { - for ignore_garbage_param in &["-i", "--ignore-garbage", "--ig"] { + for ignore_garbage_param in ["-i", "--ignore-garbage", "--ig"] { let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line new_ucmd!() .arg("-d") @@ -61,7 +61,7 @@ fn test_ignore_garbage() { #[test] fn test_wrap() { - for wrap_param in &["-w", "--wrap", "--wr"] { + for wrap_param in ["-w", "--wrap", "--wr"] { let input = "The quick brown fox jumps over the lazy dog."; new_ucmd!() .arg(wrap_param) @@ -75,7 +75,7 @@ fn test_wrap() { #[test] fn test_wrap_no_arg() { - for wrap_param in &["-w", "--wrap"] { + for wrap_param in ["-w", "--wrap"] { new_ucmd!().arg(wrap_param).fails().stderr_contains( &"The argument '--wrap ' requires a value but none was supplied", ); @@ -84,7 +84,7 @@ fn test_wrap_no_arg() { #[test] fn test_wrap_bad_arg() { - for wrap_param in &["-w", "--wrap"] { + for wrap_param in ["-w", "--wrap"] { new_ucmd!() .arg(wrap_param) .arg("b") diff --git a/tests/by-util/test_basename.rs b/tests/by-util/test_basename.rs index 1250ba76f..0c7249b32 100644 --- a/tests/by-util/test_basename.rs +++ b/tests/by-util/test_basename.rs @@ -6,7 +6,7 @@ use std::ffi::OsStr; #[test] fn test_help() { - for help_flg in &["-h", "--help"] { + for help_flg in ["-h", "--help"] { new_ucmd!() .arg(&help_flg) .succeeds() @@ -17,7 +17,7 @@ fn test_help() { #[test] fn test_version() { - for version_flg in &["-V", "--version"] { + for version_flg in ["-V", "--version"] { assert!(new_ucmd!() .arg(&version_flg) .succeeds() @@ -61,7 +61,7 @@ fn test_do_not_remove_suffix() { #[test] fn test_multiple_param() { - for &multiple_param in &["-a", "--multiple", "--mul"] { + for multiple_param in ["-a", "--multiple", "--mul"] { let path = "/foo/bar/baz"; new_ucmd!() .args(&[multiple_param, path, path]) @@ -72,7 +72,7 @@ fn test_multiple_param() { #[test] fn test_suffix_param() { - for &suffix_param in &["-s", "--suffix", "--suf"] { + for suffix_param in ["-s", "--suffix", "--suf"] { let path = "/foo/bar/baz.exe"; new_ucmd!() .args(&[suffix_param, ".exe", path, path]) @@ -83,7 +83,7 @@ fn test_suffix_param() { #[test] fn test_zero_param() { - for &zero_param in &["-z", "--zero", "--ze"] { + for zero_param in ["-z", "--zero", "--ze"] { let path = "/foo/bar/baz"; new_ucmd!() .args(&[zero_param, "-a", path, path]) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index 64a511656..96c77a40e 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -19,7 +19,7 @@ fn test_output_simple() { #[test] fn test_no_options() { // spell-checker:disable-next-line - for fixture in &["empty.txt", "alpha.txt", "nonewline.txt"] { + for fixture in ["empty.txt", "alpha.txt", "nonewline.txt"] { // Give fixture through command line file argument new_ucmd!() .args(&[fixture]) @@ -36,7 +36,7 @@ fn test_no_options() { #[test] #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))] fn test_no_options_big_input() { - for &n in &[ + for n in [ 0, 1, 42, @@ -114,7 +114,7 @@ fn test_closes_file_descriptors() { fn test_piped_to_regular_file() { use std::fs::read_to_string; - for &append in &[true, false] { + for append in [true, false] { let s = TestScenario::new(util_name!()); let file_path = s.fixtures.plus("file.txt"); @@ -139,7 +139,7 @@ fn test_piped_to_regular_file() { #[test] #[cfg(unix)] fn test_piped_to_dev_null() { - for &append in &[true, false] { + for append in [true, false] { let s = TestScenario::new(util_name!()); { let dev_null = OpenOptions::new() @@ -159,7 +159,7 @@ fn test_piped_to_dev_null() { #[test] #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))] fn test_piped_to_dev_full() { - for &append in &[true, false] { + for append in [true, false] { let s = TestScenario::new(util_name!()); { let dev_full = OpenOptions::new() @@ -192,7 +192,7 @@ fn test_directory_and_file() { let s = TestScenario::new(util_name!()); s.fixtures.mkdir("test_directory2"); // spell-checker:disable-next-line - for fixture in &["empty.txt", "alpha.txt", "nonewline.txt"] { + for fixture in ["empty.txt", "alpha.txt", "nonewline.txt"] { s.ucmd() .args(&["test_directory2", fixture]) .fails() @@ -264,7 +264,7 @@ fn test_numbered_lines_no_trailing_newline() { #[test] fn test_stdin_show_nonprinting() { - for same_param in &["-v", "--show-nonprinting", "--show-non"] { + for same_param in ["-v", "--show-nonprinting", "--show-non"] { new_ucmd!() .args(&[same_param]) .pipe_in("\t\0\n") @@ -275,7 +275,7 @@ fn test_stdin_show_nonprinting() { #[test] fn test_stdin_show_tabs() { - for same_param in &["-T", "--show-tabs", "--show-ta"] { + for same_param in ["-T", "--show-tabs", "--show-ta"] { new_ucmd!() .args(&[same_param]) .pipe_in("\t\0\n") @@ -286,7 +286,7 @@ fn test_stdin_show_tabs() { #[test] fn test_stdin_show_ends() { - for &same_param in &["-E", "--show-ends", "--show-e"] { + for same_param in ["-E", "--show-ends", "--show-e"] { new_ucmd!() .args(&[same_param, "-"]) .pipe_in("\t\0\n\t") @@ -317,7 +317,7 @@ fn test_show_ends_crlf() { #[test] fn test_stdin_show_all() { - for same_param in &["-A", "--show-all", "--show-a"] { + for same_param in ["-A", "--show-all", "--show-a"] { new_ucmd!() .args(&[same_param]) .pipe_in("\t\0\n") @@ -346,7 +346,7 @@ fn test_stdin_nonprinting_and_tabs() { #[test] fn test_stdin_squeeze_blank() { - for same_param in &["-s", "--squeeze-blank", "--squeeze"] { + for same_param in ["-s", "--squeeze-blank", "--squeeze"] { new_ucmd!() .arg(same_param) .pipe_in("\n\na\n\n\n\n\nb\n\n\n") @@ -358,7 +358,7 @@ fn test_stdin_squeeze_blank() { #[test] fn test_stdin_number_non_blank() { // spell-checker:disable-next-line - for same_param in &["-b", "--number-nonblank", "--number-non"] { + for same_param in ["-b", "--number-nonblank", "--number-non"] { new_ucmd!() .arg(same_param) .arg("-") @@ -371,7 +371,7 @@ fn test_stdin_number_non_blank() { #[test] fn test_non_blank_overrides_number() { // spell-checker:disable-next-line - for &same_param in &["-b", "--number-nonblank"] { + for same_param in ["-b", "--number-nonblank"] { new_ucmd!() .args(&[same_param, "-"]) .pipe_in("\na\nb\n\n\nc") @@ -382,7 +382,7 @@ fn test_non_blank_overrides_number() { #[test] fn test_squeeze_blank_before_numbering() { - for &same_param in &["-s", "--squeeze-blank"] { + for same_param in ["-s", "--squeeze-blank"] { new_ucmd!() .args(&[same_param, "-n", "-"]) .pipe_in("a\n\n\nb") diff --git a/tests/by-util/test_chcon.rs b/tests/by-util/test_chcon.rs index 82dab9ae3..bea5462b4 100644 --- a/tests/by-util/test_chcon.rs +++ b/tests/by-util/test_chcon.rs @@ -23,7 +23,7 @@ fn help() { #[test] fn reference_errors() { - for args in &[ + for args in [ &["--verbose", "--reference"] as &[&str], &["--verbose", "--reference=/dev/null"], &["--verbose", "--reference=/inexistent", "/dev/null"], @@ -34,7 +34,7 @@ fn reference_errors() { #[test] fn recursive_errors() { - for args in &[ + for args in [ &["--verbose", "-P"] as &[&str], &["--verbose", "-H"], &["--verbose", "-L"], diff --git a/tests/by-util/test_chgrp.rs b/tests/by-util/test_chgrp.rs index 6c0aa46ad..1d89caca7 100644 --- a/tests/by-util/test_chgrp.rs +++ b/tests/by-util/test_chgrp.rs @@ -60,7 +60,7 @@ fn test_1() { #[test] fn test_fail_silently() { if get_effective_gid() != 0 { - for opt in &["-f", "--silent", "--quiet", "--sil", "--qui"] { + for opt in ["-f", "--silent", "--quiet", "--sil", "--qui"] { new_ucmd!() .arg(opt) .arg("bin") @@ -74,7 +74,7 @@ fn test_fail_silently() { #[test] fn test_preserve_root() { // It's weird that on OS X, `realpath /etc/..` returns '/private' - for d in &[ + for d in [ "/", "/////tmp///../../../../", "../../../../../../../../../../../../../../", @@ -92,7 +92,7 @@ fn test_preserve_root() { #[test] fn test_preserve_root_symlink() { let file = "test_chgrp_symlink2root"; - for d in &[ + for d in [ "/", "////tmp//../../../../", "..//../../..//../..//../../../../../../../../", @@ -299,7 +299,7 @@ fn test_traverse_symlinks() { } let (first_group, second_group) = (groups[0], groups[1]); - for &(args, traverse_first, traverse_second) in &[ + for (args, traverse_first, traverse_second) in [ (&[][..] as &[&str], false, false), (&["-H"][..], true, false), (&["-P"][..], false, false), diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index 373ad97ce..8f6b7fb52 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -532,7 +532,7 @@ fn test_chmod_strip_minus_from_mode() { #[test] fn test_chmod_keep_setgid() { - for &(from, arg, to) in &[ + for (from, arg, to) in [ (0o7777, "777", 0o46777), (0o7777, "=777", 0o40777), (0o7777, "0777", 0o46777), diff --git a/tests/by-util/test_comm.rs b/tests/by-util/test_comm.rs index d5b72b1e9..ebfc9c6f9 100644 --- a/tests/by-util/test_comm.rs +++ b/tests/by-util/test_comm.rs @@ -76,7 +76,7 @@ fn output_delimiter_require_arg() { #[cfg_attr(not(feature = "test_unimplemented"), ignore)] #[test] fn zero_terminated() { - for ¶m in &["-z", "--zero-terminated"] { + for param in ["-z", "--zero-terminated"] { new_ucmd!() .args(&[param, "a", "b"]) .fails() diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 11afa469e..7bb11306d 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1469,7 +1469,7 @@ fn test_canonicalize_symlink() { #[test] fn test_copy_through_just_created_symlink() { - for &create_t in &[true, false] { + for create_t in [true, false] { let (at, mut ucmd) = at_and_ucmd!(); at.mkdir("a"); at.mkdir("b"); @@ -1606,7 +1606,7 @@ fn test_cp_dir_vs_file() { fn test_cp_overriding_arguments() { let s = TestScenario::new(util_name!()); s.fixtures.touch("file1"); - for (arg1, arg2) in &[ + for (arg1, arg2) in [ #[cfg(not(windows))] ("--remove-destination", "--force"), #[cfg(not(windows))] diff --git a/tests/by-util/test_cut.rs b/tests/by-util/test_cut.rs index da707ac3a..0fe222b06 100644 --- a/tests/by-util/test_cut.rs +++ b/tests/by-util/test_cut.rs @@ -41,7 +41,7 @@ static COMPLEX_SEQUENCE: &TestedSequence = &TestedSequence { #[test] fn test_byte_sequence() { - for ¶m in &["-b", "--bytes", "--byt"] { + for param in ["-b", "--bytes", "--byt"] { for example_seq in EXAMPLE_SEQUENCES { new_ucmd!() .args(&[param, example_seq.sequence, INPUT]) @@ -53,7 +53,7 @@ fn test_byte_sequence() { #[test] fn test_char_sequence() { - for ¶m in &["-c", "--characters", "--char"] { + for param in ["-c", "--characters", "--char"] { for example_seq in EXAMPLE_SEQUENCES { //as of coreutils 8.25 a char range is effectively the same as a byte range; there is no distinct treatment of utf8 chars. new_ucmd!() @@ -66,7 +66,7 @@ fn test_char_sequence() { #[test] fn test_field_sequence() { - for ¶m in &["-f", "--fields", "--fie"] { + for param in ["-f", "--fields", "--fie"] { for example_seq in EXAMPLE_SEQUENCES { new_ucmd!() .args(&[param, example_seq.sequence, INPUT]) @@ -78,7 +78,7 @@ fn test_field_sequence() { #[test] fn test_specify_delimiter() { - for ¶m in &["-d", "--delimiter", "--del"] { + for param in ["-d", "--delimiter", "--del"] { new_ucmd!() .args(&[param, ":", "-f", COMPLEX_SEQUENCE.sequence, INPUT]) .succeeds() @@ -115,7 +115,7 @@ fn test_output_delimiter() { #[test] fn test_complement() { - for param in &["--complement", "--com"] { + for param in ["--complement", "--com"] { new_ucmd!() .args(&["-d_", param, "-f", "2"]) .pipe_in("9_1\n8_2\n7_3") @@ -135,7 +135,7 @@ fn test_zero_terminated() { #[test] fn test_only_delimited() { - for param in &["-s", "--only-delimited", "--only-del"] { + for param in ["-s", "--only-delimited", "--only-del"] { new_ucmd!() .args(&["-d_", param, "-f", "1"]) .pipe_in("91\n82\n7_3") diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 05c6f89db..a04de9b59 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -7,7 +7,7 @@ use rust_users::*; #[test] fn test_date_email() { - for param in &["--rfc-email", "--rfc-e", "-R"] { + for param in ["--rfc-email", "--rfc-e", "-R"] { new_ucmd!().arg(param).succeeds(); } } @@ -23,7 +23,7 @@ fn test_date_rfc_3339() { let re = Regex::new(rfc_regexp).unwrap(); // Check that the output matches the regexp - for param in &["--rfc-3339", "--rfc-3"] { + for param in ["--rfc-3339", "--rfc-3"] { scene .ucmd() .arg(format!("{}=ns", param)) @@ -40,21 +40,21 @@ fn test_date_rfc_3339() { #[test] fn test_date_rfc_8601() { - for param in &["--iso-8601", "--i"] { + for param in ["--iso-8601", "--i"] { new_ucmd!().arg(format!("{}=ns", param)).succeeds(); } } #[test] fn test_date_rfc_8601_second() { - for param in &["--iso-8601", "--i"] { + for param in ["--iso-8601", "--i"] { new_ucmd!().arg(format!("{}=second", param)).succeeds(); } } #[test] fn test_date_utc() { - for param in &["--universal", "--utc", "--uni", "--u"] { + for param in ["--universal", "--utc", "--uni", "--u"] { new_ucmd!().arg(param).succeeds(); } } diff --git a/tests/by-util/test_dd.rs b/tests/by-util/test_dd.rs index f6287a940..71049a2af 100644 --- a/tests/by-util/test_dd.rs +++ b/tests/by-util/test_dd.rs @@ -463,7 +463,7 @@ fn test_zeros_to_stdout() { #[cfg(target_pointer_width = "32")] #[test] fn test_oversized_bs_32_bit() { - for bs_param in &["bs", "ibs", "obs", "cbs"] { + for bs_param in ["bs", "ibs", "obs", "cbs"] { new_ucmd!() .args(&[format!("{}=5GB", bs_param)]) .run() diff --git a/tests/by-util/test_env.rs b/tests/by-util/test_env.rs index 3559e74cd..395e6d157 100644 --- a/tests/by-util/test_env.rs +++ b/tests/by-util/test_env.rs @@ -83,7 +83,7 @@ fn test_unset_invalid_variables() { // Cannot test input with \0 in it, since output will also contain \0. rlimit::prlimit fails // with this error: Error { kind: InvalidInput, message: "nul byte found in provided data" } - for var in &["", "a=b"] { + for var in ["", "a=b"] { new_ucmd!().arg("-u").arg(var).run().stderr_only(format!( "env: cannot unset {}: Invalid argument", var.quote() diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index db918aa33..8606678e9 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -49,7 +49,7 @@ fn test_id_single_user() { .code_is(exp_result.code()); // u/g/G z/n - for &opt in &["--user", "--group", "--groups"] { + for opt in ["--user", "--group", "--groups"] { let mut args = vec![opt]; args.extend_from_slice(&test_users); exp_result = unwrap_or_return!(expected_result(&ts, &args)); @@ -108,7 +108,7 @@ fn test_id_single_user_non_existing() { #[cfg(unix)] fn test_id_name() { let ts = TestScenario::new(util_name!()); - for &opt in &["--user", "--group", "--groups"] { + for opt in ["--user", "--group", "--groups"] { let args = [opt, "--name"]; let result = ts.ucmd().args(&args).run(); let exp_result = unwrap_or_return!(expected_result(&ts, &args)); @@ -127,7 +127,7 @@ fn test_id_name() { #[cfg(unix)] fn test_id_real() { let ts = TestScenario::new(util_name!()); - for &opt in &["--user", "--group", "--groups"] { + for opt in ["--user", "--group", "--groups"] { let args = [opt, "--real"]; let result = ts.ucmd().args(&args).run(); let exp_result = unwrap_or_return!(expected_result(&ts, &args)); @@ -188,7 +188,7 @@ fn test_id_multiple_users() { .code_is(exp_result.code()); // u/g/G z/n - for &opt in &["--user", "--group", "--groups"] { + for opt in ["--user", "--group", "--groups"] { let mut args = vec![opt]; args.extend_from_slice(&test_users); exp_result = unwrap_or_return!(expected_result(&ts, &args)); @@ -256,7 +256,7 @@ fn test_id_multiple_users_non_existing() { .code_is(exp_result.code()); // u/g/G z/n - for &opt in &["--user", "--group", "--groups"] { + for opt in ["--user", "--group", "--groups"] { let mut args = vec![opt]; args.extend_from_slice(&test_users); exp_result = unwrap_or_return!(expected_result(&ts, &args)); @@ -297,14 +297,14 @@ fn test_id_multiple_users_non_existing() { #[cfg(unix)] fn test_id_default_format() { let ts = TestScenario::new(util_name!()); - for &opt1 in &["--name", "--real"] { + for opt1 in ["--name", "--real"] { // id: cannot print only names or real IDs in default format let args = [opt1]; ts.ucmd() .args(&args) .fails() .stderr_only(unwrap_or_return!(expected_result(&ts, &args)).stderr_str()); - for &opt2 in &["--user", "--group", "--groups"] { + for opt2 in ["--user", "--group", "--groups"] { // u/g/G n/r let args = [opt2, opt1]; let result = ts.ucmd().args(&args).run(); @@ -315,7 +315,7 @@ fn test_id_default_format() { .code_is(exp_result.code()); } } - for &opt2 in &["--user", "--group", "--groups"] { + for opt2 in ["--user", "--group", "--groups"] { // u/g/G let args = [opt2]; ts.ucmd() @@ -329,20 +329,20 @@ fn test_id_default_format() { #[cfg(unix)] fn test_id_zero() { let ts = TestScenario::new(util_name!()); - for z_flag in &["-z", "--zero"] { + for z_flag in ["-z", "--zero"] { // id: option --zero not permitted in default format ts.ucmd() .args(&[z_flag]) .fails() .stderr_only(unwrap_or_return!(expected_result(&ts, &[z_flag])).stderr_str()); - for &opt1 in &["--name", "--real"] { + for opt1 in ["--name", "--real"] { // id: cannot print only names or real IDs in default format let args = [opt1, z_flag]; ts.ucmd() .args(&args) .fails() .stderr_only(unwrap_or_return!(expected_result(&ts, &args)).stderr_str()); - for &opt2 in &["--user", "--group", "--groups"] { + for opt2 in ["--user", "--group", "--groups"] { // u/g/G n/r z let args = [opt2, z_flag, opt1]; let result = ts.ucmd().args(&args).run(); @@ -353,7 +353,7 @@ fn test_id_zero() { .code_is(exp_result.code()); } } - for &opt2 in &["--user", "--group", "--groups"] { + for opt2 in ["--user", "--group", "--groups"] { // u/g/G z let args = [opt2, z_flag]; ts.ucmd() @@ -373,18 +373,18 @@ fn test_id_context() { return; } let ts = TestScenario::new(util_name!()); - for c_flag in &["-Z", "--context"] { + for c_flag in ["-Z", "--context"] { ts.ucmd() .args(&[c_flag]) .succeeds() .stdout_only(unwrap_or_return!(expected_result(&ts, &[c_flag])).stdout_str()); - for &z_flag in &["-z", "--zero"] { + for z_flag in ["-z", "--zero"] { let args = [c_flag, z_flag]; ts.ucmd() .args(&args) .succeeds() .stdout_only(unwrap_or_return!(expected_result(&ts, &args)).stdout_str()); - for &opt1 in &["--name", "--real"] { + for opt1 in ["--name", "--real"] { // id: cannot print only names or real IDs in default format let args = [opt1, c_flag]; ts.ucmd() @@ -396,7 +396,7 @@ fn test_id_context() { .args(&args) .succeeds() .stdout_only(unwrap_or_return!(expected_result(&ts, &args)).stdout_str()); - for &opt2 in &["--user", "--group", "--groups"] { + for opt2 in ["--user", "--group", "--groups"] { // u/g/G n/r z Z // for now, we print clap's standard response for "conflicts_with" instead of: // id: cannot print "only" of more than one choice @@ -409,7 +409,7 @@ fn test_id_context() { // .code_is(exp_result.code()); } } - for &opt2 in &["--user", "--group", "--groups"] { + for opt2 in ["--user", "--group", "--groups"] { // u/g/G z Z // for now, we print clap's standard response for "conflicts_with" instead of: // id: cannot print "only" of more than one choice diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index f60d53b6e..45ebc2382 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -604,7 +604,7 @@ fn test_ls_width() { at.touch(&at.plus_as_string("test-width-3")); at.touch(&at.plus_as_string("test-width-4")); - for option in &[ + for option in [ "-w 100", "-w=100", "--width=100", @@ -619,7 +619,7 @@ fn test_ls_width() { .stdout_only("test-width-1 test-width-2 test-width-3 test-width-4\n"); } - for option in &["-w 50", "-w=50", "--width=50", "--width 50", "--wid=50"] { + for option in ["-w 50", "-w=50", "--width=50", "--width 50", "--wid=50"] { scene .ucmd() .args(&option.split(' ').collect::>()) @@ -628,7 +628,7 @@ fn test_ls_width() { .stdout_only("test-width-1 test-width-3\ntest-width-2 test-width-4\n"); } - for option in &["-w 25", "-w=25", "--width=25", "--width 25", "--wid=25"] { + for option in ["-w 25", "-w=25", "--width=25", "--width 25", "--wid=25"] { scene .ucmd() .args(&option.split(' ').collect::>()) @@ -637,7 +637,7 @@ fn test_ls_width() { .stdout_only("test-width-1\ntest-width-2\ntest-width-3\ntest-width-4\n"); } - for option in &["-w 0", "-w=0", "--width=0", "--width 0", "--wid=0"] { + for option in ["-w 0", "-w=0", "--width=0", "--width 0", "--wid=0"] { scene .ucmd() .args(&option.split(' ').collect::>()) @@ -653,7 +653,7 @@ fn test_ls_width() { .fails() .stderr_contains("invalid line width"); - for option in &["-w 1a", "-w=1a", "--width=1a", "--width 1a", "--wid 1a"] { + for option in ["-w 1a", "-w=1a", "--width=1a", "--width 1a", "--wid 1a"] { scene .ucmd() .args(&option.split(' ').collect::>()) @@ -1088,9 +1088,9 @@ fn test_ls_long_total_size() { let result = scene.ucmd().arg(arg).succeeds(); result.stdout_contains(expected_prints["long_vanilla"]); - for arg2 in &["-h", "--human-readable", "--si"] { + for arg2 in ["-h", "--human-readable", "--si"] { let result = scene.ucmd().arg(arg).arg(arg2).succeeds(); - result.stdout_contains(if *arg2 == "--si" { + result.stdout_contains(if arg2 == "--si" { expected_prints["long_si"] } else { expected_prints["long_human_readable"] @@ -1158,7 +1158,7 @@ fn test_ls_long_formats() { .stdout_matches(&re_three_num); } - for arg in &[ + for arg in [ "-l", // only group and owner "-g --author", // only author and group "-o --author", // only author and owner @@ -1184,7 +1184,7 @@ fn test_ls_long_formats() { } } - for arg in &[ + for arg in [ "-g", // only group "-gl", // only group "-o", // only owner @@ -1213,7 +1213,7 @@ fn test_ls_long_formats() { } } - for arg in &[ + for arg in [ "-og", "-ogl", "-lgo", @@ -1255,7 +1255,7 @@ fn test_ls_oneline() { // Bit of a weird situation: in the tests oneline and columns have the same output, // except on Windows. - for option in &["-1", "--format=single-column"] { + for option in ["-1", "--format=single-column"] { scene .ucmd() .arg(option) @@ -1376,7 +1376,7 @@ fn test_ls_long_ctime() { at.touch("test-long-ctime-1"); - for arg in &["-c", "--time=ctime", "--time=status"] { + for arg in ["-c", "--time=ctime", "--time=status"] { let result = scene.ucmd().arg("-l").arg(arg).succeeds(); // Should show the time on Unix, but question marks on windows. @@ -1537,7 +1537,7 @@ fn test_ls_order_time() { // 3 was accessed last in the read // So the order should be 2 3 4 1 - for arg in &["-u", "--time=atime", "--time=access", "--time=use"] { + for arg in ["-u", "--time=atime", "--time=access", "--time=use"] { let result = scene.ucmd().arg("-t").arg(arg).succeeds(); at.open("test-3").metadata().unwrap().accessed().unwrap(); at.open("test-4").metadata().unwrap().accessed().unwrap(); @@ -1656,7 +1656,7 @@ fn test_ls_color() { assert!(!result.stdout_str().contains(z_with_colors)); // Color should be enabled - for param in &["--color", "--col", "--color=always", "--col=always"] { + for param in ["--color", "--col", "--color=always", "--col=always"] { scene .ucmd() .arg(param) @@ -2034,7 +2034,7 @@ fn test_ls_success_on_c_drv_root_windows() { fn test_ls_version_sort() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; - for filename in &[ + for filename in [ "a2", "b1", "b20", @@ -2130,7 +2130,7 @@ fn test_ls_quoting_style() { .succeeds() .stdout_only("'one'$'\\n''two'\n"); - for (arg, correct) in &[ + for (arg, correct) in [ ("--quoting-style=literal", "one?two"), ("-N", "one?two"), ("--literal", "one?two"), @@ -2154,7 +2154,7 @@ fn test_ls_quoting_style() { .stdout_only(format!("{}\n", correct)); } - for (arg, correct) in &[ + for (arg, correct) in [ ("--quoting-style=literal", "one\ntwo"), ("-N", "one\ntwo"), ("--literal", "one\ntwo"), @@ -2170,7 +2170,7 @@ fn test_ls_quoting_style() { .stdout_only(format!("{}\n", correct)); } - for (arg, correct) in &[ + for (arg, correct) in [ ("--quoting-style=literal", "one\\two"), ("-N", "one\\two"), ("--quoting-style=c", "\"one\\\\two\""), @@ -2195,7 +2195,7 @@ fn test_ls_quoting_style() { // Tests for a character that forces quotation in shell-style escaping // after a character in a dollar expression at.touch("one\n&two"); - for (arg, correct) in &[ + for (arg, correct) in [ ("--quoting-style=shell-escape", "'one'$'\\n''&two'"), ("--quoting-style=shell-escape-always", "'one'$'\\n''&two'"), ] { @@ -2215,7 +2215,7 @@ fn test_ls_quoting_style() { .succeeds() .stdout_only("'one two'\n"); - for (arg, correct) in &[ + for (arg, correct) in [ ("--quoting-style=literal", "one two"), ("-N", "one two"), ("--literal", "one two"), @@ -2241,7 +2241,7 @@ fn test_ls_quoting_style() { scene.ucmd().arg("one").succeeds().stdout_only("one\n"); - for (arg, correct) in &[ + for (arg, correct) in [ ("--quoting-style=literal", "one"), ("-N", "one"), ("--quoting-style=c", "\"one\""), @@ -2649,7 +2649,7 @@ fn test_ls_deref_command_line_dir() { fn test_ls_sort_extension() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; - for filename in &[ + for filename in [ "file1", "file2", "anotherFile", @@ -2831,7 +2831,7 @@ fn test_ls_context2() { return; } let ts = TestScenario::new(util_name!()); - for c_flag in &["-Z", "--context"] { + for c_flag in ["-Z", "--context"] { ts.ucmd() .args(&[c_flag, &"/"]) .succeeds() @@ -2851,7 +2851,7 @@ fn test_ls_context_format() { // NOTE: // --format=long/verbose matches the output of GNU's ls for --context // except for the size count which may differ to the size count reported by GNU's ls. - for word in &[ + for word in [ "across", "commas", "horizontal", diff --git a/tests/by-util/test_nl.rs b/tests/by-util/test_nl.rs index ce3014311..1ed46c313 100644 --- a/tests/by-util/test_nl.rs +++ b/tests/by-util/test_nl.rs @@ -42,7 +42,7 @@ fn test_padding_with_overflow() { #[test] fn test_sections_and_styles() { // spell-checker:disable - for &(fixture, output) in &[ + for (fixture, output) in [ ( "section.txt", "\nHEADER1\nHEADER2\n\n1 |BODY1\n2 \ diff --git a/tests/by-util/test_numfmt.rs b/tests/by-util/test_numfmt.rs index 0086c25e1..38faacdc5 100644 --- a/tests/by-util/test_numfmt.rs +++ b/tests/by-util/test_numfmt.rs @@ -484,7 +484,7 @@ fn test_delimiter_with_padding_and_fields() { #[test] fn test_round() { - for (method, exp) in &[ + for (method, exp) in [ ("from-zero", ["9.1K", "-9.1K", "9.1K", "-9.1K"]), ("towards-zero", ["9.0K", "-9.0K", "9.0K", "-9.0K"]), ("up", ["9.1K", "-9.0K", "9.1K", "-9.0K"]), diff --git a/tests/by-util/test_od.rs b/tests/by-util/test_od.rs index a6a81d1d6..3272971d7 100644 --- a/tests/by-util/test_od.rs +++ b/tests/by-util/test_od.rs @@ -70,12 +70,12 @@ fn test_2files() { let file1 = tmpdir.join("test1"); let file2 = tmpdir.join("test2"); - for &(n, a) in &[(1, "a"), (2, "b")] { + for (n, a) in [(1, "a"), (2, "b")] { println!("number: {} letter:{}", n, a); } // spell-checker:disable-next-line - for &(path, data) in &[(&file1, "abcdefghijklmnop"), (&file2, "qrstuvwxyz\n")] { + for (path, data) in [(&file1, "abcdefghijklmnop"), (&file2, "qrstuvwxyz\n")] { let mut f = File::create(&path).unwrap(); assert!( f.write_all(data.as_bytes()).is_ok(), @@ -127,7 +127,7 @@ fn test_from_mixed() { // spell-checker:disable-next-line let (data1, data2, data3) = ("abcdefg", "hijklmnop", "qrstuvwxyz\n"); - for &(path, data) in &[(&file1, data1), (&file3, data3)] { + for (path, data) in [(&file1, data1), (&file3, data3)] { let mut f = File::create(&path).unwrap(); assert!( f.write_all(data.as_bytes()).is_ok(), diff --git a/tests/by-util/test_paste.rs b/tests/by-util/test_paste.rs index 09401ec59..6d539e45e 100644 --- a/tests/by-util/test_paste.rs +++ b/tests/by-util/test_paste.rs @@ -82,8 +82,8 @@ static EXAMPLE_DATA: &[TestData] = &[ #[test] fn test_combine_pairs_of_lines() { - for &s in &["-s", "--serial"] { - for &d in &["-d", "--delimiters"] { + for s in ["-s", "--serial"] { + for d in ["-d", "--delimiters"] { new_ucmd!() .args(&[s, d, "\t\n", "html_colors.txt"]) .run() @@ -94,7 +94,7 @@ fn test_combine_pairs_of_lines() { #[test] fn test_multi_stdin() { - for &d in &["-d", "--delimiters"] { + for d in ["-d", "--delimiters"] { new_ucmd!() .args(&[d, "\t\n", "-", "-"]) .pipe_in_fixture("html_colors.txt") diff --git a/tests/by-util/test_pr.rs b/tests/by-util/test_pr.rs index 2e72aaed7..cd832cf68 100644 --- a/tests/by-util/test_pr.rs +++ b/tests/by-util/test_pr.rs @@ -69,7 +69,7 @@ fn test_with_long_header_option() { let test_file_path = "test_one_page.log"; let expected_test_file_path = "test_one_page_header.log.expected"; let header = "new file"; - for args in &[&["-h", header][..], &["--header=new file"][..]] { + for args in [&["-h", header][..], &["--header=new file"][..]] { let mut scenario = new_ucmd!(); let value = file_last_modified_time(&scenario, test_file_path); scenario @@ -87,7 +87,7 @@ fn test_with_long_header_option() { fn test_with_double_space_option() { let test_file_path = "test_one_page.log"; let expected_test_file_path = "test_one_page_double_line.log.expected"; - for &arg in &["-d", "--double-space"] { + for arg in ["-d", "--double-space"] { let mut scenario = new_ucmd!(); let value = file_last_modified_time(&scenario, test_file_path); scenario @@ -183,7 +183,7 @@ fn test_with_page_range() { let test_file_path = "test.log"; let expected_test_file_path = "test_page_range_1.log.expected"; let expected_test_file_path1 = "test_page_range_2.log.expected"; - for &arg in &["--pages=15", "+15"] { + for arg in ["--pages=15", "+15"] { let mut scenario = new_ucmd!(); let value = file_last_modified_time(&scenario, test_file_path); scenario @@ -194,7 +194,7 @@ fn test_with_page_range() { &[("{last_modified_time}", &value)], ); } - for &arg in &["--pages=15:17", "+15:17"] { + for arg in ["--pages=15:17", "+15:17"] { let mut scenario = new_ucmd!(); let value = file_last_modified_time(&scenario, test_file_path); scenario @@ -222,7 +222,7 @@ fn test_with_no_header_trailer_option() { #[test] fn test_with_page_length_option() { let test_file_path = "test.log"; - for (arg, expected) in &[ + for (arg, expected) in [ ("100", "test_page_length.log.expected"), ("5", "test_page_length1.log.expected"), ] { @@ -265,7 +265,7 @@ fn test_with_stdin() { fn test_with_column() { let test_file_path = "column.log"; let expected_test_file_path = "column.log.expected"; - for arg in &["-3", "--column=3"] { + for arg in ["-3", "--column=3"] { let mut scenario = new_ucmd!(); let value = file_last_modified_time(&scenario, test_file_path); scenario @@ -293,7 +293,7 @@ fn test_with_column_across_option() { #[test] fn test_with_column_across_option_and_column_separator() { let test_file_path = "column.log"; - for (arg, expected) in &[ + for (arg, expected) in [ ("-s|", "column_across_sep.log.expected"), ("-Sdivide", "column_across_sep1.log.expected"), ] { diff --git a/tests/by-util/test_runcon.rs b/tests/by-util/test_runcon.rs index 047ce5769..dd4445625 100644 --- a/tests/by-util/test_runcon.rs +++ b/tests/by-util/test_runcon.rs @@ -22,11 +22,11 @@ fn help() { fn print() { new_ucmd!().succeeds(); - for &flag in &["-c", "--compute"] { + for flag in ["-c", "--compute"] { new_ucmd!().arg(flag).succeeds(); } - for &flag in &[ + for flag in [ "-t", "--type", "-u", "--user", "-r", "--role", "-l", "--range", ] { new_ucmd!().args(&[flag, "example"]).succeeds(); @@ -57,7 +57,7 @@ fn invalid() { // TODO: Enable this code once the issue is fixed in the clap version we're using. //new_ucmd!().arg("--compute=example").fails().code_is(1); - for &flag in &[ + for flag in [ "-t", "--type", "-u", "--user", "-r", "--role", "-l", "--range", ] { new_ucmd!().arg(flag).fails().code_is(1); @@ -119,7 +119,7 @@ fn custom_context() { let args = &["--compute", "--range=s0", "/bin/true"]; new_ucmd!().args(args).succeeds(); - for &(ctx, u, r) in &[ + for (ctx, u, r) in [ ("unconfined_u:unconfined_r:unconfined_t:s0", u_ud, r_ud), ("system_u:unconfined_r:unconfined_t:s0", "system_u", r_ud), ("unconfined_u:system_r:unconfined_t:s0", u_ud, "system_r"), diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index c33d1a986..4975ceff4 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -220,7 +220,7 @@ fn test_random_shuffle_contains_all_lines() { #[test] fn test_random_shuffle_two_runs_not_the_same() { - for arg in &["-R", "-k1,1R"] { + for arg in ["-R", "-k1,1R"] { // check to verify that two random shuffles are not equal; this has the // potential to fail in the very unlikely event that the random order is the same // as the starting order, or if both random sorts end up having the same order. @@ -407,7 +407,7 @@ fn test_mixed_floats_ints_chars_numeric_stable() { #[test] fn test_numeric_floats_and_ints2() { - for numeric_sort_param in &["-n", "--numeric-sort"] { + for numeric_sort_param in ["-n", "--numeric-sort"] { let input = "1.444\n8.013\n1\n-8\n1.04\n-1"; new_ucmd!() .arg(numeric_sort_param) @@ -419,7 +419,7 @@ fn test_numeric_floats_and_ints2() { #[test] fn test_numeric_floats2() { - for numeric_sort_param in &["-n", "--numeric-sort"] { + for numeric_sort_param in ["-n", "--numeric-sort"] { let input = "1.444\n8.013\n1.58590\n-8.90880\n1.040000000\n-.05"; new_ucmd!() .arg(numeric_sort_param) @@ -439,7 +439,7 @@ fn test_numeric_floats_with_nan2() { #[test] fn test_human_block_sizes2() { - for human_numeric_sort_param in &["-h", "--human-numeric-sort", "--sort=human-numeric"] { + for human_numeric_sort_param in ["-h", "--human-numeric-sort", "--sort=human-numeric"] { let input = "8981K\n909991M\n-8T\n21G\n0.8M"; new_ucmd!() .arg(human_numeric_sort_param) @@ -461,7 +461,7 @@ fn test_human_numeric_zero_stable() { #[test] fn test_month_default2() { - for month_sort_param in &["-M", "--month-sort", "--sort=month"] { + for month_sort_param in ["-M", "--month-sort", "--sort=month"] { let input = "JAn\nMAY\n000may\nJun\nFeb"; new_ucmd!() .arg(month_sort_param) @@ -555,7 +555,7 @@ fn test_keys_invalid_char_zero() { #[test] fn test_keys_with_options() { let input = "aa 3 cc\ndd 1 ff\ngg 2 cc\n"; - for param in &[ + for param in [ &["-k", "2,2n"][..], &["-k", "2n,2"][..], &["-k", "2,2", "-n"][..], @@ -571,7 +571,7 @@ fn test_keys_with_options() { #[test] fn test_keys_with_options_blanks_start() { let input = "aa 3 cc\ndd 1 ff\ngg 2 cc\n"; - for param in &[&["-k", "2b,2"][..], &["-k", "2,2", "-b"][..]] { + for param in [&["-k", "2b,2"][..], &["-k", "2,2", "-b"][..]] { new_ucmd!() .args(param) .pipe_in(input) @@ -761,7 +761,7 @@ fn test_pipe() { #[test] fn test_check() { - for diagnose_arg in &["-c", "--check", "--check=diagnose-first"] { + for diagnose_arg in ["-c", "--check", "--check=diagnose-first"] { new_ucmd!() .arg(diagnose_arg) .arg("check_fail.txt") @@ -779,7 +779,7 @@ fn test_check() { #[test] fn test_check_silent() { - for silent_arg in &["-C", "--check=silent", "--check=quiet"] { + for silent_arg in ["-C", "--check=silent", "--check=quiet"] { new_ucmd!() .arg(silent_arg) .arg("check_fail.txt") @@ -803,7 +803,7 @@ fn test_check_unique() { #[test] fn test_dictionary_and_nonprinting_conflicts() { let conflicting_args = ["n", "h", "g", "M"]; - for restricted_arg in &["d", "i"] { + for restricted_arg in ["d", "i"] { for conflicting_arg in &conflicting_args { new_ucmd!() .arg(&format!("-{}{}", restricted_arg, conflicting_arg)) diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 65db4804e..b8445543f 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -236,7 +236,7 @@ fn test_symlinks() { let mut tested: bool = false; // arbitrarily chosen symlinks with hope that the CI environment provides at least one of them - for file in &[ + for file in [ "/bin/sh", "/bin/sudoedit", "/usr/bin/ex", diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 9791e346c..23dd94352 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -522,7 +522,7 @@ fn test_tail_bytes_for_funny_files() { // gnu/tests/tail-2/tail-c.sh let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; - for &file in &["/proc/version", "/sys/kernel/profiling"] { + for file in ["/proc/version", "/sys/kernel/profiling"] { if !at.file_exists(file) { continue; } diff --git a/tests/by-util/test_tee.rs b/tests/by-util/test_tee.rs index 17e3c05cf..e89b9d438 100644 --- a/tests/by-util/test_tee.rs +++ b/tests/by-util/test_tee.rs @@ -9,7 +9,7 @@ fn test_tee_processing_multiple_operands() { // POSIX says: "Processing of at least 13 file operands shall be supported." let content = "tee_sample_content"; - for &n in &[1, 2, 12, 13] { + for n in [1, 2, 12, 13] { let files = (1..=n).map(|x| x.to_string()).collect::>(); let (at, mut ucmd) = at_and_ucmd!(); diff --git a/tests/by-util/test_timeout.rs b/tests/by-util/test_timeout.rs index fef5fd4ae..5d77e1fa0 100644 --- a/tests/by-util/test_timeout.rs +++ b/tests/by-util/test_timeout.rs @@ -39,7 +39,7 @@ fn test_command_with_args() { #[test] fn test_verbose() { - for &verbose_flag in &["-v", "--verbose"] { + for verbose_flag in ["-v", "--verbose"] { new_ucmd!() .args(&[verbose_flag, ".1", "sleep", "10"]) .fails() diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index d7a0df129..6e5d656c4 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -333,7 +333,7 @@ fn test_touch_reference() { at.touch(file_a); set_file_times(&at, file_a, start_of_year, start_of_year); assert!(at.file_exists(file_a)); - for &opt in &["-r", "--ref", "--reference"] { + for opt in ["-r", "--ref", "--reference"] { scenario .ccmd("touch") .args(&[opt, file_a, file_b]) diff --git a/tests/by-util/test_wc.rs b/tests/by-util/test_wc.rs index 1efbe81a7..3537f902d 100644 --- a/tests/by-util/test_wc.rs +++ b/tests/by-util/test_wc.rs @@ -7,7 +7,7 @@ use crate::common::util::*; #[test] fn test_count_bytes_large_stdin() { - for &n in &[ + for n in [ 0, 1, 42, diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 65773655d..580d9ea6f 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -12,7 +12,7 @@ use crate::common::util::*; #[ignore = "issue #3219"] fn test_count() { let ts = TestScenario::new(util_name!()); - for opt in &["-q", "--count", "--c"] { + for opt in ["-q", "--count", "--c"] { let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str(); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); } @@ -22,7 +22,7 @@ fn test_count() { #[test] fn test_boot() { let ts = TestScenario::new(util_name!()); - for opt in &["-b", "--boot", "--b"] { + for opt in ["-b", "--boot", "--b"] { let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str(); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); } @@ -33,7 +33,7 @@ fn test_boot() { #[ignore = "issue #3219"] fn test_heading() { let ts = TestScenario::new(util_name!()); - for opt in &["-H", "--heading", "--head"] { + for opt in ["-H", "--heading", "--head"] { // allow whitespace variation // * minor whitespace differences occur between platform built-in outputs; // specifically number of TABs between "TIME" and "COMMENT" may be variant @@ -52,7 +52,7 @@ fn test_heading() { #[ignore = "issue #3219"] fn test_short() { let ts = TestScenario::new(util_name!()); - for opt in &["-s", "--short", "--s"] { + for opt in ["-s", "--short", "--s"] { let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str(); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); } @@ -62,7 +62,7 @@ fn test_short() { #[test] fn test_login() { let ts = TestScenario::new(util_name!()); - for opt in &["-l", "--login", "--log"] { + for opt in ["-l", "--login", "--log"] { let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str(); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); } @@ -80,7 +80,7 @@ fn test_m() { #[test] fn test_process() { let ts = TestScenario::new(util_name!()); - for opt in &["-p", "--process", "--p"] { + for opt in ["-p", "--process", "--p"] { let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str(); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); } @@ -90,7 +90,7 @@ fn test_process() { #[test] fn test_runlevel() { let ts = TestScenario::new(util_name!()); - for opt in &["-r", "--runlevel", "--r"] { + for opt in ["-r", "--runlevel", "--r"] { let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str(); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); @@ -103,7 +103,7 @@ fn test_runlevel() { #[test] fn test_time() { let ts = TestScenario::new(util_name!()); - for opt in &["-t", "--time", "--t"] { + for opt in ["-t", "--time", "--t"] { let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str(); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); } @@ -120,7 +120,7 @@ fn test_mesg() { // --writable // same as -T let ts = TestScenario::new(util_name!()); - for opt in &[ + for opt in [ "-T", "-w", "--mesg", @@ -157,7 +157,7 @@ fn test_too_many_args() { #[ignore = "issue #3219"] fn test_users() { let ts = TestScenario::new(util_name!()); - for opt in &["-u", "--users", "--us"] { + for opt in ["-u", "--users", "--us"] { let actual = ts.ucmd().arg(opt).succeeds().stdout_move_str(); let expect = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str(); println!("actual: {:?}", actual); @@ -192,7 +192,7 @@ fn test_lookup() { #[test] fn test_dead() { let ts = TestScenario::new(util_name!()); - for opt in &["-d", "--dead", "--de"] { + for opt in ["-d", "--dead", "--de"] { let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str(); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); } @@ -226,7 +226,7 @@ fn test_all() { } let ts = TestScenario::new(util_name!()); - for opt in &["-a", "--all", "--a"] { + for opt in ["-a", "--all", "--a"] { let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str(); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); } diff --git a/tests/by-util/test_yes.rs b/tests/by-util/test_yes.rs index 38165e92b..7325cb4bc 100644 --- a/tests/by-util/test_yes.rs +++ b/tests/by-util/test_yes.rs @@ -55,7 +55,7 @@ fn test_long_input() { fn test_piped_to_dev_full() { use std::fs::OpenOptions; - for &append in &[true, false] { + for append in [true, false] { { let dev_full = OpenOptions::new() .write(true)