fix usage of debug formatters

This commit is contained in:
steven-omaha
2023-02-14 12:44:47 +01:00
parent f3632d0afd
commit cee16bc5f8
4 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ impl Config {
if let Err(e) = from_file { if let Err(e) = from_file {
if e.kind() == ErrorKind::NotFound { if e.kind() == ErrorKind::NotFound {
println!("creating default config under {file:?}"); println!("creating default config under {}", file.to_string_lossy());
return Self::use_default_and_save_to(file); return Self::use_default_and_save_to(file);
} else { } else {
bail!("unexpected error occured: {e:?}"); bail!("unexpected error occured: {e:?}");
+4 -1
View File
@@ -313,7 +313,10 @@ fn show_error(error: &anyhow::Error, backend: &dyn Backend) {
match get_single_var("RUST_BACKTRACE") { match get_single_var("RUST_BACKTRACE") {
Some(s) => { Some(s) => {
if s == "1" || s == "full" { if s == "1" || s == "full" {
println!("WARNING: skipping backend '{section}': {error:?}\n"); eprintln!("WARNING: skipping backend '{section}':");
for err in error.chain() {
eprintln!(" {err}");
}
} }
} }
None => println!("WARNING: skipping backend '{section}': {error}"), None => println!("WARNING: skipping backend '{section}': {error}"),
+8 -3
View File
@@ -27,7 +27,10 @@ impl Group {
let path = file.path(); let path = file.path();
if config.warn_not_symlinks && !path.is_symlink() { if config.warn_not_symlinks && !path.is_symlink() {
println!("WARNING: group file {path:?} is not a symlink"); println!(
"WARNING: group file {} is not a symlink",
path.to_string_lossy()
);
} }
let group = let group =
@@ -88,12 +91,14 @@ impl Group {
let mut sections = HashSet::new(); let mut sections = HashSet::new();
while lines.peek().is_some() { while lines.peek().is_some() {
match Section::try_from_lines(&mut lines).context("reading section") { let result = Section::try_from_lines(&mut lines).context("reading section");
match result {
Ok(section) => { Ok(section) => {
sections.insert(section); sections.insert(section);
} }
Err(e) => { Err(e) => {
println!("WARNING: could not process a section under group '{name}': {e:?}\n"); let err = e.root_cause();
println!("WARNING: could not process a section under group '{name}': {err}");
} }
} }
} }
+1 -1
View File
@@ -45,7 +45,7 @@ impl Section {
} }
} }
ensure!(!packages.is_empty()); ensure!(!packages.is_empty(), "[{name}] is empty");
Ok(Self::new(name, packages)) Ok(Self::new(name, packages))
} }