From 291d2f5d4801d03ba316bd88911c192c05425e45 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 28 Dec 2019 12:34:10 -0600 Subject: [PATCH] refactor/polish ~ fix `cargo clippy` complaints ('better' as `println!(...)`) --- src/od/inputoffset.rs | 2 +- src/od/od.rs | 2 +- src/truncate/truncate.rs | 5 ++--- src/uptime/uptime.rs | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/od/inputoffset.rs b/src/od/inputoffset.rs index 102f1656b..7f2fca559 100644 --- a/src/od/inputoffset.rs +++ b/src/od/inputoffset.rs @@ -58,7 +58,7 @@ impl InputOffset { /// both `Radix::NoPrefix` was set and no label (--traditional) is used. pub fn print_final_offset(&self) { if self.radix != Radix::NoPrefix || self.label.is_some() { - print!("{}\n", self.format_byte_offset()); + println!("{}", self.format_byte_offset()); } } } diff --git a/src/od/od.rs b/src/od/od.rs index 03fd0d55a..001d829eb 100644 --- a/src/od/od.rs +++ b/src/od/od.rs @@ -469,7 +469,7 @@ fn print_bytes(prefix: &str, input_decoder: &MemoryDecoder, output_info: &Output // lines of multi-format rasters. print!("{:>width$}", "", width = prefix.chars().count()); } - print!("{}\n", output_text); + println!("{}", output_text); } } diff --git a/src/truncate/truncate.rs b/src/truncate/truncate.rs index 47070d9a7..203124760 100644 --- a/src/truncate/truncate.rs +++ b/src/truncate/truncate.rs @@ -66,7 +66,7 @@ pub fn uumain(args: Vec) -> i32 { "{}", opts.usage("Shrink or extend the size of each file to the specified size.") ); - print!( + println!( " SIZE is an integer with an optional prefix and optional unit. The available units (K, M, G, T, P, E, Z, and Y) use the following format: @@ -83,8 +83,7 @@ file based on its current size: '<' => at most '>' => at least '/' => round down to multiple of - '%' => round up to multiple of -" + '%' => round up to multiple of" ); } else if matches.opt_present("version") { println!("{} {}", NAME, VERSION); diff --git a/src/uptime/uptime.rs b/src/uptime/uptime.rs index b2d97ee65..f83b3a3cd 100644 --- a/src/uptime/uptime.rs +++ b/src/uptime/uptime.rs @@ -91,7 +91,7 @@ fn print_loadavg() { let loads: i32 = unsafe { transmute(getloadavg(avg.as_mut_ptr(), 3)) }; if loads == -1 { - print!("\n"); + println!(); } else { print!("load average: "); for n in 0..loads {