diff options
author | Canop <cano.petrole@gmail.com> | 2021-05-17 20:55:30 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2021-05-17 20:55:30 +0200 |
commit | 1b66e4d13f5838d1da9c8c27138ee8673d80fef7 (patch) | |
tree | 0e6a0f8f5113dea114af9d0939e1cbe7700d7bfd /src/tree | |
parent | 872c9cd2f0f9587a5a6e9bcff9605dd0f4d46832 (diff) |
use lazy-static 2
Diffstat (limited to 'src/tree')
-rw-r--r-- | src/tree/tree_line.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/tree/tree_line.rs b/src/tree/tree_line.rs index b528636..1abc385 100644 --- a/src/tree/tree_line.rs +++ b/src/tree/tree_line.rs @@ -5,7 +5,7 @@ use { file_sum::FileSum, git::LineGitStatus, }, - lazy_regex::regex, + lazy_regex::regex_captures, std::{ cmp::{self, Ord, Ordering, PartialOrd}, fs, @@ -42,17 +42,13 @@ pub struct TreeLine { impl TreeLine { pub fn double_extension_from_name(name: &str) -> Option<&str> { - regex!(r"\.([^.]+\.[^.]+)") - .captures(&name) - .and_then(|c| c.get(1)) - .map(|e| e.as_str()) + regex_captures!(r"\.([^.]+\.[^.]+)", name) + .map(|(_, de)| de) } pub fn extension_from_name(name: &str) -> Option<&str> { - regex!(r"\.([^.]+)$") - .captures(&name) - .and_then(|c| c.get(1)) - .map(|e| e.as_str()) + regex_captures!(r"\.([^.]+)$", name) + .map(|(_, ext)| ext) } pub fn is_selectable(&self) -> bool { |