diff options
-rw-r--r-- | src/fexpr/mod.rs | 6 | ||||
-rw-r--r-- | src/output/sorting.rs | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/fexpr/mod.rs b/src/fexpr/mod.rs index 5d12051..90242f2 100644 --- a/src/fexpr/mod.rs +++ b/src/fexpr/mod.rs @@ -55,9 +55,9 @@ pub enum FErrorKind { } /// Shortcut to create a new parser and parse the given input. -pub fn parse_logfilter<'a>( - input: &'a str, -) -> Result<Box<dyn filters::log::LogFilter>, ParseError<usize, Token<'a>, FError>> { +pub fn parse_logfilter( + input: &str, +) -> Result<Box<dyn filters::log::LogFilter>, ParseError<usize, Token<'_>, FError>> { grammar::LogFilterParser::new().parse(input) } diff --git a/src/output/sorting.rs b/src/output/sorting.rs index 628a1a8..911a7df 100644 --- a/src/output/sorting.rs +++ b/src/output/sorting.rs @@ -40,8 +40,8 @@ impl FromStr for Component { type Err = InvalidComponent; fn from_str(s: &str) -> Result<Self, Self::Err> { - if s.starts_with('~') { - return s[1..].parse().map(|c| Component::Reverse(Box::new(c))); + if let Some(stripped) = s.strip_prefix('~') { + return stripped.parse().map(|c| Component::Reverse(Box::new(c))); } match &s.to_lowercase() as &str { "date" => Ok(Component::Date), |