From a7cac14ed9656d1d06a5e3025d80fccf860f85dc Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 4 Feb 2019 15:35:32 +0100 Subject: [PATCH] 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 --- src/tools.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/tools.rs b/src/tools.rs index 6932fc56..1891719a 100644 --- a/src/tools.rs +++ b/src/tools.rs @@ -79,14 +79,7 @@ pub fn file_read_firstline>(path: P) -> Result>(path: P) -> Result, 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