From 70b0edaf89b61d485cbf63db68bea64a8322bcb3 Mon Sep 17 00:00:00 2001 From: southerntofu Date: Thu, 6 Jan 2022 18:12:54 +0100 Subject: [PATCH] Cleanup warnings --- src/cli.rs | 1 - src/log.rs | 7 ++++--- src/task.rs | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 23700af..2324247 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,4 +1,3 @@ -use std::env; use std::path::PathBuf; use structopt::StructOpt; use structopt::clap::ErrorKind as ClapError; diff --git a/src/log.rs b/src/log.rs index f010aab..dcb62ed 100644 --- a/src/log.rs +++ b/src/log.rs @@ -65,8 +65,6 @@ fn find_translations() -> Option { let mut bindir = PathBuf::from(env::args().nth(0).expect("Argument 0 should contain the path to the program")); bindir.pop(); - let mut homedir = get_user_by_uid(get_effective_uid()).expect("Failed owner profile").home_dir(); - let options = [ bindir.join("../../../build/i18n"), bindir.join("../../spec/i18n"), @@ -74,7 +72,6 @@ fn find_translations() -> Option { PathBuf::from("/usr/share/forgebuild/i18n"), ]; - let mut found = false; for entry in options { if entry.is_dir() { // We found a matching entry @@ -207,24 +204,28 @@ fn expand(msg: &str, vars: &Context) -> String { .fold(msg.to_string(), |prev, (key, val)| prev.replace(key, val)); } +#[allow(dead_code)] pub fn info(msg: &str, vars: &Context) { if LOGLEVEL.info { println!("{}{}", trans("info"), trans_context(msg, vars)); } } +#[allow(dead_code)] pub fn error(msg: &str, vars: &Context) { if LOGLEVEL.error { eprintln!("{}{}", trans("error"), trans_context(msg, vars)); } } +#[allow(dead_code)] pub fn warn(msg: &str, vars: &Context) { if LOGLEVEL.error { eprintln!("{}{}", trans("warning"), trans_context(msg, vars)); } } +#[allow(dead_code)] pub fn debug(msg: &str, vars: &Context) { if LOGLEVEL.debug { println!("{}{}", trans("debug"), trans_context(msg, vars)); diff --git a/src/task.rs b/src/task.rs index 12c5ce7..60cf455 100644 --- a/src/task.rs +++ b/src/task.rs @@ -164,18 +164,22 @@ impl Task { } } + #[allow(dead_code)] pub fn debug(&self, message: &str) { log::debug(message, &self.context); } + #[allow(dead_code)] pub fn info(&self, message: &str) { log::info(message, &self.context); } + #[allow(dead_code)] pub fn warn(&self, message: &str) { log::warn(message, &self.context); } + #[allow(dead_code)] pub fn error(&self, message: &str) { log::error(message, &self.context); }