mirror of
https://github.com/uutils/coreutils
synced 2025-01-20 17:14:21 +00:00
sleep: fix compile error due to fundu update
This commit is contained in:
parent
7a449feaa0
commit
ccee02f025
1 changed files with 5 additions and 3 deletions
|
@ -14,7 +14,7 @@ use uucore::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use clap::{crate_version, Arg, ArgAction, Command};
|
use clap::{crate_version, Arg, ArgAction, Command};
|
||||||
use fundu::{self, DurationParser, ParseError};
|
use fundu::{self, DurationParser, ParseError, SaturatingInto};
|
||||||
|
|
||||||
static ABOUT: &str = help_about!("sleep.md");
|
static ABOUT: &str = help_about!("sleep.md");
|
||||||
const USAGE: &str = help_usage!("sleep.md");
|
const USAGE: &str = help_usage!("sleep.md");
|
||||||
|
@ -63,7 +63,7 @@ pub fn uu_app() -> Command {
|
||||||
fn sleep(args: &[&str]) -> UResult<()> {
|
fn sleep(args: &[&str]) -> UResult<()> {
|
||||||
let mut arg_error = false;
|
let mut arg_error = false;
|
||||||
|
|
||||||
use fundu::TimeUnit::*;
|
use fundu::TimeUnit::{Day, Hour, Minute, Second};
|
||||||
let parser = DurationParser::with_time_units(&[Second, Minute, Hour, Day]);
|
let parser = DurationParser::with_time_units(&[Second, Minute, Hour, Day]);
|
||||||
|
|
||||||
let sleep_dur = args
|
let sleep_dur = args
|
||||||
|
@ -91,7 +91,9 @@ fn sleep(args: &[&str]) -> UResult<()> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.fold(Duration::ZERO, |acc, n| acc.saturating_add(n));
|
.fold(Duration::ZERO, |acc, n| {
|
||||||
|
acc.saturating_add(SaturatingInto::<std::time::Duration>::saturating_into(n))
|
||||||
|
});
|
||||||
|
|
||||||
if arg_error {
|
if arg_error {
|
||||||
return Err(UUsageError::new(1, ""));
|
return Err(UUsageError::new(1, ""));
|
||||||
|
|
Loading…
Reference in a new issue