Fix warnings

This commit is contained in:
sharkdp 2019-09-15 10:48:29 +02:00
parent a0505bd4df
commit 1d16cd855e
2 changed files with 3 additions and 6 deletions

View File

@ -80,8 +80,8 @@ mod tests {
}; };
} }
/// Parsing and size conversion tests data. Ensure that each type gets properly interpreted. // Parsing and size conversion tests data. Ensure that each type gets properly interpreted.
/// Call with higher base values to ensure expected multiplication (only need a couple) // Call with higher base values to ensure expected multiplication (only need a couple)
gen_size_filter_parse_test! { gen_size_filter_parse_test! {
byte_plus: ("+1b", SizeFilter::Min(1)), byte_plus: ("+1b", SizeFilter::Min(1)),
byte_plus_multiplier: ("+10b", SizeFilter::Min(10)), byte_plus_multiplier: ("+10b", SizeFilter::Min(10)),
@ -168,7 +168,7 @@ mod tests {
}; };
} }
/// Invalid parse data // Invalid parse data
gen_size_filter_failure! { gen_size_filter_failure! {
ensure_missing_symbol_returns_none: "10M", ensure_missing_symbol_returns_none: "10M",
ensure_missing_number_returns_none: "+g", ensure_missing_number_returns_none: "+g",

View File

@ -9,7 +9,6 @@ pub enum TimeFilter {
impl TimeFilter { impl TimeFilter {
fn from_str(ref_time: &SystemTime, s: &str) -> Option<SystemTime> { fn from_str(ref_time: &SystemTime, s: &str) -> Option<SystemTime> {
use humantime;
humantime::parse_duration(s) humantime::parse_duration(s)
.map(|duration| *ref_time - duration) .map(|duration| *ref_time - duration)
.or_else(|_| humantime::parse_rfc3339_weak(s)) .or_else(|_| humantime::parse_rfc3339_weak(s))
@ -39,8 +38,6 @@ mod tests {
#[test] #[test]
fn is_time_filter_applicable() { fn is_time_filter_applicable() {
use humantime;
let ref_time = humantime::parse_rfc3339("2010-10-10T10:10:10Z").unwrap(); let ref_time = humantime::parse_rfc3339("2010-10-10T10:10:10Z").unwrap();
assert!(TimeFilter::after(&ref_time, "1min") assert!(TimeFilter::after(&ref_time, "1min")
.unwrap() .unwrap()