diff options
author | DJMcNab <[email protected]> | 2018-12-29 22:33:28 +0000 |
---|---|---|
committer | DJMcNab <[email protected]> | 2018-12-29 22:33:28 +0000 |
commit | 07202f944c556ef71f6d6676189db73ed5980992 (patch) | |
tree | 3f5150f8dc045de2a4c29a987f6e700586d0d7b9 /crates/ra_vfs/src | |
parent | c881fc607efafc04fb31ede90623dc6353620b7f (diff) |
Remove some unnecessary unwraps by using the `Result::ok`
combinatoric
Diffstat (limited to 'crates/ra_vfs/src')
-rw-r--r-- | crates/ra_vfs/src/lib.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/crates/ra_vfs/src/lib.rs b/crates/ra_vfs/src/lib.rs index ced86740b..90d5e21f4 100644 --- a/crates/ra_vfs/src/lib.rs +++ b/crates/ra_vfs/src/lib.rs | |||
@@ -59,12 +59,8 @@ impl RootFilter { | |||
59 | if !(self.file_filter)(path) { | 59 | if !(self.file_filter)(path) { |
60 | return None; | 60 | return None; |
61 | } | 61 | } |
62 | if !(path.starts_with(&self.root)) { | 62 | let path = path.strip_prefix(&self.root).ok()?; |
63 | return None; | 63 | RelativePathBuf::from_path(path).ok() |
64 | } | ||
65 | let path = path.strip_prefix(&self.root).unwrap(); | ||
66 | let path = RelativePathBuf::from_path(path).unwrap(); | ||
67 | Some(path) | ||
68 | } | 64 | } |
69 | } | 65 | } |
70 | 66 | ||