From 59a42f1254a1c8f6f328f4b1ec9f6b4456950ff8 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 28 May 2021 17:49:11 +0200 Subject: [PATCH] maint: format recent changes --- src/uu/mktemp/src/mktemp.rs | 15 ++++----------- src/uu/sort/src/ext_sort.rs | 7 ++++++- src/uu/stdbuf/src/stdbuf.rs | 3 +-- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index d66dd3d57..f6c244bf2 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -210,21 +210,14 @@ pub fn dry_exec(mut tmpdir: PathBuf, prefix: &str, rand: usize, suffix: &str) -> 0 } -fn exec( - dir: PathBuf, - prefix: &str, - rand: usize, - suffix: &str, - make_dir: bool, - quiet: bool, -) -> i32 { +fn exec(dir: PathBuf, prefix: &str, rand: usize, suffix: &str, make_dir: bool, quiet: bool) -> i32 { let res = if make_dir { let tmpdir = Builder::new() .prefix(prefix) .rand_bytes(rand) .suffix(suffix) .tempdir_in(&dir); - + // `into_path` consumes the TempDir without removing it tmpdir.map(|d| d.into_path().to_string_lossy().to_string()) } else { @@ -233,7 +226,7 @@ fn exec( .rand_bytes(rand) .suffix(suffix) .tempfile_in(&dir); - + match tmpfile { Ok(f) => { // `keep` ensures that the file is not deleted @@ -245,7 +238,7 @@ fn exec( } } } - Err(x) => Err(x) + Err(x) => Err(x), } }; diff --git a/src/uu/sort/src/ext_sort.rs b/src/uu/sort/src/ext_sort.rs index 23a55aad0..9b1845efa 100644 --- a/src/uu/sort/src/ext_sort.rs +++ b/src/uu/sort/src/ext_sort.rs @@ -34,7 +34,12 @@ const MIN_BUFFER_SIZE: usize = 8_000; /// Sort files by using auxiliary files for storing intermediate chunks (if needed), and output the result. pub fn ext_sort(files: &mut impl Iterator>, settings: &GlobalSettings) { - let tmp_dir = crash_if_err!(1, tempfile::Builder::new().prefix("uutils_sort").tempdir_in(&settings.tmp_dir)); + let tmp_dir = crash_if_err!( + 1, + tempfile::Builder::new() + .prefix("uutils_sort") + .tempdir_in(&settings.tmp_dir) + ); let (sorted_sender, sorted_receiver) = std::sync::mpsc::sync_channel(1); let (recycled_sender, recycled_receiver) = std::sync::mpsc::sync_channel(1); thread::spawn({ diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 485b3c70e..134247060 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -25,8 +25,7 @@ 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\ +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\