mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
rustfmt two files
This commit is contained in:
parent
5935876f38
commit
c06967a45a
2 changed files with 7 additions and 13 deletions
|
@ -137,10 +137,7 @@ fn print_nusers(nusers: usize) {
|
||||||
fn print_time() {
|
fn print_time() {
|
||||||
let local_time = Local::now().time();
|
let local_time = Local::now().time();
|
||||||
|
|
||||||
print!(
|
print!(" {} ", local_time.format("%H:%M:%S"));
|
||||||
" {} ",
|
|
||||||
local_time.format("%H:%M:%S")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
@ -156,15 +153,13 @@ fn get_uptime(boot_time: Option<time_t>) -> i64 {
|
||||||
.and_then(|_| proc_uptime_s.split_whitespace().next())
|
.and_then(|_| proc_uptime_s.split_whitespace().next())
|
||||||
.and_then(|s| s.split('.').next().unwrap_or("0").parse().ok());
|
.and_then(|s| s.split('.').next().unwrap_or("0").parse().ok());
|
||||||
|
|
||||||
proc_uptime.unwrap_or_else(|| {
|
proc_uptime.unwrap_or_else(|| match boot_time {
|
||||||
match boot_time {
|
Some(t) => {
|
||||||
Some(t) => {
|
let now = Local::now().timestamp();
|
||||||
let now = Local::now().timestamp();
|
let boottime = t as i64;
|
||||||
let boottime = t as i64;
|
now - boottime
|
||||||
now - boottime
|
|
||||||
}
|
|
||||||
None => -1,
|
|
||||||
}
|
}
|
||||||
|
None => -1,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -247,7 +247,6 @@ fn test_leading_whitespace_should_imply_padding() {
|
||||||
.run()
|
.run()
|
||||||
.stdout_is(" 1000\n");
|
.stdout_is(" 1000\n");
|
||||||
|
|
||||||
|
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["--from=auto"])
|
.args(&["--from=auto"])
|
||||||
.pipe_in(" 202Ki")
|
.pipe_in(" 202Ki")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue