From 9063d349f0091aad06251b76a4a92ec86b945d60 Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Thu, 6 May 2021 01:14:26 +0200 Subject: [PATCH] Fix some small rusty issues --- src/config.rs | 6 +++--- src/pam.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config.rs b/src/config.rs index 2486f02..c6e4ee0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -18,7 +18,7 @@ extern crate config; fn load_config(config_file: String) -> config::Config { let mut conf = config::Config::default(); - conf.set("pam.flow", "password"); + conf.set("pam.flow", "password").ok(); conf .merge(config::File::with_name(&config_file)).unwrap() @@ -48,9 +48,9 @@ pub fn argv_to_config(argv: &Vec<String>) -> config::Config { for arg in argv { if arg.contains("=") { let split: Vec<&str> = arg.split("=").collect(); - conf.set(split[0], split[1]); + conf.set(split[0], split[1]).ok(); } else { - conf.set(arg, true); + conf.set(arg, true).ok(); } } return conf; diff --git a/src/pam.rs b/src/pam.rs index 47d7269..5edea9f 100644 --- a/src/pam.rs +++ b/src/pam.rs @@ -46,7 +46,7 @@ fn get_or_pam_error(config: &Config, key: &str) -> Result<String, PamError> { debug!("Configuration key found: {} = {}", key, v); return Ok(v); }, - _ => { + Err(_) => { error!("Configuration key not found: {}", key); return Err(PamError::SERVICE_ERR); }, -- GitLab