1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

all: use array intoiterator

This commit is contained in:
Terts Diepraam 2022-04-02 10:47:37 +02:00
parent c6c936f529
commit 18369dc0be
33 changed files with 145 additions and 145 deletions

View file

@ -10,7 +10,7 @@ fn unimplemented_flags_should_error_non_linux() {
let mut succeeded = Vec::new(); let mut succeeded = Vec::new();
// The following flags are only implemented in linux // The following flags are only implemented in linux
for &flag in &[ for flag in [
"direct", "direct",
"directory", "directory",
"dsync", "dsync",
@ -47,7 +47,7 @@ fn unimplemented_flags_should_error() {
let mut succeeded = Vec::new(); let mut succeeded = Vec::new();
// The following flags are not implemented // 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![ let args = vec![
String::from("dd"), String::from("dd"),
format!("--iflag={}", flag), format!("--iflag={}", flag),

View file

@ -253,7 +253,7 @@ fn read_block_size(s: Option<&str>) -> u64 {
parse_size(s) parse_size(s)
.unwrap_or_else(|e| crash!(1, "{}", format_error_message(&e, s, options::BLOCK_SIZE))) .unwrap_or_else(|e| crash!(1, "{}", format_error_message(&e, s, options::BLOCK_SIZE)))
} else { } 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(env_size) = env::var(env_var) {
if let Ok(v) = parse_size(&env_size) { if let Ok(v) = parse_size(&env_size) {
return v; return v;

View file

@ -1636,7 +1636,7 @@ fn get_leading_gen(input: &str) -> Range<usize> {
let leading_whitespace_len = input.len() - trimmed.len(); let leading_whitespace_len = input.len() - trimmed.len();
// check for inf, -inf and nan // 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()) if trimmed.is_char_boundary(allowed_prefix.len())
&& trimmed[..allowed_prefix.len()].eq_ignore_ascii_case(allowed_prefix) && trimmed[..allowed_prefix.len()].eq_ignore_ascii_case(allowed_prefix)
{ {

View file

@ -34,7 +34,7 @@ fn test_base32_encode_file() {
#[test] #[test]
fn test_decode() { 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 let input = "JBSWY3DPFQQFO33SNRSCC===\n"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg(decode_param) .arg(decode_param)
@ -56,7 +56,7 @@ fn test_garbage() {
#[test] #[test]
fn test_ignore_garbage() { 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 let input = "JBSWY\x013DPFQ\x02QFO33SNRSCC===\n"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("-d") .arg("-d")
@ -69,7 +69,7 @@ fn test_ignore_garbage() {
#[test] #[test]
fn test_wrap() { 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."; let input = "The quick brown fox jumps over the lazy dog.";
new_ucmd!() new_ucmd!()
.arg(wrap_param) .arg(wrap_param)
@ -84,7 +84,7 @@ fn test_wrap() {
#[test] #[test]
fn test_wrap_no_arg() { fn test_wrap_no_arg() {
for wrap_param in &["-w", "--wrap"] { for wrap_param in ["-w", "--wrap"] {
let ts = TestScenario::new(util_name!()); let ts = TestScenario::new(util_name!());
let expected_stderr = &format!( let expected_stderr = &format!(
"error: The argument '--wrap <wrap>\' requires a value but none was \ "error: The argument '--wrap <wrap>\' requires a value but none was \
@ -102,7 +102,7 @@ fn test_wrap_no_arg() {
#[test] #[test]
fn test_wrap_bad_arg() { fn test_wrap_bad_arg() {
for wrap_param in &["-w", "--wrap"] { for wrap_param in ["-w", "--wrap"] {
new_ucmd!() new_ucmd!()
.arg(wrap_param) .arg(wrap_param)
.arg("b") .arg("b")

View file

@ -26,7 +26,7 @@ fn test_base64_encode_file() {
#[test] #[test]
fn test_decode() { fn test_decode() {
for decode_param in &["-d", "--decode", "--dec"] { for decode_param in ["-d", "--decode", "--dec"] {
let input = "aGVsbG8sIHdvcmxkIQ=="; // spell-checker:disable-line let input = "aGVsbG8sIHdvcmxkIQ=="; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg(decode_param) .arg(decode_param)
@ -48,7 +48,7 @@ fn test_garbage() {
#[test] #[test]
fn test_ignore_garbage() { 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 let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line
new_ucmd!() new_ucmd!()
.arg("-d") .arg("-d")
@ -61,7 +61,7 @@ fn test_ignore_garbage() {
#[test] #[test]
fn test_wrap() { 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."; let input = "The quick brown fox jumps over the lazy dog.";
new_ucmd!() new_ucmd!()
.arg(wrap_param) .arg(wrap_param)
@ -75,7 +75,7 @@ fn test_wrap() {
#[test] #[test]
fn test_wrap_no_arg() { 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( new_ucmd!().arg(wrap_param).fails().stderr_contains(
&"The argument '--wrap <wrap>' requires a value but none was supplied", &"The argument '--wrap <wrap>' requires a value but none was supplied",
); );
@ -84,7 +84,7 @@ fn test_wrap_no_arg() {
#[test] #[test]
fn test_wrap_bad_arg() { fn test_wrap_bad_arg() {
for wrap_param in &["-w", "--wrap"] { for wrap_param in ["-w", "--wrap"] {
new_ucmd!() new_ucmd!()
.arg(wrap_param) .arg(wrap_param)
.arg("b") .arg("b")

View file

@ -6,7 +6,7 @@ use std::ffi::OsStr;
#[test] #[test]
fn test_help() { fn test_help() {
for help_flg in &["-h", "--help"] { for help_flg in ["-h", "--help"] {
new_ucmd!() new_ucmd!()
.arg(&help_flg) .arg(&help_flg)
.succeeds() .succeeds()
@ -17,7 +17,7 @@ fn test_help() {
#[test] #[test]
fn test_version() { fn test_version() {
for version_flg in &["-V", "--version"] { for version_flg in ["-V", "--version"] {
assert!(new_ucmd!() assert!(new_ucmd!()
.arg(&version_flg) .arg(&version_flg)
.succeeds() .succeeds()
@ -61,7 +61,7 @@ fn test_do_not_remove_suffix() {
#[test] #[test]
fn test_multiple_param() { fn test_multiple_param() {
for &multiple_param in &["-a", "--multiple", "--mul"] { for multiple_param in ["-a", "--multiple", "--mul"] {
let path = "/foo/bar/baz"; let path = "/foo/bar/baz";
new_ucmd!() new_ucmd!()
.args(&[multiple_param, path, path]) .args(&[multiple_param, path, path])
@ -72,7 +72,7 @@ fn test_multiple_param() {
#[test] #[test]
fn test_suffix_param() { fn test_suffix_param() {
for &suffix_param in &["-s", "--suffix", "--suf"] { for suffix_param in ["-s", "--suffix", "--suf"] {
let path = "/foo/bar/baz.exe"; let path = "/foo/bar/baz.exe";
new_ucmd!() new_ucmd!()
.args(&[suffix_param, ".exe", path, path]) .args(&[suffix_param, ".exe", path, path])
@ -83,7 +83,7 @@ fn test_suffix_param() {
#[test] #[test]
fn test_zero_param() { fn test_zero_param() {
for &zero_param in &["-z", "--zero", "--ze"] { for zero_param in ["-z", "--zero", "--ze"] {
let path = "/foo/bar/baz"; let path = "/foo/bar/baz";
new_ucmd!() new_ucmd!()
.args(&[zero_param, "-a", path, path]) .args(&[zero_param, "-a", path, path])

View file

@ -19,7 +19,7 @@ fn test_output_simple() {
#[test] #[test]
fn test_no_options() { fn test_no_options() {
// spell-checker:disable-next-line // 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 // Give fixture through command line file argument
new_ucmd!() new_ucmd!()
.args(&[fixture]) .args(&[fixture])
@ -36,7 +36,7 @@ fn test_no_options() {
#[test] #[test]
#[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))] #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))]
fn test_no_options_big_input() { fn test_no_options_big_input() {
for &n in &[ for n in [
0, 0,
1, 1,
42, 42,
@ -114,7 +114,7 @@ fn test_closes_file_descriptors() {
fn test_piped_to_regular_file() { fn test_piped_to_regular_file() {
use std::fs::read_to_string; use std::fs::read_to_string;
for &append in &[true, false] { for append in [true, false] {
let s = TestScenario::new(util_name!()); let s = TestScenario::new(util_name!());
let file_path = s.fixtures.plus("file.txt"); let file_path = s.fixtures.plus("file.txt");
@ -139,7 +139,7 @@ fn test_piped_to_regular_file() {
#[test] #[test]
#[cfg(unix)] #[cfg(unix)]
fn test_piped_to_dev_null() { fn test_piped_to_dev_null() {
for &append in &[true, false] { for append in [true, false] {
let s = TestScenario::new(util_name!()); let s = TestScenario::new(util_name!());
{ {
let dev_null = OpenOptions::new() let dev_null = OpenOptions::new()
@ -159,7 +159,7 @@ fn test_piped_to_dev_null() {
#[test] #[test]
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))] #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))]
fn test_piped_to_dev_full() { fn test_piped_to_dev_full() {
for &append in &[true, false] { for append in [true, false] {
let s = TestScenario::new(util_name!()); let s = TestScenario::new(util_name!());
{ {
let dev_full = OpenOptions::new() let dev_full = OpenOptions::new()
@ -192,7 +192,7 @@ fn test_directory_and_file() {
let s = TestScenario::new(util_name!()); let s = TestScenario::new(util_name!());
s.fixtures.mkdir("test_directory2"); s.fixtures.mkdir("test_directory2");
// spell-checker:disable-next-line // 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() s.ucmd()
.args(&["test_directory2", fixture]) .args(&["test_directory2", fixture])
.fails() .fails()
@ -264,7 +264,7 @@ fn test_numbered_lines_no_trailing_newline() {
#[test] #[test]
fn test_stdin_show_nonprinting() { 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!() new_ucmd!()
.args(&[same_param]) .args(&[same_param])
.pipe_in("\t\0\n") .pipe_in("\t\0\n")
@ -275,7 +275,7 @@ fn test_stdin_show_nonprinting() {
#[test] #[test]
fn test_stdin_show_tabs() { 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!() new_ucmd!()
.args(&[same_param]) .args(&[same_param])
.pipe_in("\t\0\n") .pipe_in("\t\0\n")
@ -286,7 +286,7 @@ fn test_stdin_show_tabs() {
#[test] #[test]
fn test_stdin_show_ends() { 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!() new_ucmd!()
.args(&[same_param, "-"]) .args(&[same_param, "-"])
.pipe_in("\t\0\n\t") .pipe_in("\t\0\n\t")
@ -317,7 +317,7 @@ fn test_show_ends_crlf() {
#[test] #[test]
fn test_stdin_show_all() { 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!() new_ucmd!()
.args(&[same_param]) .args(&[same_param])
.pipe_in("\t\0\n") .pipe_in("\t\0\n")
@ -346,7 +346,7 @@ fn test_stdin_nonprinting_and_tabs() {
#[test] #[test]
fn test_stdin_squeeze_blank() { fn test_stdin_squeeze_blank() {
for same_param in &["-s", "--squeeze-blank", "--squeeze"] { for same_param in ["-s", "--squeeze-blank", "--squeeze"] {
new_ucmd!() new_ucmd!()
.arg(same_param) .arg(same_param)
.pipe_in("\n\na\n\n\n\n\nb\n\n\n") .pipe_in("\n\na\n\n\n\n\nb\n\n\n")
@ -358,7 +358,7 @@ fn test_stdin_squeeze_blank() {
#[test] #[test]
fn test_stdin_number_non_blank() { fn test_stdin_number_non_blank() {
// spell-checker:disable-next-line // 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!() new_ucmd!()
.arg(same_param) .arg(same_param)
.arg("-") .arg("-")
@ -371,7 +371,7 @@ fn test_stdin_number_non_blank() {
#[test] #[test]
fn test_non_blank_overrides_number() { fn test_non_blank_overrides_number() {
// spell-checker:disable-next-line // spell-checker:disable-next-line
for &same_param in &["-b", "--number-nonblank"] { for same_param in ["-b", "--number-nonblank"] {
new_ucmd!() new_ucmd!()
.args(&[same_param, "-"]) .args(&[same_param, "-"])
.pipe_in("\na\nb\n\n\nc") .pipe_in("\na\nb\n\n\nc")
@ -382,7 +382,7 @@ fn test_non_blank_overrides_number() {
#[test] #[test]
fn test_squeeze_blank_before_numbering() { fn test_squeeze_blank_before_numbering() {
for &same_param in &["-s", "--squeeze-blank"] { for same_param in ["-s", "--squeeze-blank"] {
new_ucmd!() new_ucmd!()
.args(&[same_param, "-n", "-"]) .args(&[same_param, "-n", "-"])
.pipe_in("a\n\n\nb") .pipe_in("a\n\n\nb")

View file

@ -23,7 +23,7 @@ fn help() {
#[test] #[test]
fn reference_errors() { fn reference_errors() {
for args in &[ for args in [
&["--verbose", "--reference"] as &[&str], &["--verbose", "--reference"] as &[&str],
&["--verbose", "--reference=/dev/null"], &["--verbose", "--reference=/dev/null"],
&["--verbose", "--reference=/inexistent", "/dev/null"], &["--verbose", "--reference=/inexistent", "/dev/null"],
@ -34,7 +34,7 @@ fn reference_errors() {
#[test] #[test]
fn recursive_errors() { fn recursive_errors() {
for args in &[ for args in [
&["--verbose", "-P"] as &[&str], &["--verbose", "-P"] as &[&str],
&["--verbose", "-H"], &["--verbose", "-H"],
&["--verbose", "-L"], &["--verbose", "-L"],

View file

@ -60,7 +60,7 @@ fn test_1() {
#[test] #[test]
fn test_fail_silently() { fn test_fail_silently() {
if get_effective_gid() != 0 { if get_effective_gid() != 0 {
for opt in &["-f", "--silent", "--quiet", "--sil", "--qui"] { for opt in ["-f", "--silent", "--quiet", "--sil", "--qui"] {
new_ucmd!() new_ucmd!()
.arg(opt) .arg(opt)
.arg("bin") .arg("bin")
@ -74,7 +74,7 @@ fn test_fail_silently() {
#[test] #[test]
fn test_preserve_root() { fn test_preserve_root() {
// It's weird that on OS X, `realpath /etc/..` returns '/private' // It's weird that on OS X, `realpath /etc/..` returns '/private'
for d in &[ for d in [
"/", "/",
"/////tmp///../../../../", "/////tmp///../../../../",
"../../../../../../../../../../../../../../", "../../../../../../../../../../../../../../",
@ -92,7 +92,7 @@ fn test_preserve_root() {
#[test] #[test]
fn test_preserve_root_symlink() { fn test_preserve_root_symlink() {
let file = "test_chgrp_symlink2root"; let file = "test_chgrp_symlink2root";
for d in &[ for d in [
"/", "/",
"////tmp//../../../../", "////tmp//../../../../",
"..//../../..//../..//../../../../../../../../", "..//../../..//../..//../../../../../../../../",
@ -299,7 +299,7 @@ fn test_traverse_symlinks() {
} }
let (first_group, second_group) = (groups[0], groups[1]); 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), (&[][..] as &[&str], false, false),
(&["-H"][..], true, false), (&["-H"][..], true, false),
(&["-P"][..], false, false), (&["-P"][..], false, false),

View file

@ -532,7 +532,7 @@ fn test_chmod_strip_minus_from_mode() {
#[test] #[test]
fn test_chmod_keep_setgid() { fn test_chmod_keep_setgid() {
for &(from, arg, to) in &[ for (from, arg, to) in [
(0o7777, "777", 0o46777), (0o7777, "777", 0o46777),
(0o7777, "=777", 0o40777), (0o7777, "=777", 0o40777),
(0o7777, "0777", 0o46777), (0o7777, "0777", 0o46777),

View file

@ -76,7 +76,7 @@ fn output_delimiter_require_arg() {
#[cfg_attr(not(feature = "test_unimplemented"), ignore)] #[cfg_attr(not(feature = "test_unimplemented"), ignore)]
#[test] #[test]
fn zero_terminated() { fn zero_terminated() {
for &param in &["-z", "--zero-terminated"] { for param in ["-z", "--zero-terminated"] {
new_ucmd!() new_ucmd!()
.args(&[param, "a", "b"]) .args(&[param, "a", "b"])
.fails() .fails()

View file

@ -1469,7 +1469,7 @@ fn test_canonicalize_symlink() {
#[test] #[test]
fn test_copy_through_just_created_symlink() { 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!(); let (at, mut ucmd) = at_and_ucmd!();
at.mkdir("a"); at.mkdir("a");
at.mkdir("b"); at.mkdir("b");
@ -1606,7 +1606,7 @@ fn test_cp_dir_vs_file() {
fn test_cp_overriding_arguments() { fn test_cp_overriding_arguments() {
let s = TestScenario::new(util_name!()); let s = TestScenario::new(util_name!());
s.fixtures.touch("file1"); s.fixtures.touch("file1");
for (arg1, arg2) in &[ for (arg1, arg2) in [
#[cfg(not(windows))] #[cfg(not(windows))]
("--remove-destination", "--force"), ("--remove-destination", "--force"),
#[cfg(not(windows))] #[cfg(not(windows))]

View file

@ -41,7 +41,7 @@ static COMPLEX_SEQUENCE: &TestedSequence = &TestedSequence {
#[test] #[test]
fn test_byte_sequence() { fn test_byte_sequence() {
for &param in &["-b", "--bytes", "--byt"] { for param in ["-b", "--bytes", "--byt"] {
for example_seq in EXAMPLE_SEQUENCES { for example_seq in EXAMPLE_SEQUENCES {
new_ucmd!() new_ucmd!()
.args(&[param, example_seq.sequence, INPUT]) .args(&[param, example_seq.sequence, INPUT])
@ -53,7 +53,7 @@ fn test_byte_sequence() {
#[test] #[test]
fn test_char_sequence() { fn test_char_sequence() {
for &param in &["-c", "--characters", "--char"] { for param in ["-c", "--characters", "--char"] {
for example_seq in EXAMPLE_SEQUENCES { 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. //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!() new_ucmd!()
@ -66,7 +66,7 @@ fn test_char_sequence() {
#[test] #[test]
fn test_field_sequence() { fn test_field_sequence() {
for &param in &["-f", "--fields", "--fie"] { for param in ["-f", "--fields", "--fie"] {
for example_seq in EXAMPLE_SEQUENCES { for example_seq in EXAMPLE_SEQUENCES {
new_ucmd!() new_ucmd!()
.args(&[param, example_seq.sequence, INPUT]) .args(&[param, example_seq.sequence, INPUT])
@ -78,7 +78,7 @@ fn test_field_sequence() {
#[test] #[test]
fn test_specify_delimiter() { fn test_specify_delimiter() {
for &param in &["-d", "--delimiter", "--del"] { for param in ["-d", "--delimiter", "--del"] {
new_ucmd!() new_ucmd!()
.args(&[param, ":", "-f", COMPLEX_SEQUENCE.sequence, INPUT]) .args(&[param, ":", "-f", COMPLEX_SEQUENCE.sequence, INPUT])
.succeeds() .succeeds()
@ -115,7 +115,7 @@ fn test_output_delimiter() {
#[test] #[test]
fn test_complement() { fn test_complement() {
for param in &["--complement", "--com"] { for param in ["--complement", "--com"] {
new_ucmd!() new_ucmd!()
.args(&["-d_", param, "-f", "2"]) .args(&["-d_", param, "-f", "2"])
.pipe_in("9_1\n8_2\n7_3") .pipe_in("9_1\n8_2\n7_3")
@ -135,7 +135,7 @@ fn test_zero_terminated() {
#[test] #[test]
fn test_only_delimited() { fn test_only_delimited() {
for param in &["-s", "--only-delimited", "--only-del"] { for param in ["-s", "--only-delimited", "--only-del"] {
new_ucmd!() new_ucmd!()
.args(&["-d_", param, "-f", "1"]) .args(&["-d_", param, "-f", "1"])
.pipe_in("91\n82\n7_3") .pipe_in("91\n82\n7_3")

View file

@ -7,7 +7,7 @@ use rust_users::*;
#[test] #[test]
fn test_date_email() { 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(); new_ucmd!().arg(param).succeeds();
} }
} }
@ -23,7 +23,7 @@ fn test_date_rfc_3339() {
let re = Regex::new(rfc_regexp).unwrap(); let re = Regex::new(rfc_regexp).unwrap();
// Check that the output matches the regexp // Check that the output matches the regexp
for param in &["--rfc-3339", "--rfc-3"] { for param in ["--rfc-3339", "--rfc-3"] {
scene scene
.ucmd() .ucmd()
.arg(format!("{}=ns", param)) .arg(format!("{}=ns", param))
@ -40,21 +40,21 @@ fn test_date_rfc_3339() {
#[test] #[test]
fn test_date_rfc_8601() { fn test_date_rfc_8601() {
for param in &["--iso-8601", "--i"] { for param in ["--iso-8601", "--i"] {
new_ucmd!().arg(format!("{}=ns", param)).succeeds(); new_ucmd!().arg(format!("{}=ns", param)).succeeds();
} }
} }
#[test] #[test]
fn test_date_rfc_8601_second() { 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(); new_ucmd!().arg(format!("{}=second", param)).succeeds();
} }
} }
#[test] #[test]
fn test_date_utc() { fn test_date_utc() {
for param in &["--universal", "--utc", "--uni", "--u"] { for param in ["--universal", "--utc", "--uni", "--u"] {
new_ucmd!().arg(param).succeeds(); new_ucmd!().arg(param).succeeds();
} }
} }

View file

@ -463,7 +463,7 @@ fn test_zeros_to_stdout() {
#[cfg(target_pointer_width = "32")] #[cfg(target_pointer_width = "32")]
#[test] #[test]
fn test_oversized_bs_32_bit() { fn test_oversized_bs_32_bit() {
for bs_param in &["bs", "ibs", "obs", "cbs"] { for bs_param in ["bs", "ibs", "obs", "cbs"] {
new_ucmd!() new_ucmd!()
.args(&[format!("{}=5GB", bs_param)]) .args(&[format!("{}=5GB", bs_param)])
.run() .run()

View file

@ -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 // 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" } // 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!( new_ucmd!().arg("-u").arg(var).run().stderr_only(format!(
"env: cannot unset {}: Invalid argument", "env: cannot unset {}: Invalid argument",
var.quote() var.quote()

View file

@ -49,7 +49,7 @@ fn test_id_single_user() {
.code_is(exp_result.code()); .code_is(exp_result.code());
// u/g/G z/n // u/g/G z/n
for &opt in &["--user", "--group", "--groups"] { for opt in ["--user", "--group", "--groups"] {
let mut args = vec![opt]; let mut args = vec![opt];
args.extend_from_slice(&test_users); args.extend_from_slice(&test_users);
exp_result = unwrap_or_return!(expected_result(&ts, &args)); exp_result = unwrap_or_return!(expected_result(&ts, &args));
@ -108,7 +108,7 @@ fn test_id_single_user_non_existing() {
#[cfg(unix)] #[cfg(unix)]
fn test_id_name() { fn test_id_name() {
let ts = TestScenario::new(util_name!()); let ts = TestScenario::new(util_name!());
for &opt in &["--user", "--group", "--groups"] { for opt in ["--user", "--group", "--groups"] {
let args = [opt, "--name"]; let args = [opt, "--name"];
let result = ts.ucmd().args(&args).run(); let result = ts.ucmd().args(&args).run();
let exp_result = unwrap_or_return!(expected_result(&ts, &args)); let exp_result = unwrap_or_return!(expected_result(&ts, &args));
@ -127,7 +127,7 @@ fn test_id_name() {
#[cfg(unix)] #[cfg(unix)]
fn test_id_real() { fn test_id_real() {
let ts = TestScenario::new(util_name!()); let ts = TestScenario::new(util_name!());
for &opt in &["--user", "--group", "--groups"] { for opt in ["--user", "--group", "--groups"] {
let args = [opt, "--real"]; let args = [opt, "--real"];
let result = ts.ucmd().args(&args).run(); let result = ts.ucmd().args(&args).run();
let exp_result = unwrap_or_return!(expected_result(&ts, &args)); let exp_result = unwrap_or_return!(expected_result(&ts, &args));
@ -188,7 +188,7 @@ fn test_id_multiple_users() {
.code_is(exp_result.code()); .code_is(exp_result.code());
// u/g/G z/n // u/g/G z/n
for &opt in &["--user", "--group", "--groups"] { for opt in ["--user", "--group", "--groups"] {
let mut args = vec![opt]; let mut args = vec![opt];
args.extend_from_slice(&test_users); args.extend_from_slice(&test_users);
exp_result = unwrap_or_return!(expected_result(&ts, &args)); 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()); .code_is(exp_result.code());
// u/g/G z/n // u/g/G z/n
for &opt in &["--user", "--group", "--groups"] { for opt in ["--user", "--group", "--groups"] {
let mut args = vec![opt]; let mut args = vec![opt];
args.extend_from_slice(&test_users); args.extend_from_slice(&test_users);
exp_result = unwrap_or_return!(expected_result(&ts, &args)); exp_result = unwrap_or_return!(expected_result(&ts, &args));
@ -297,14 +297,14 @@ fn test_id_multiple_users_non_existing() {
#[cfg(unix)] #[cfg(unix)]
fn test_id_default_format() { fn test_id_default_format() {
let ts = TestScenario::new(util_name!()); 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 // id: cannot print only names or real IDs in default format
let args = [opt1]; let args = [opt1];
ts.ucmd() ts.ucmd()
.args(&args) .args(&args)
.fails() .fails()
.stderr_only(unwrap_or_return!(expected_result(&ts, &args)).stderr_str()); .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 // u/g/G n/r
let args = [opt2, opt1]; let args = [opt2, opt1];
let result = ts.ucmd().args(&args).run(); let result = ts.ucmd().args(&args).run();
@ -315,7 +315,7 @@ fn test_id_default_format() {
.code_is(exp_result.code()); .code_is(exp_result.code());
} }
} }
for &opt2 in &["--user", "--group", "--groups"] { for opt2 in ["--user", "--group", "--groups"] {
// u/g/G // u/g/G
let args = [opt2]; let args = [opt2];
ts.ucmd() ts.ucmd()
@ -329,20 +329,20 @@ fn test_id_default_format() {
#[cfg(unix)] #[cfg(unix)]
fn test_id_zero() { fn test_id_zero() {
let ts = TestScenario::new(util_name!()); 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 // id: option --zero not permitted in default format
ts.ucmd() ts.ucmd()
.args(&[z_flag]) .args(&[z_flag])
.fails() .fails()
.stderr_only(unwrap_or_return!(expected_result(&ts, &[z_flag])).stderr_str()); .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 // id: cannot print only names or real IDs in default format
let args = [opt1, z_flag]; let args = [opt1, z_flag];
ts.ucmd() ts.ucmd()
.args(&args) .args(&args)
.fails() .fails()
.stderr_only(unwrap_or_return!(expected_result(&ts, &args)).stderr_str()); .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 // u/g/G n/r z
let args = [opt2, z_flag, opt1]; let args = [opt2, z_flag, opt1];
let result = ts.ucmd().args(&args).run(); let result = ts.ucmd().args(&args).run();
@ -353,7 +353,7 @@ fn test_id_zero() {
.code_is(exp_result.code()); .code_is(exp_result.code());
} }
} }
for &opt2 in &["--user", "--group", "--groups"] { for opt2 in ["--user", "--group", "--groups"] {
// u/g/G z // u/g/G z
let args = [opt2, z_flag]; let args = [opt2, z_flag];
ts.ucmd() ts.ucmd()
@ -373,18 +373,18 @@ fn test_id_context() {
return; return;
} }
let ts = TestScenario::new(util_name!()); let ts = TestScenario::new(util_name!());
for c_flag in &["-Z", "--context"] { for c_flag in ["-Z", "--context"] {
ts.ucmd() ts.ucmd()
.args(&[c_flag]) .args(&[c_flag])
.succeeds() .succeeds()
.stdout_only(unwrap_or_return!(expected_result(&ts, &[c_flag])).stdout_str()); .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]; let args = [c_flag, z_flag];
ts.ucmd() ts.ucmd()
.args(&args) .args(&args)
.succeeds() .succeeds()
.stdout_only(unwrap_or_return!(expected_result(&ts, &args)).stdout_str()); .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 // id: cannot print only names or real IDs in default format
let args = [opt1, c_flag]; let args = [opt1, c_flag];
ts.ucmd() ts.ucmd()
@ -396,7 +396,7 @@ fn test_id_context() {
.args(&args) .args(&args)
.succeeds() .succeeds()
.stdout_only(unwrap_or_return!(expected_result(&ts, &args)).stdout_str()); .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 // u/g/G n/r z Z
// for now, we print clap's standard response for "conflicts_with" instead of: // for now, we print clap's standard response for "conflicts_with" instead of:
// id: cannot print "only" of more than one choice // id: cannot print "only" of more than one choice
@ -409,7 +409,7 @@ fn test_id_context() {
// .code_is(exp_result.code()); // .code_is(exp_result.code());
} }
} }
for &opt2 in &["--user", "--group", "--groups"] { for opt2 in ["--user", "--group", "--groups"] {
// u/g/G z Z // u/g/G z Z
// for now, we print clap's standard response for "conflicts_with" instead of: // for now, we print clap's standard response for "conflicts_with" instead of:
// id: cannot print "only" of more than one choice // id: cannot print "only" of more than one choice

View file

@ -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-3"));
at.touch(&at.plus_as_string("test-width-4")); at.touch(&at.plus_as_string("test-width-4"));
for option in &[ for option in [
"-w 100", "-w 100",
"-w=100", "-w=100",
"--width=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"); .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 scene
.ucmd() .ucmd()
.args(&option.split(' ').collect::<Vec<_>>()) .args(&option.split(' ').collect::<Vec<_>>())
@ -628,7 +628,7 @@ fn test_ls_width() {
.stdout_only("test-width-1 test-width-3\ntest-width-2 test-width-4\n"); .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 scene
.ucmd() .ucmd()
.args(&option.split(' ').collect::<Vec<_>>()) .args(&option.split(' ').collect::<Vec<_>>())
@ -637,7 +637,7 @@ fn test_ls_width() {
.stdout_only("test-width-1\ntest-width-2\ntest-width-3\ntest-width-4\n"); .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 scene
.ucmd() .ucmd()
.args(&option.split(' ').collect::<Vec<_>>()) .args(&option.split(' ').collect::<Vec<_>>())
@ -653,7 +653,7 @@ fn test_ls_width() {
.fails() .fails()
.stderr_contains("invalid line width"); .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 scene
.ucmd() .ucmd()
.args(&option.split(' ').collect::<Vec<_>>()) .args(&option.split(' ').collect::<Vec<_>>())
@ -1088,9 +1088,9 @@ fn test_ls_long_total_size() {
let result = scene.ucmd().arg(arg).succeeds(); let result = scene.ucmd().arg(arg).succeeds();
result.stdout_contains(expected_prints["long_vanilla"]); 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(); 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"] expected_prints["long_si"]
} else { } else {
expected_prints["long_human_readable"] expected_prints["long_human_readable"]
@ -1158,7 +1158,7 @@ fn test_ls_long_formats() {
.stdout_matches(&re_three_num); .stdout_matches(&re_three_num);
} }
for arg in &[ for arg in [
"-l", // only group and owner "-l", // only group and owner
"-g --author", // only author and group "-g --author", // only author and group
"-o --author", // only author and owner "-o --author", // only author and owner
@ -1184,7 +1184,7 @@ fn test_ls_long_formats() {
} }
} }
for arg in &[ for arg in [
"-g", // only group "-g", // only group
"-gl", // only group "-gl", // only group
"-o", // only owner "-o", // only owner
@ -1213,7 +1213,7 @@ fn test_ls_long_formats() {
} }
} }
for arg in &[ for arg in [
"-og", "-og",
"-ogl", "-ogl",
"-lgo", "-lgo",
@ -1255,7 +1255,7 @@ fn test_ls_oneline() {
// Bit of a weird situation: in the tests oneline and columns have the same output, // Bit of a weird situation: in the tests oneline and columns have the same output,
// except on Windows. // except on Windows.
for option in &["-1", "--format=single-column"] { for option in ["-1", "--format=single-column"] {
scene scene
.ucmd() .ucmd()
.arg(option) .arg(option)
@ -1376,7 +1376,7 @@ fn test_ls_long_ctime() {
at.touch("test-long-ctime-1"); 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(); let result = scene.ucmd().arg("-l").arg(arg).succeeds();
// Should show the time on Unix, but question marks on windows. // 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 // 3 was accessed last in the read
// So the order should be 2 3 4 1 // 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(); let result = scene.ucmd().arg("-t").arg(arg).succeeds();
at.open("test-3").metadata().unwrap().accessed().unwrap(); at.open("test-3").metadata().unwrap().accessed().unwrap();
at.open("test-4").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)); assert!(!result.stdout_str().contains(z_with_colors));
// Color should be enabled // Color should be enabled
for param in &["--color", "--col", "--color=always", "--col=always"] { for param in ["--color", "--col", "--color=always", "--col=always"] {
scene scene
.ucmd() .ucmd()
.arg(param) .arg(param)
@ -2034,7 +2034,7 @@ fn test_ls_success_on_c_drv_root_windows() {
fn test_ls_version_sort() { fn test_ls_version_sort() {
let scene = TestScenario::new(util_name!()); let scene = TestScenario::new(util_name!());
let at = &scene.fixtures; let at = &scene.fixtures;
for filename in &[ for filename in [
"a2", "a2",
"b1", "b1",
"b20", "b20",
@ -2130,7 +2130,7 @@ fn test_ls_quoting_style() {
.succeeds() .succeeds()
.stdout_only("'one'$'\\n''two'\n"); .stdout_only("'one'$'\\n''two'\n");
for (arg, correct) in &[ for (arg, correct) in [
("--quoting-style=literal", "one?two"), ("--quoting-style=literal", "one?two"),
("-N", "one?two"), ("-N", "one?two"),
("--literal", "one?two"), ("--literal", "one?two"),
@ -2154,7 +2154,7 @@ fn test_ls_quoting_style() {
.stdout_only(format!("{}\n", correct)); .stdout_only(format!("{}\n", correct));
} }
for (arg, correct) in &[ for (arg, correct) in [
("--quoting-style=literal", "one\ntwo"), ("--quoting-style=literal", "one\ntwo"),
("-N", "one\ntwo"), ("-N", "one\ntwo"),
("--literal", "one\ntwo"), ("--literal", "one\ntwo"),
@ -2170,7 +2170,7 @@ fn test_ls_quoting_style() {
.stdout_only(format!("{}\n", correct)); .stdout_only(format!("{}\n", correct));
} }
for (arg, correct) in &[ for (arg, correct) in [
("--quoting-style=literal", "one\\two"), ("--quoting-style=literal", "one\\two"),
("-N", "one\\two"), ("-N", "one\\two"),
("--quoting-style=c", "\"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 // Tests for a character that forces quotation in shell-style escaping
// after a character in a dollar expression // after a character in a dollar expression
at.touch("one\n&two"); at.touch("one\n&two");
for (arg, correct) in &[ for (arg, correct) in [
("--quoting-style=shell-escape", "'one'$'\\n''&two'"), ("--quoting-style=shell-escape", "'one'$'\\n''&two'"),
("--quoting-style=shell-escape-always", "'one'$'\\n''&two'"), ("--quoting-style=shell-escape-always", "'one'$'\\n''&two'"),
] { ] {
@ -2215,7 +2215,7 @@ fn test_ls_quoting_style() {
.succeeds() .succeeds()
.stdout_only("'one two'\n"); .stdout_only("'one two'\n");
for (arg, correct) in &[ for (arg, correct) in [
("--quoting-style=literal", "one two"), ("--quoting-style=literal", "one two"),
("-N", "one two"), ("-N", "one two"),
("--literal", "one two"), ("--literal", "one two"),
@ -2241,7 +2241,7 @@ fn test_ls_quoting_style() {
scene.ucmd().arg("one").succeeds().stdout_only("one\n"); scene.ucmd().arg("one").succeeds().stdout_only("one\n");
for (arg, correct) in &[ for (arg, correct) in [
("--quoting-style=literal", "one"), ("--quoting-style=literal", "one"),
("-N", "one"), ("-N", "one"),
("--quoting-style=c", "\"one\""), ("--quoting-style=c", "\"one\""),
@ -2649,7 +2649,7 @@ fn test_ls_deref_command_line_dir() {
fn test_ls_sort_extension() { fn test_ls_sort_extension() {
let scene = TestScenario::new(util_name!()); let scene = TestScenario::new(util_name!());
let at = &scene.fixtures; let at = &scene.fixtures;
for filename in &[ for filename in [
"file1", "file1",
"file2", "file2",
"anotherFile", "anotherFile",
@ -2831,7 +2831,7 @@ fn test_ls_context2() {
return; return;
} }
let ts = TestScenario::new(util_name!()); let ts = TestScenario::new(util_name!());
for c_flag in &["-Z", "--context"] { for c_flag in ["-Z", "--context"] {
ts.ucmd() ts.ucmd()
.args(&[c_flag, &"/"]) .args(&[c_flag, &"/"])
.succeeds() .succeeds()
@ -2851,7 +2851,7 @@ fn test_ls_context_format() {
// NOTE: // NOTE:
// --format=long/verbose matches the output of GNU's ls for --context // --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. // except for the size count which may differ to the size count reported by GNU's ls.
for word in &[ for word in [
"across", "across",
"commas", "commas",
"horizontal", "horizontal",

View file

@ -42,7 +42,7 @@ fn test_padding_with_overflow() {
#[test] #[test]
fn test_sections_and_styles() { fn test_sections_and_styles() {
// spell-checker:disable // spell-checker:disable
for &(fixture, output) in &[ for (fixture, output) in [
( (
"section.txt", "section.txt",
"\nHEADER1\nHEADER2\n\n1 |BODY1\n2 \ "\nHEADER1\nHEADER2\n\n1 |BODY1\n2 \

View file

@ -484,7 +484,7 @@ fn test_delimiter_with_padding_and_fields() {
#[test] #[test]
fn test_round() { fn test_round() {
for (method, exp) in &[ for (method, exp) in [
("from-zero", ["9.1K", "-9.1K", "9.1K", "-9.1K"]), ("from-zero", ["9.1K", "-9.1K", "9.1K", "-9.1K"]),
("towards-zero", ["9.0K", "-9.0K", "9.0K", "-9.0K"]), ("towards-zero", ["9.0K", "-9.0K", "9.0K", "-9.0K"]),
("up", ["9.1K", "-9.0K", "9.1K", "-9.0K"]), ("up", ["9.1K", "-9.0K", "9.1K", "-9.0K"]),

View file

@ -70,12 +70,12 @@ fn test_2files() {
let file1 = tmpdir.join("test1"); let file1 = tmpdir.join("test1");
let file2 = tmpdir.join("test2"); 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); println!("number: {} letter:{}", n, a);
} }
// spell-checker:disable-next-line // 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(); let mut f = File::create(&path).unwrap();
assert!( assert!(
f.write_all(data.as_bytes()).is_ok(), f.write_all(data.as_bytes()).is_ok(),
@ -127,7 +127,7 @@ fn test_from_mixed() {
// spell-checker:disable-next-line // spell-checker:disable-next-line
let (data1, data2, data3) = ("abcdefg", "hijklmnop", "qrstuvwxyz\n"); 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(); let mut f = File::create(&path).unwrap();
assert!( assert!(
f.write_all(data.as_bytes()).is_ok(), f.write_all(data.as_bytes()).is_ok(),

View file

@ -82,8 +82,8 @@ static EXAMPLE_DATA: &[TestData] = &[
#[test] #[test]
fn test_combine_pairs_of_lines() { fn test_combine_pairs_of_lines() {
for &s in &["-s", "--serial"] { for s in ["-s", "--serial"] {
for &d in &["-d", "--delimiters"] { for d in ["-d", "--delimiters"] {
new_ucmd!() new_ucmd!()
.args(&[s, d, "\t\n", "html_colors.txt"]) .args(&[s, d, "\t\n", "html_colors.txt"])
.run() .run()
@ -94,7 +94,7 @@ fn test_combine_pairs_of_lines() {
#[test] #[test]
fn test_multi_stdin() { fn test_multi_stdin() {
for &d in &["-d", "--delimiters"] { for d in ["-d", "--delimiters"] {
new_ucmd!() new_ucmd!()
.args(&[d, "\t\n", "-", "-"]) .args(&[d, "\t\n", "-", "-"])
.pipe_in_fixture("html_colors.txt") .pipe_in_fixture("html_colors.txt")

View file

@ -69,7 +69,7 @@ fn test_with_long_header_option() {
let test_file_path = "test_one_page.log"; let test_file_path = "test_one_page.log";
let expected_test_file_path = "test_one_page_header.log.expected"; let expected_test_file_path = "test_one_page_header.log.expected";
let header = "new file"; 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 mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path); let value = file_last_modified_time(&scenario, test_file_path);
scenario scenario
@ -87,7 +87,7 @@ fn test_with_long_header_option() {
fn test_with_double_space_option() { fn test_with_double_space_option() {
let test_file_path = "test_one_page.log"; let test_file_path = "test_one_page.log";
let expected_test_file_path = "test_one_page_double_line.log.expected"; 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 mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path); let value = file_last_modified_time(&scenario, test_file_path);
scenario scenario
@ -183,7 +183,7 @@ fn test_with_page_range() {
let test_file_path = "test.log"; let test_file_path = "test.log";
let expected_test_file_path = "test_page_range_1.log.expected"; let expected_test_file_path = "test_page_range_1.log.expected";
let expected_test_file_path1 = "test_page_range_2.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 mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path); let value = file_last_modified_time(&scenario, test_file_path);
scenario scenario
@ -194,7 +194,7 @@ fn test_with_page_range() {
&[("{last_modified_time}", &value)], &[("{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 mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path); let value = file_last_modified_time(&scenario, test_file_path);
scenario scenario
@ -222,7 +222,7 @@ fn test_with_no_header_trailer_option() {
#[test] #[test]
fn test_with_page_length_option() { fn test_with_page_length_option() {
let test_file_path = "test.log"; let test_file_path = "test.log";
for (arg, expected) in &[ for (arg, expected) in [
("100", "test_page_length.log.expected"), ("100", "test_page_length.log.expected"),
("5", "test_page_length1.log.expected"), ("5", "test_page_length1.log.expected"),
] { ] {
@ -265,7 +265,7 @@ fn test_with_stdin() {
fn test_with_column() { fn test_with_column() {
let test_file_path = "column.log"; let test_file_path = "column.log";
let expected_test_file_path = "column.log.expected"; 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 mut scenario = new_ucmd!();
let value = file_last_modified_time(&scenario, test_file_path); let value = file_last_modified_time(&scenario, test_file_path);
scenario scenario
@ -293,7 +293,7 @@ fn test_with_column_across_option() {
#[test] #[test]
fn test_with_column_across_option_and_column_separator() { fn test_with_column_across_option_and_column_separator() {
let test_file_path = "column.log"; let test_file_path = "column.log";
for (arg, expected) in &[ for (arg, expected) in [
("-s|", "column_across_sep.log.expected"), ("-s|", "column_across_sep.log.expected"),
("-Sdivide", "column_across_sep1.log.expected"), ("-Sdivide", "column_across_sep1.log.expected"),
] { ] {

View file

@ -22,11 +22,11 @@ fn help() {
fn print() { fn print() {
new_ucmd!().succeeds(); new_ucmd!().succeeds();
for &flag in &["-c", "--compute"] { for flag in ["-c", "--compute"] {
new_ucmd!().arg(flag).succeeds(); new_ucmd!().arg(flag).succeeds();
} }
for &flag in &[ for flag in [
"-t", "--type", "-u", "--user", "-r", "--role", "-l", "--range", "-t", "--type", "-u", "--user", "-r", "--role", "-l", "--range",
] { ] {
new_ucmd!().args(&[flag, "example"]).succeeds(); 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. // 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); //new_ucmd!().arg("--compute=example").fails().code_is(1);
for &flag in &[ for flag in [
"-t", "--type", "-u", "--user", "-r", "--role", "-l", "--range", "-t", "--type", "-u", "--user", "-r", "--role", "-l", "--range",
] { ] {
new_ucmd!().arg(flag).fails().code_is(1); new_ucmd!().arg(flag).fails().code_is(1);
@ -119,7 +119,7 @@ fn custom_context() {
let args = &["--compute", "--range=s0", "/bin/true"]; let args = &["--compute", "--range=s0", "/bin/true"];
new_ucmd!().args(args).succeeds(); 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), ("unconfined_u:unconfined_r:unconfined_t:s0", u_ud, r_ud),
("system_u:unconfined_r:unconfined_t:s0", "system_u", r_ud), ("system_u:unconfined_r:unconfined_t:s0", "system_u", r_ud),
("unconfined_u:system_r:unconfined_t:s0", u_ud, "system_r"), ("unconfined_u:system_r:unconfined_t:s0", u_ud, "system_r"),

View file

@ -220,7 +220,7 @@ fn test_random_shuffle_contains_all_lines() {
#[test] #[test]
fn test_random_shuffle_two_runs_not_the_same() { 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 // 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 // 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. // 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] #[test]
fn test_numeric_floats_and_ints2() { 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"; let input = "1.444\n8.013\n1\n-8\n1.04\n-1";
new_ucmd!() new_ucmd!()
.arg(numeric_sort_param) .arg(numeric_sort_param)
@ -419,7 +419,7 @@ fn test_numeric_floats_and_ints2() {
#[test] #[test]
fn test_numeric_floats2() { 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"; let input = "1.444\n8.013\n1.58590\n-8.90880\n1.040000000\n-.05";
new_ucmd!() new_ucmd!()
.arg(numeric_sort_param) .arg(numeric_sort_param)
@ -439,7 +439,7 @@ fn test_numeric_floats_with_nan2() {
#[test] #[test]
fn test_human_block_sizes2() { 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"; let input = "8981K\n909991M\n-8T\n21G\n0.8M";
new_ucmd!() new_ucmd!()
.arg(human_numeric_sort_param) .arg(human_numeric_sort_param)
@ -461,7 +461,7 @@ fn test_human_numeric_zero_stable() {
#[test] #[test]
fn test_month_default2() { 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"; let input = "JAn\nMAY\n000may\nJun\nFeb";
new_ucmd!() new_ucmd!()
.arg(month_sort_param) .arg(month_sort_param)
@ -555,7 +555,7 @@ fn test_keys_invalid_char_zero() {
#[test] #[test]
fn test_keys_with_options() { fn test_keys_with_options() {
let input = "aa 3 cc\ndd 1 ff\ngg 2 cc\n"; let input = "aa 3 cc\ndd 1 ff\ngg 2 cc\n";
for param in &[ for param in [
&["-k", "2,2n"][..], &["-k", "2,2n"][..],
&["-k", "2n,2"][..], &["-k", "2n,2"][..],
&["-k", "2,2", "-n"][..], &["-k", "2,2", "-n"][..],
@ -571,7 +571,7 @@ fn test_keys_with_options() {
#[test] #[test]
fn test_keys_with_options_blanks_start() { fn test_keys_with_options_blanks_start() {
let input = "aa 3 cc\ndd 1 ff\ngg 2 cc\n"; 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!() new_ucmd!()
.args(param) .args(param)
.pipe_in(input) .pipe_in(input)
@ -761,7 +761,7 @@ fn test_pipe() {
#[test] #[test]
fn test_check() { fn test_check() {
for diagnose_arg in &["-c", "--check", "--check=diagnose-first"] { for diagnose_arg in ["-c", "--check", "--check=diagnose-first"] {
new_ucmd!() new_ucmd!()
.arg(diagnose_arg) .arg(diagnose_arg)
.arg("check_fail.txt") .arg("check_fail.txt")
@ -779,7 +779,7 @@ fn test_check() {
#[test] #[test]
fn test_check_silent() { fn test_check_silent() {
for silent_arg in &["-C", "--check=silent", "--check=quiet"] { for silent_arg in ["-C", "--check=silent", "--check=quiet"] {
new_ucmd!() new_ucmd!()
.arg(silent_arg) .arg(silent_arg)
.arg("check_fail.txt") .arg("check_fail.txt")
@ -803,7 +803,7 @@ fn test_check_unique() {
#[test] #[test]
fn test_dictionary_and_nonprinting_conflicts() { fn test_dictionary_and_nonprinting_conflicts() {
let conflicting_args = ["n", "h", "g", "M"]; 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 { for conflicting_arg in &conflicting_args {
new_ucmd!() new_ucmd!()
.arg(&format!("-{}{}", restricted_arg, conflicting_arg)) .arg(&format!("-{}{}", restricted_arg, conflicting_arg))

View file

@ -236,7 +236,7 @@ fn test_symlinks() {
let mut tested: bool = false; let mut tested: bool = false;
// arbitrarily chosen symlinks with hope that the CI environment provides at least one of them // arbitrarily chosen symlinks with hope that the CI environment provides at least one of them
for file in &[ for file in [
"/bin/sh", "/bin/sh",
"/bin/sudoedit", "/bin/sudoedit",
"/usr/bin/ex", "/usr/bin/ex",

View file

@ -522,7 +522,7 @@ fn test_tail_bytes_for_funny_files() {
// gnu/tests/tail-2/tail-c.sh // gnu/tests/tail-2/tail-c.sh
let ts = TestScenario::new(util_name!()); let ts = TestScenario::new(util_name!());
let at = &ts.fixtures; 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) { if !at.file_exists(file) {
continue; continue;
} }

View file

@ -9,7 +9,7 @@ fn test_tee_processing_multiple_operands() {
// POSIX says: "Processing of at least 13 file operands shall be supported." // POSIX says: "Processing of at least 13 file operands shall be supported."
let content = "tee_sample_content"; 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::<Vec<_>>(); let files = (1..=n).map(|x| x.to_string()).collect::<Vec<_>>();
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();

View file

@ -39,7 +39,7 @@ fn test_command_with_args() {
#[test] #[test]
fn test_verbose() { fn test_verbose() {
for &verbose_flag in &["-v", "--verbose"] { for verbose_flag in ["-v", "--verbose"] {
new_ucmd!() new_ucmd!()
.args(&[verbose_flag, ".1", "sleep", "10"]) .args(&[verbose_flag, ".1", "sleep", "10"])
.fails() .fails()

View file

@ -333,7 +333,7 @@ fn test_touch_reference() {
at.touch(file_a); at.touch(file_a);
set_file_times(&at, file_a, start_of_year, start_of_year); set_file_times(&at, file_a, start_of_year, start_of_year);
assert!(at.file_exists(file_a)); assert!(at.file_exists(file_a));
for &opt in &["-r", "--ref", "--reference"] { for opt in ["-r", "--ref", "--reference"] {
scenario scenario
.ccmd("touch") .ccmd("touch")
.args(&[opt, file_a, file_b]) .args(&[opt, file_a, file_b])

View file

@ -7,7 +7,7 @@ use crate::common::util::*;
#[test] #[test]
fn test_count_bytes_large_stdin() { fn test_count_bytes_large_stdin() {
for &n in &[ for n in [
0, 0,
1, 1,
42, 42,

View file

@ -12,7 +12,7 @@ use crate::common::util::*;
#[ignore = "issue #3219"] #[ignore = "issue #3219"]
fn test_count() { fn test_count() {
let ts = TestScenario::new(util_name!()); 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(); let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str();
ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout);
} }
@ -22,7 +22,7 @@ fn test_count() {
#[test] #[test]
fn test_boot() { fn test_boot() {
let ts = TestScenario::new(util_name!()); 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(); let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str();
ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout);
} }
@ -33,7 +33,7 @@ fn test_boot() {
#[ignore = "issue #3219"] #[ignore = "issue #3219"]
fn test_heading() { fn test_heading() {
let ts = TestScenario::new(util_name!()); let ts = TestScenario::new(util_name!());
for opt in &["-H", "--heading", "--head"] { for opt in ["-H", "--heading", "--head"] {
// allow whitespace variation // allow whitespace variation
// * minor whitespace differences occur between platform built-in outputs; // * minor whitespace differences occur between platform built-in outputs;
// specifically number of TABs between "TIME" and "COMMENT" may be variant // specifically number of TABs between "TIME" and "COMMENT" may be variant
@ -52,7 +52,7 @@ fn test_heading() {
#[ignore = "issue #3219"] #[ignore = "issue #3219"]
fn test_short() { fn test_short() {
let ts = TestScenario::new(util_name!()); 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(); let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str();
ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout);
} }
@ -62,7 +62,7 @@ fn test_short() {
#[test] #[test]
fn test_login() { fn test_login() {
let ts = TestScenario::new(util_name!()); 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(); let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str();
ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout);
} }
@ -80,7 +80,7 @@ fn test_m() {
#[test] #[test]
fn test_process() { fn test_process() {
let ts = TestScenario::new(util_name!()); 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(); let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str();
ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout);
} }
@ -90,7 +90,7 @@ fn test_process() {
#[test] #[test]
fn test_runlevel() { fn test_runlevel() {
let ts = TestScenario::new(util_name!()); 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(); let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str();
ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout);
@ -103,7 +103,7 @@ fn test_runlevel() {
#[test] #[test]
fn test_time() { fn test_time() {
let ts = TestScenario::new(util_name!()); 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(); let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str();
ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout);
} }
@ -120,7 +120,7 @@ fn test_mesg() {
// --writable // --writable
// same as -T // same as -T
let ts = TestScenario::new(util_name!()); let ts = TestScenario::new(util_name!());
for opt in &[ for opt in [
"-T", "-T",
"-w", "-w",
"--mesg", "--mesg",
@ -157,7 +157,7 @@ fn test_too_many_args() {
#[ignore = "issue #3219"] #[ignore = "issue #3219"]
fn test_users() { fn test_users() {
let ts = TestScenario::new(util_name!()); 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 actual = ts.ucmd().arg(opt).succeeds().stdout_move_str();
let expect = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str(); let expect = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str();
println!("actual: {:?}", actual); println!("actual: {:?}", actual);
@ -192,7 +192,7 @@ fn test_lookup() {
#[test] #[test]
fn test_dead() { fn test_dead() {
let ts = TestScenario::new(util_name!()); 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(); let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str();
ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout);
} }
@ -226,7 +226,7 @@ fn test_all() {
} }
let ts = TestScenario::new(util_name!()); 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(); let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str();
ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout); ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout);
} }

View file

@ -55,7 +55,7 @@ fn test_long_input() {
fn test_piped_to_dev_full() { fn test_piped_to_dev_full() {
use std::fs::OpenOptions; use std::fs::OpenOptions;
for &append in &[true, false] { for append in [true, false] {
{ {
let dev_full = OpenOptions::new() let dev_full = OpenOptions::new()
.write(true) .write(true)