summaryrefslogtreecommitdiff
path: root/matrix-std/src/io.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--matrix-std/src/io.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/matrix-std/src/io.rs b/matrix-std/src/io.rs
index 19ff074..829ed28 100644
--- a/matrix-std/src/io.rs
+++ b/matrix-std/src/io.rs
@@ -106,7 +106,7 @@ fn file_read(_: VmArgs, args: Vec<Value>) -> Result<Value> {
return error!("file read requires a file")
};
let mut contents = String::new();
- if let Err(err) = file.try_borrow_mut().unwrap().read_to_string(&mut contents) {
+ if let Err(err) = file.borrow_mut().read_to_string(&mut contents) {
return error!("cannot read file: '{err}'")
};
Ok(Value::String(contents.into()))
@@ -119,7 +119,7 @@ fn file_lines(_: VmArgs, args: Vec<Value>) -> Result<Value> {
return error!("file read requires a file")
};
let mut contents = String::new();
- if let Err(err) = file.try_borrow_mut().unwrap().read_to_string(&mut contents) {
+ if let Err(err) = file.borrow_mut().read_to_string(&mut contents) {
return error!("cannot read file: '{err}'")
};
let lines: Vec<Rc<str>> = contents.split_inclusive("\n").map(|s| Rc::from(s)).collect();
@@ -139,7 +139,7 @@ fn file_write(_: VmArgs, args: Vec<Value>) -> Result<Value> {
return error!("file write requires a file")
};
let content = format!("{content}");
- if let Err(err) = file.try_borrow_mut().unwrap().write_all(content.as_bytes()) {
+ if let Err(err) = file.borrow_mut().write_all(content.as_bytes()) {
return error!("cannot write file: '{err}'")
};
Ok(Value::Nil)