From 4539d87cbe897bc11528520e03ce7fd1bd0cd20c Mon Sep 17 00:00:00 2001 From: Devdutt Shenoi Date: Sat, 8 Jun 2024 19:56:47 +0530 Subject: [PATCH] style: replace closure with fn call --- uplink/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/uplink/src/main.rs b/uplink/src/main.rs index f37dcaf8..a1afc206 100644 --- a/uplink/src/main.rs +++ b/uplink/src/main.rs @@ -1,5 +1,6 @@ mod console; +use std::fs::read_to_string; use std::path::PathBuf; use std::sync::{Arc, Mutex}; use std::time::Duration; @@ -96,12 +97,11 @@ impl CommandLine { /// Reads config file to generate config struct and replaces places holders /// like bike id and data version fn get_configs(&self) -> Result { - let read_file_contents = |path| std::fs::read_to_string(path); let mut config = config::Config::builder().add_source(File::from_str(DEFAULT_CONFIG, FileFormat::Toml)); if let Some(path) = &self.config { - let read = read_file_contents(path).map_err(|e| { + let read = read_to_string(path).map_err(|e| { Error::msg(format!( "Config file couldn't be loaded from {:?}; error = {e}", path.display() @@ -110,7 +110,7 @@ impl CommandLine { config = config.add_source(File::from_str(&read, FileFormat::Toml)); } - let auth = read_file_contents(&self.auth).map_err(|e| { + let auth = read_to_string(&self.auth).map_err(|e| { Error::msg(format!( "Auth file couldn't be loaded from {:?}; error = {e}", self.auth.display()