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:
parent
70e65c419f
commit
4aaeede3d8
7 changed files with 24 additions and 35 deletions
|
@ -48,7 +48,7 @@ fn get_usage() -> String {
|
||||||
fn get_long_usage() -> String {
|
fn get_long_usage() -> String {
|
||||||
format!(
|
format!(
|
||||||
"A lightweight 'finger' program; print user information.\n\
|
"A lightweight 'finger' program; print user information.\n\
|
||||||
The utmp file will be {}.",
|
The utmp file will be {}.",
|
||||||
utmpx::DEFAULT_FILE
|
utmpx::DEFAULT_FILE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,9 +223,7 @@ fn read_to_buffer(
|
||||||
Err(e) if e.kind() == ErrorKind::Interrupted => {
|
Err(e) if e.kind() == ErrorKind::Interrupted => {
|
||||||
// retry
|
// retry
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => crash!(1, "{}", e),
|
||||||
crash!(1, "{}", e)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -505,9 +505,7 @@ impl KeyPosition {
|
||||||
'R' => settings.random = true,
|
'R' => settings.random = true,
|
||||||
'r' => settings.reverse = true,
|
'r' => settings.reverse = true,
|
||||||
'V' => settings.mode = SortMode::Version,
|
'V' => settings.mode = SortMode::Version,
|
||||||
c => {
|
c => crash!(1, "invalid option for key: `{}`", c),
|
||||||
crash!(1, "invalid option for key: `{}`", c)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// All numeric sorts and month sort conflict with dictionary_order and ignore_non_printing.
|
// All numeric sorts and month sort conflict with dictionary_order and ignore_non_printing.
|
||||||
// Instad of reporting an error, let them overwrite each other.
|
// Instad of reporting an error, let them overwrite each other.
|
||||||
|
|
|
@ -24,18 +24,19 @@ use uucore::InvalidEncodingHandling;
|
||||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
static ABOUT: &str =
|
static ABOUT: &str =
|
||||||
"Run COMMAND, with modified buffering operations for its standard streams.\n\n\
|
"Run COMMAND, with modified buffering operations for its standard streams.\n\n\
|
||||||
Mandatory arguments to long options are mandatory for short options too.";
|
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\
|
static LONG_HELP: &str =
|
||||||
This option is invalid with standard input.\n\n\
|
"If MODE is 'L' the corresponding stream will be line buffered.\n\
|
||||||
If MODE is '0' the corresponding stream will be unbuffered.\n\n\
|
This option is invalid with standard input.\n\n\
|
||||||
Otherwise MODE is a number which may be followed by one of the following:\n\n\
|
If MODE is '0' the corresponding stream will be unbuffered.\n\n\
|
||||||
KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.\n\
|
Otherwise MODE is a number which may be followed by one of the following:\n\n\
|
||||||
In this case the corresponding stream will be fully buffered with the buffer size set to \
|
KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.\n\
|
||||||
MODE bytes.\n\n\
|
In this case the corresponding stream will be fully buffered with the buffer size set to \
|
||||||
NOTE: If COMMAND adjusts the buffering of its standard streams ('tee' does for e.g.) then \
|
MODE bytes.\n\n\
|
||||||
that will override corresponding settings changed by 'stdbuf'.\n\
|
NOTE: If COMMAND adjusts the buffering of its standard streams ('tee' does for e.g.) then \
|
||||||
Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O, \
|
that will override corresponding settings changed by 'stdbuf'.\n\
|
||||||
and are thus unaffected by 'stdbuf' settings.\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 {
|
mod options {
|
||||||
pub const INPUT: &str = "input";
|
pub const INPUT: &str = "input";
|
||||||
|
|
|
@ -27,12 +27,12 @@ fn test_stdbuf_line_buffered_stdout() {
|
||||||
fn test_stdbuf_no_buffer_option_fails() {
|
fn test_stdbuf_no_buffer_option_fails() {
|
||||||
new_ucmd!().args(&["head"]).fails().stderr_is(
|
new_ucmd!().args(&["head"]).fails().stderr_is(
|
||||||
"error: The following required arguments were not provided:\n \
|
"error: The following required arguments were not provided:\n \
|
||||||
--error <MODE>\n \
|
--error <MODE>\n \
|
||||||
--input <MODE>\n \
|
--input <MODE>\n \
|
||||||
--output <MODE>\n\n\
|
--output <MODE>\n\n\
|
||||||
USAGE:\n \
|
USAGE:\n \
|
||||||
stdbuf OPTION... COMMAND\n\n\
|
stdbuf OPTION... COMMAND\n\n\
|
||||||
For more information try --help",
|
For more information try --help",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -349,7 +349,6 @@ fn test_sleep_interval() {
|
||||||
new_ucmd!().arg("-s").arg("10").arg(FOOBAR_TXT).succeeds();
|
new_ucmd!().arg("-s").arg("10").arg(FOOBAR_TXT).succeeds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Test for reading all but the first NUM bytes: `tail -c +3`.
|
/// Test for reading all but the first NUM bytes: `tail -c +3`.
|
||||||
#[test]
|
#[test]
|
||||||
fn test_positive_bytes() {
|
fn test_positive_bytes() {
|
||||||
|
@ -360,7 +359,6 @@ fn test_positive_bytes() {
|
||||||
.stdout_is("cde");
|
.stdout_is("cde");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Test for reading all bytes, specified by `tail -c +0`.
|
/// Test for reading all bytes, specified by `tail -c +0`.
|
||||||
#[test]
|
#[test]
|
||||||
fn test_positive_zero_bytes() {
|
fn test_positive_zero_bytes() {
|
||||||
|
@ -371,7 +369,6 @@ fn test_positive_zero_bytes() {
|
||||||
.stdout_is("abcde");
|
.stdout_is("abcde");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Test for reading all but the first NUM lines: `tail -n +3`.
|
/// Test for reading all but the first NUM lines: `tail -n +3`.
|
||||||
#[test]
|
#[test]
|
||||||
fn test_positive_lines() {
|
fn test_positive_lines() {
|
||||||
|
@ -382,7 +379,6 @@ fn test_positive_lines() {
|
||||||
.stdout_is("c\nd\ne\n");
|
.stdout_is("c\nd\ne\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Test for reading all lines, specified by `tail -n +0`.
|
/// Test for reading all lines, specified by `tail -n +0`.
|
||||||
#[test]
|
#[test]
|
||||||
fn test_positive_zero_lines() {
|
fn test_positive_zero_lines() {
|
||||||
|
|
|
@ -97,13 +97,9 @@ fn test_runlevel() {
|
||||||
#[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
|
#[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_runlevel() {
|
fn test_runlevel() {
|
||||||
let expected =
|
let expected = "error: Found argument";
|
||||||
"error: Found argument";
|
|
||||||
for opt in vec!["-r", "--runlevel"] {
|
for opt in vec!["-r", "--runlevel"] {
|
||||||
new_ucmd!()
|
new_ucmd!().arg(opt).fails().stderr_contains(expected);
|
||||||
.arg(opt)
|
|
||||||
.fails()
|
|
||||||
.stderr_contains(expected);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue