Remove read_file and read_file_string and replace them with the std alternatives

This commit is contained in:
Daniel García
2022-07-15 19:13:26 +02:00
parent 7cbcad0e38
commit c9376e3126
5 changed files with 6 additions and 19 deletions

View File

@ -308,11 +308,6 @@ pub fn file_exists(path: &str) -> bool {
Path::new(path).exists()
}
pub fn read_file(path: &str) -> IOResult<Vec<u8>> {
let contents = fs::read(Path::new(path))?;
Ok(contents)
}
pub fn write_file(path: &str, content: &[u8]) -> Result<(), crate::error::Error> {
use std::io::Write;
let mut f = File::create(path)?;
@ -321,11 +316,6 @@ pub fn write_file(path: &str, content: &[u8]) -> Result<(), crate::error::Error>
Ok(())
}
pub fn read_file_string(path: &str) -> IOResult<String> {
let contents = fs::read_to_string(Path::new(path))?;
Ok(contents)
}
pub fn delete_file(path: &str) -> IOResult<()> {
let res = fs::remove_file(path);