From 834a8c3fa2987fc6854c806152b044b7605dd6b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 11 Apr 2020 14:19:46 +0200 Subject: [PATCH] cli_helpers: run_with_cli_and_config: rename function and "f" argument --- aquatic/src/bin/aquatic.rs | 2 +- cli_helpers/src/lib.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aquatic/src/bin/aquatic.rs b/aquatic/src/bin/aquatic.rs index f52b5a8..3ad9b9d 100644 --- a/aquatic/src/bin/aquatic.rs +++ b/aquatic/src/bin/aquatic.rs @@ -7,7 +7,7 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; fn main(){ - cli_helpers::run_with_cli_and_config::( + cli_helpers::run_app_with_cli_and_config::( "aquatic: udp bittorrent tracker", aquatic::run, ) diff --git a/cli_helpers/src/lib.rs b/cli_helpers/src/lib.rs index 6541932..020e318 100644 --- a/cli_helpers/src/lib.rs +++ b/cli_helpers/src/lib.rs @@ -36,10 +36,10 @@ fn default_config_as_toml() -> String } -pub fn run_with_cli_and_config( +pub fn run_app_with_cli_and_config( title: &str, // Function that takes config file and runs application - f: fn(T), + app_fn: fn(T), ) where T: Default + Serialize + DeserializeOwned { let args: Vec = ::std::env::args().collect(); @@ -51,7 +51,7 @@ pub fn run_with_cli_and_config( print!("{}", default_config_as_toml::()); } else if let Some(config_file) = opts.config_file { match config_from_toml_file(config_file){ - Ok(config) => f(config), + Ok(config) => app_fn(config), Err(err) => { eprintln!("Error while reading config file: {}", err); @@ -59,7 +59,7 @@ pub fn run_with_cli_and_config( } } } else { - f(T::default()) + app_fn(T::default()) } }, Err(err) => {