mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +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 fundu::{self, DurationParser, ParseError};
|
||||
use fundu::{self, DurationParser, ParseError, SaturatingInto};
|
||||
|
||||
static ABOUT: &str = help_about!("sleep.md");
|
||||
const USAGE: &str = help_usage!("sleep.md");
|
||||
|
@ -63,7 +63,7 @@ pub fn uu_app() -> Command {
|
|||
fn sleep(args: &[&str]) -> UResult<()> {
|
||||
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 sleep_dur = args
|
||||
|
@ -91,7 +91,9 @@ fn sleep(args: &[&str]) -> UResult<()> {
|
|||
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 {
|
||||
return Err(UUsageError::new(1, ""));
|
||||
|
|
Loading…
Reference in a new issue