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:
Wolfgang Bumiller 2019-02-04 15:35:32 +01:00
parent e937034c86
commit a7cac14ed9
1 changed files with 1 additions and 8 deletions

View File

@ -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