From 22f4f313f1cbdaadafcc3dd471f5a0bb4f7034e1 Mon Sep 17 00:00:00 2001 From: nkitsaini Date: Mon, 21 Aug 2023 00:41:32 +0530 Subject: Remove unnecessary `Err` from `get_canonicalized_path` (#8009) Co-authored-by: Michael Davis --- helix-term/src/ui/picker.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'helix-term/src/ui/picker.rs') 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 { + 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 Picker { fn current_file(&self, editor: &Editor) -> Option { 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 -- cgit v1.2.3-70-g09d2