diff options
author | Conrad Ludgate <conradludgate@gmail.com> | 2021-11-13 20:58:40 +0000 |
---|---|---|
committer | Conrad Ludgate <conradludgate@gmail.com> | 2021-11-21 11:36:17 +0000 |
commit | 027d1583c47caf65daad04bc5f5a8ddae4ca2642 (patch) | |
tree | 24d8761f55ca0958ac937ca887c77c3268367e70 /src | |
parent | fd7ef7fbce135da904fcef678d5ca3089d794a8d (diff) |
chore: some file read simplifications
Diffstat (limited to 'src')
-rw-r--r-- | src/file/source/file.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/file/source/file.rs b/src/file/source/file.rs index 471b654..5a50d93 100644 --- a/src/file/source/file.rs +++ b/src/file/source/file.rs @@ -1,7 +1,7 @@ use std::env; use std::error::Error; use std::fs; -use std::io::{self, Read}; +use std::io; use std::iter::Iterator; use std::path::{Path, PathBuf}; @@ -114,9 +114,7 @@ where .unwrap_or_else(|| filename.clone()); // Read contents from file - let mut file = fs::File::open(filename)?; - let mut text = String::new(); - file.read_to_string(&mut text)?; + let text = fs::read_to_string(filename)?; Ok(FileSourceResult { uri: Some(uri.to_string_lossy().into_owned()), |