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

rustfmt the recent change

This commit is contained in:
Sylvestre Ledru 2021-05-23 00:13:53 +02:00
parent 70e65c419f
commit 4aaeede3d8
7 changed files with 24 additions and 35 deletions

View file

@ -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
)
}

View file

@ -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),
}
}
}

View file

@ -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.

View file

@ -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";

View file

@ -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 <MODE>\n \
--input <MODE>\n \
--output <MODE>\n\n\
USAGE:\n \
stdbuf OPTION... COMMAND\n\n\
For more information try --help",
--error <MODE>\n \
--input <MODE>\n \
--output <MODE>\n\n\
USAGE:\n \
stdbuf OPTION... COMMAND\n\n\
For more information try --help",
);
}

View file

@ -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() {

View file

@ -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);
}
}