aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authornkitsaini2023-08-20 19:11:32 +0000
committerGitHub2023-08-20 19:11:32 +0000
commit22f4f313f1cbdaadafcc3dd471f5a0bb4f7034e1 (patch)
tree39f263a35821bc6b90874a1d740499b3bc376646 /helix-view
parent2767459f89382f2b664c2a9f5ff287f3c48a896d (diff)
Remove unnecessary `Err` from `get_canonicalized_path` (#8009)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/document.rs12
-rw-r--r--helix-view/src/editor.rs2
2 files changed, 5 insertions, 9 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index 3477608b..08b57f21 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -708,7 +708,7 @@ impl Document {
let mut doc = Self::from(rope, Some((encoding, has_bom)), config);
// set the path and try detecting the language
- doc.set_path(Some(path))?;
+ doc.set_path(Some(path));
if let Some(loader) = config_loader {
doc.detect_language(loader);
}
@@ -853,7 +853,7 @@ impl Document {
let text = self.text().clone();
let path = match path {
- Some(path) => helix_core::path::get_canonicalized_path(&path)?,
+ Some(path) => helix_core::path::get_canonicalized_path(&path),
None => {
if self.path.is_none() {
bail!("Can't save with no path set!");
@@ -1047,18 +1047,14 @@ impl Document {
self.encoding
}
- pub fn set_path(&mut self, path: Option<&Path>) -> Result<(), std::io::Error> {
- let path = path
- .map(helix_core::path::get_canonicalized_path)
- .transpose()?;
+ pub fn set_path(&mut self, path: Option<&Path>) {
+ let path = path.map(helix_core::path::get_canonicalized_path);
// if parent doesn't exist we still want to open the document
// and error out when document is saved
self.path = path;
self.detect_readonly();
-
- Ok(())
}
/// Set the programming language for the file and load associated data (e.g. highlighting)
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 66542e89..1735b060 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -1436,7 +1436,7 @@ impl Editor {
// ??? possible use for integration tests
pub fn open(&mut self, path: &Path, action: Action) -> Result<DocumentId, Error> {
- let path = helix_core::path::get_canonicalized_path(path)?;
+ let path = helix_core::path::get_canonicalized_path(path);
let id = self.document_by_path(&path).map(|doc| doc.id);
let id = if let Some(id) = id {