We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 23db8af + 0ea8217 commit dae208dCopy full SHA for dae208d
src/lua/parsing/files.rs
@@ -12,18 +12,13 @@
12
// either express or implied. See the License for the specific language governing permissions
13
// and limitations under the License.
14
15
-use log::{debug, error};
16
use std::fs::File;
17
-use std::io::Read;
+use std::io::{BufReader,Read};
18
19
pub fn filename_to_string(s: &str) -> Result<String, std::io::Error> {
20
- let file = File::open(s);
21
- debug!("READING {:?}", s);
22
- if file.is_err() {
23
- error!("READING ERROR: {:?}", s);
24
- return Err(file.unwrap_err());
25
- }
+ let file = File::open(s)?;
+ let mut buf_reader = BufReader::new(file);
26
let mut s = String::new();
27
- file.unwrap().read_to_string(&mut s)?;
+ buf_reader.read_to_string(&mut s)?;
28
Ok(s)
29
}
0 commit comments