aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authornkitsaini2023-08-20 19:11:32 +0000
committerGitHub2023-08-20 19:11:32 +0000
commit22f4f313f1cbdaadafcc3dd471f5a0bb4f7034e1 (patch)
tree39f263a35821bc6b90874a1d740499b3bc376646 /helix-term/src/ui
parent2767459f89382f2b664c2a9f5ff287f3c48a896d (diff)
Remove unnecessary `Err` from `get_canonicalized_path` (#8009)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/picker.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index 5ee4c407..b134eb47 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -51,12 +51,12 @@ pub enum PathOrId {
}
impl PathOrId {
- fn get_canonicalized(self) -> std::io::Result<Self> {
+ fn get_canonicalized(self) -> Self {
use PathOrId::*;
- Ok(match self {
- Path(path) => Path(helix_core::path::get_canonicalized_path(&path)?),
+ match self {
+ Path(path) => Path(helix_core::path::get_canonicalized_path(&path)),
Id(id) => Id(id),
- })
+ }
}
}
@@ -375,7 +375,7 @@ impl<T: Item + 'static> Picker<T> {
fn current_file(&self, editor: &Editor) -> Option<FileLocation> {
self.selection()
.and_then(|current| (self.file_fn.as_ref()?)(editor, current))
- .and_then(|(path_or_id, line)| path_or_id.get_canonicalized().ok().zip(Some(line)))
+ .map(|(path_or_id, line)| (path_or_id.get_canonicalized(), line))
}
/// Get (cached) preview for a given path. If a document corresponding