Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6a636d5

Browse files
dependencies: switch from colored to owo-colors
owo-colors is well-maintained, zero-allocation, zero-dependencies crate for terminal colors. Also it works on any type that implements Display trait, not just on strings.
1 parent b5ec900 commit 6a636d5

3 files changed

Lines changed: 14 additions & 29 deletions

File tree

Cargo.lock

Lines changed: 7 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ itertools = "0.10.0"
2727
num_cpus = "1.10.0"
2828
filesize = "0.2.0"
2929
anyhow = "1.0.31"
30-
colored = "2.0.0"
3130
trash = { version = "2.1.5", optional = true, default-features = false, features = ["coinit_apartmentthreaded"] }
3231

3332
# 'tui' related
@@ -37,6 +36,7 @@ tui = { version = "0.17.0", optional = true, default-features = false }
3736
tui-react = { version = "0.17.0", optional = true }
3837
open = { version = "3.0", optional = true }
3938
wild = "2.0.4"
39+
owo-colors = "3.5.0"
4040

4141
[target.'cfg(all(target_os = "macos", target_arch = "aarch64"))'.dependencies]
4242
sysinfo = { version = "0.23.2", default-features = false }

src/aggregate.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{crossdev, InodeFilter, WalkOptions, WalkResult};
22
use anyhow::Result;
3-
use colored::{Color, Colorize};
43
use filesize::PathExt;
4+
use owo_colors::{AnsiColors as Color, OwoColorize};
55
use std::{borrow::Cow, io, path::Path};
66
use std::{
77
sync::{
@@ -199,23 +199,19 @@ fn output_colored_path(
199199
path: impl AsRef<Path>,
200200
num_bytes: u128,
201201
num_errors: u64,
202-
path_color: Option<colored::Color>,
202+
path_color: Option<Color>,
203203
) -> std::result::Result<(), io::Error> {
204204
writeln!(
205205
out,
206206
"{:>byte_column_width$} {}{}",
207-
options
208-
.byte_format
209-
.display(num_bytes)
210-
.to_string()
211-
.as_str()
212-
.green(),
207+
options.byte_format.display(num_bytes).green(),
213208
{
214-
let path = path.as_ref().display().to_string();
209+
let path = path.as_ref().display();
215210
match path_color {
216211
Some(color) => path.color(color),
217-
None => path.normal(),
212+
None => path.color(Color::Default),
218213
}
214+
.to_string()
219215
},
220216
if num_errors == 0 {
221217
Cow::Borrowed("")

0 commit comments

Comments
 (0)