summaryrefslogtreecommitdiffstats
path: root/src/fs/file.rs
diff options
context:
space:
mode:
authorBenjamin Sago <ogham@bsago.me>2020-10-10 15:30:19 +0100
committerBenjamin Sago <ogham@bsago.me>2020-10-10 15:30:19 +0100
commitf0c139ca682178e5cf4e735c0d7621719e73f6a0 (patch)
tree466fe7270a5dc7360f494a0e5c8c9b24d576c0cf /src/fs/file.rs
parent70a30ed683ecc88304c6b2d66b6d34d61a1dd072 (diff)
Better referencing
This commit makes changes to the way variables are referenced: • Make types Copy when possible • Make methods take `self` instead of `&self` where possible (trivially_copy_pass_by_ref) • Remove unnecessary borrowing (needless_ref) • Remove unnecessary cloning (clone_on_copy) • Remove `ref` from match arms where possible (new Rust match ergonomics)
Diffstat (limited to 'src/fs/file.rs')
-rw-r--r--src/fs/file.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/fs/file.rs b/src/fs/file.rs
index c22b815..5657588 100644
--- a/src/fs/file.rs
+++ b/src/fs/file.rs
@@ -417,9 +417,9 @@ impl<'dir> File<'dir> {
///
/// This will always return `false` if the file has no extension.
pub fn extension_is_one_of(&self, choices: &[&str]) -> bool {
- match self.ext {
- Some(ref ext) => choices.contains(&&ext[..]),
- None => false,
+ match &self.ext {
+ Some(ext) => choices.contains(&&ext[..]),
+ None => false,
}
}
@@ -463,10 +463,7 @@ impl<'dir> FileTarget<'dir> {
/// Whether this link doesn’t lead to a file, for whatever reason. This
/// gets used to determine how to highlight the link in grid views.
pub fn is_broken(&self) -> bool {
- match *self {
- FileTarget::Ok(_) => false,
- FileTarget::Broken(_) | FileTarget::Err(_) => true,
- }
+ matches!(self, Self::Broken(_) | Self::Err(_))
}
}