mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-06-12 05:07:40 +02:00
Remove read_file and read_file_string and replace them with the std alternatives
This commit is contained in:
10
src/util.rs
10
src/util.rs
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user