From b5827004a247ed09822dcc3cc60cb90a5a5f1c7a Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 1 Mar 2021 12:19:56 -0600 Subject: [PATCH] refactor(config): Simplify --- src/config.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/config.rs b/src/config.rs index 685ee91..064f23f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,4 @@ use std::collections::HashMap; -use std::io::Read; pub trait ConfigSource { fn walk(&self) -> Option<&dyn WalkSource> { @@ -107,9 +106,7 @@ pub struct Config { impl Config { pub fn from_file(path: &std::path::Path) -> Result { - let mut file = std::fs::File::open(path)?; - let mut s = String::new(); - file.read_to_string(&mut s)?; + let s = std::fs::read_to_string(path)?; Self::from_toml(&s) }