mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
sleep: fix compile error due to fundu update
This commit is contained in:
@@ -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, ""));
|
||||
|
||||
Reference in New Issue
Block a user