Skip to content

Commit

Permalink
style: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveLauC committed Sep 22, 2024
1 parent 5b701d0 commit 25fcb19
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,13 +572,11 @@ impl ConfigFile {
to read the include directory before returning the main config path
*/
for include in dir_include {
let include_contents = fs::read_to_string(&include).map_err(|e| {
let include_contents = fs::read_to_string(&include).inspect_err(|_| {
error!("Unable to read {}", include.display());
e
})?;
let include_contents_parsed = toml::from_str(include_contents.as_str()).map_err(|e| {
let include_contents_parsed = toml::from_str(include_contents.as_str()).inspect_err(|_| {
error!("Failed to deserialize {}", include.display());
e
})?;

result.merge(include_contents_parsed);
Expand All @@ -593,9 +591,8 @@ impl ConfigFile {
return Ok(result);
}

let mut contents_non_split = fs::read_to_string(&config_path).map_err(|e| {
let mut contents_non_split = fs::read_to_string(&config_path).inspect_err(|_| {
error!("Unable to read {}", config_path.display());
e
})?;

Self::ensure_misc_is_present(&mut contents_non_split, &config_path);
Expand All @@ -606,9 +603,8 @@ impl ConfigFile {
let contents_split = regex_match_include.split_inclusive_left(contents_non_split.as_str());

for contents in contents_split {
let config_file_include_only: ConfigFileIncludeOnly = toml::from_str(contents).map_err(|e| {
let config_file_include_only: ConfigFileIncludeOnly = toml::from_str(contents).inspect_err(|_| {
error!("Failed to deserialize an include section of {}", config_path.display());
e
})?;

if let Some(includes) = &config_file_include_only.include {
Expand Down

0 comments on commit 25fcb19

Please sign in to comment.