tools: use std::fs::read for file_get_contents
Until we add the extra options like we have in pve, just use the already existing (since 1.26) shortcut. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
e937034c86
commit
a7cac14ed9
@ -79,14 +79,7 @@ pub fn file_read_firstline<P: AsRef<Path>>(path: P) -> Result<String, std::io::E
|
||||
}
|
||||
|
||||
pub fn file_get_contents<P: AsRef<Path>>(path: P) -> Result<Vec<u8>, std::io::Error> {
|
||||
|
||||
let mut file = std::fs::File::open(path)?;
|
||||
|
||||
let mut buffer = Vec::new();
|
||||
|
||||
file.read_to_end(&mut buffer)?;
|
||||
|
||||
Ok(buffer)
|
||||
std::fs::read(path)
|
||||
}
|
||||
|
||||
/// Atomically write a file. We first create a temporary file, which
|
||||
|
Loading…
Reference in New Issue
Block a user