dmesg: remove unnecessary 'remove_enclosing_quotes' function.

This commit is contained in:
Fuad Ismail
2024-12-14 22:28:27 +07:00
parent d5b2f3c7e1
commit 5a333b463e

View File

@@ -107,11 +107,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
dmesg.level_filters = Some(level_filters);
}
if let Some(since) = matches.get_one::<String>(options::SINCE) {
let since = remove_enclosing_quotes(since);
dmesg.since_filter = Some(time_formatter::parse_datetime(since)?);
}
if let Some(until) = matches.get_one::<String>(options::UNTIL) {
let until = remove_enclosing_quotes(until);
dmesg.until_filter = Some(time_formatter::parse_datetime(until)?);
}
dmesg.print()?;
@@ -491,13 +489,3 @@ impl TryFrom<u32> for Facility {
}
}
}
fn remove_enclosing_quotes(value: &str) -> &str {
if (value.starts_with('"') || value.starts_with('\''))
&& (value.ends_with('"') || value.ends_with('\''))
{
&value[1..value.len() - 1]
} else {
value
}
}