Cleanup warnings

This commit is contained in:
southerntofu 2022-01-06 18:12:54 +01:00
parent b5c0d6aad3
commit 70b0edaf89
3 changed files with 8 additions and 4 deletions

View File

@ -1,4 +1,3 @@
use std::env;
use std::path::PathBuf;
use structopt::StructOpt;
use structopt::clap::ErrorKind as ClapError;

View File

@ -65,8 +65,6 @@ fn find_translations() -> Option<PathBuf> {
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> {
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));

View File

@ -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);
}