From 5836c7d87f26f004cc4433ffd2c6a2f97f67050b Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 10 Oct 2020 12:39:24 +0200 Subject: fix lints --- src/output/sorting.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/output') 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 { - 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), -- cgit v1.2.3