Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jul 27, 2020
1 parent 4d2e839 commit cdc5ee3
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,6 @@ fn path_color_of(path: impl AsRef<Path>) -> Option<Color> {
}
}

fn colorize_path(path: &Path, path_color: Option<colored::Color>) -> colored::ColoredString {
if let Some(path_color) = path_color {
path.display().to_string().as_str().color(path_color)
} else {
path.display().to_string().as_str().normal()
}
}

fn output_colored_path(
out: &mut impl io::Write,
options: &WalkOptions,
Expand All @@ -142,7 +134,13 @@ fn output_colored_path(
.to_string()
.as_str()
.green(),
colorize_path(path.as_ref(), path_color),
{
let path = path.as_ref().display().to_string();
match path_color {
Some(color) => path.color(color),
None => path.normal(),
}
},
if num_errors == 0 {
Cow::Borrowed("")
} else {
Expand Down

0 comments on commit cdc5ee3

Please sign in to comment.