From 4aaeede3d8475058531daf740059ed44c3a12850 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 23 May 2021 00:13:53 +0200 Subject: [PATCH] rustfmt the recent change --- src/uu/pinky/src/pinky.rs | 2 +- src/uu/sort/src/chunks.rs | 4 +--- src/uu/sort/src/sort.rs | 4 +--- src/uu/stdbuf/src/stdbuf.rs | 25 +++++++++++++------------ tests/by-util/test_stdbuf.rs | 12 ++++++------ tests/by-util/test_tail.rs | 4 ---- tests/by-util/test_who.rs | 8 ++------ 7 files changed, 24 insertions(+), 35 deletions(-) diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index f0ab44e5f..d65775c2d 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -48,7 +48,7 @@ fn get_usage() -> String { fn get_long_usage() -> String { format!( "A lightweight 'finger' program; print user information.\n\ - The utmp file will be {}.", + The utmp file will be {}.", utmpx::DEFAULT_FILE ) } diff --git a/src/uu/sort/src/chunks.rs b/src/uu/sort/src/chunks.rs index 7a7749003..6ec759211 100644 --- a/src/uu/sort/src/chunks.rs +++ b/src/uu/sort/src/chunks.rs @@ -223,9 +223,7 @@ fn read_to_buffer( Err(e) if e.kind() == ErrorKind::Interrupted => { // retry } - Err(e) => { - crash!(1, "{}", e) - } + Err(e) => crash!(1, "{}", e), } } } diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index bc3b65492..1bbfdc5c5 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -505,9 +505,7 @@ impl KeyPosition { 'R' => settings.random = true, 'r' => settings.reverse = true, 'V' => settings.mode = SortMode::Version, - c => { - crash!(1, "invalid option for key: `{}`", c) - } + c => crash!(1, "invalid option for key: `{}`", c), } // All numeric sorts and month sort conflict with dictionary_order and ignore_non_printing. // Instad of reporting an error, let them overwrite each other. diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 77f6d9dad..485b3c70e 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -24,18 +24,19 @@ use uucore::InvalidEncodingHandling; static VERSION: &str = env!("CARGO_PKG_VERSION"); static ABOUT: &str = "Run COMMAND, with modified buffering operations for its standard streams.\n\n\ - Mandatory arguments to long options are mandatory for short options too."; -static LONG_HELP: &str = "If MODE is 'L' the corresponding stream will be line buffered.\n\ - This option is invalid with standard input.\n\n\ - If MODE is '0' the corresponding stream will be unbuffered.\n\n\ - Otherwise MODE is a number which may be followed by one of the following:\n\n\ - KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.\n\ - In this case the corresponding stream will be fully buffered with the buffer size set to \ - MODE bytes.\n\n\ - NOTE: If COMMAND adjusts the buffering of its standard streams ('tee' does for e.g.) then \ - that will override corresponding settings changed by 'stdbuf'.\n\ - Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O, \ - and are thus unaffected by 'stdbuf' settings.\n"; + Mandatory arguments to long options are mandatory for short options too."; +static LONG_HELP: &str = + "If MODE is 'L' the corresponding stream will be line buffered.\n\ + This option is invalid with standard input.\n\n\ + If MODE is '0' the corresponding stream will be unbuffered.\n\n\ + Otherwise MODE is a number which may be followed by one of the following:\n\n\ + KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.\n\ + In this case the corresponding stream will be fully buffered with the buffer size set to \ + MODE bytes.\n\n\ + NOTE: If COMMAND adjusts the buffering of its standard streams ('tee' does for e.g.) then \ + that will override corresponding settings changed by 'stdbuf'.\n\ + Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O, \ + and are thus unaffected by 'stdbuf' settings.\n"; mod options { pub const INPUT: &str = "input"; diff --git a/tests/by-util/test_stdbuf.rs b/tests/by-util/test_stdbuf.rs index 808b7382a..4105cb7a2 100644 --- a/tests/by-util/test_stdbuf.rs +++ b/tests/by-util/test_stdbuf.rs @@ -27,12 +27,12 @@ fn test_stdbuf_line_buffered_stdout() { fn test_stdbuf_no_buffer_option_fails() { new_ucmd!().args(&["head"]).fails().stderr_is( "error: The following required arguments were not provided:\n \ - --error \n \ - --input \n \ - --output \n\n\ - USAGE:\n \ - stdbuf OPTION... COMMAND\n\n\ - For more information try --help", + --error \n \ + --input \n \ + --output \n\n\ + USAGE:\n \ + stdbuf OPTION... COMMAND\n\n\ + For more information try --help", ); } diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index dddbb9c31..f3c9a7b11 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -349,7 +349,6 @@ fn test_sleep_interval() { new_ucmd!().arg("-s").arg("10").arg(FOOBAR_TXT).succeeds(); } - /// Test for reading all but the first NUM bytes: `tail -c +3`. #[test] fn test_positive_bytes() { @@ -360,7 +359,6 @@ fn test_positive_bytes() { .stdout_is("cde"); } - /// Test for reading all bytes, specified by `tail -c +0`. #[test] fn test_positive_zero_bytes() { @@ -371,7 +369,6 @@ fn test_positive_zero_bytes() { .stdout_is("abcde"); } - /// Test for reading all but the first NUM lines: `tail -n +3`. #[test] fn test_positive_lines() { @@ -382,7 +379,6 @@ fn test_positive_lines() { .stdout_is("c\nd\ne\n"); } - /// Test for reading all lines, specified by `tail -n +0`. #[test] fn test_positive_zero_lines() { diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 1aa8d604d..df023bb0a 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -97,13 +97,9 @@ fn test_runlevel() { #[cfg(any(target_vendor = "apple", target_os = "freebsd"))] #[test] fn test_runlevel() { - let expected = - "error: Found argument"; + let expected = "error: Found argument"; for opt in vec!["-r", "--runlevel"] { - new_ucmd!() - .arg(opt) - .fails() - .stderr_contains(expected); + new_ucmd!().arg(opt).fails().stderr_contains(expected); } }