Lots of code cleanup

- Try to use iterator adapters and collect in various places, where possible. This especially benefits draw_it.
- Try to use `.map` and other similar methods on Options and Results, where possible
- Replaced nearly all clones with reference-based equivalents
- Summarizing nodes by file extension is now much more efficient
- PartialOrd and PartialEq implementations now agree
- Replace #[cfg(...)] function definitions with simpler if cfg!(...) equivelents
- Simplify CLI Values handling by taking advantage of Values::default
- Various spelling corrections in comments
- Add `ColorState` enum to replace bool, for clarity
- Fix tests that break under some detected terminal widths when paths are long
- Use sort_by instead of (sort, reverse)
- Use new `ExtensionNode` struct internally to simplify extension aggregation code
This commit is contained in:
Nathan West
2022-08-18 16:40:58 -04:00
committed by andy.boot
parent 34ba99af2a
commit c36ca33fe9
11 changed files with 293 additions and 304 deletions

View File

@@ -39,9 +39,12 @@ pub fn test_soft_sym_link() {
let a = format!("─┴ {}", dir_s);
let mut cmd = Command::cargo_bin("dust").unwrap();
// Mac test runners create long filenames in tmp directories
let output = cmd
.args(["-p", "-c", "-s", "-w 999", dir_s])
.arg("-p")
.arg("-c")
.arg("-s")
.args(["-w", "999"])
.arg(dir_s)
.unwrap()
.stdout;
@@ -72,8 +75,13 @@ pub fn test_hard_sym_link() {
let dirs_output = format!("─┴ {}", dir_s);
let mut cmd = Command::cargo_bin("dust").unwrap();
// Mac test runners create long filenames in tmp directories
let output = cmd.args(["-p", "-c", "-w 999", dir_s]).unwrap().stdout;
let output = cmd
.arg("-p")
.arg("-c")
.args(["-w", "999"])
.arg(dir_s)
.unwrap()
.stdout;
// The link should not appear in the output because multiple inodes are now ordered
// then filtered.