Skip to content

Commit

Permalink
Merge pull request #2494 from sylvestre/clip2
Browse files Browse the repository at this point in the history
fix various clippy & rustfmt issues
  • Loading branch information
sylvestre committed Jul 11, 2021
2 parents 52c6593 + d4f27f1 commit 92c5dc7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
27 changes: 13 additions & 14 deletions src/uu/du/src/du.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
// * For the full copyright and license information, please view the LICENSE
// * file that was distributed with this source code.

// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422
#![allow(clippy::nonstandard_macro_braces)]

#[macro_use]
extern crate uucore;

Expand Down Expand Up @@ -416,26 +419,22 @@ impl Display for DuError {
DuError::SummarizeDepthConflict(s) => {
write!(f, "summarizing conflicts with --max-depth={}", s)
}
DuError::InvalidTimeStyleArg(s) => {
write!(
f,
"invalid argument '{}' for 'time style'
DuError::InvalidTimeStyleArg(s) => write!(
f,
"invalid argument '{}' for 'time style'
Valid arguments are:
- 'full-iso'
- 'long-iso'
- 'iso'
Try '{} --help' for more information.",
s, NAME
)
}
DuError::InvalidTimeArg(s) => {
write!(
f,
"Invalid argument '{}' for --time.
s, NAME
),
DuError::InvalidTimeArg(s) => write!(
f,
"Invalid argument '{}' for --time.
'birth' and 'creation' arguments are not supported on this platform.",
s
)
}
s
),
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/uu/tr/src/tr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,9 @@ fn get_usage() -> String {
}

fn get_long_usage() -> String {
format!(
"Translate, squeeze, and/or delete characters from standard input,
writing to standard output.",
)
"Translate, squeeze, and/or delete characters from standard input,
writing to standard output."
.to_string()
}

pub fn uumain(args: impl uucore::Args) -> i32 {
Expand Down
1 change: 0 additions & 1 deletion tests/by-util/test_whoami.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ fn test_normal_compare_env() {
let whoami = whoami();
if whoami == "nobody" {
println!("test skipped:");
return;
} else if !is_ci() {
new_ucmd!().succeeds().stdout_is(format!("{}\n", whoami));
} else {
Expand Down
2 changes: 1 addition & 1 deletion tests/common/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ pub fn whoami() -> String {

/// Add prefix 'g' for `util_name` if not on linux
#[cfg(unix)]
pub fn host_name_for<'a>(util_name: &'a str) -> Cow<'a, str> {
pub fn host_name_for(util_name: &str) -> Cow<str> {
// In some environments, e.g. macOS/freebsd, the GNU coreutils are prefixed with "g"
// to not interfere with the BSD counterparts already in `$PATH`.
#[cfg(not(target_os = "linux"))]
Expand Down

0 comments on commit 92c5dc7

Please sign in to comment.