[PR #232] [MERGED] Lots of code cleanup #371

Closed
opened 2026-06-08 11:27:36 +03:00 by zhus · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bootandy/dust/pull/232
Author: @Lucretiel
Created: 7/31/2022
Status: Merged
Merged: 8/20/2022
Merged by: @bootandy

Base: masterHead: cleanup


📝 Commits (3)

  • 0cdb7c1 Lots of code cleanup
  • fcf457b get_new_root no longer panics if there are 0 nodes
  • 91ea8c9 Use correct error code type

📊 Changes

11 files changed (+294 additions, -305 deletions)

View changed files

📝 src/dir_walker.rs (+29 -30)
📝 src/display.rs (+33 -19)
📝 src/display_node.rs (+7 -29)
📝 src/filter.rs (+72 -61)
📝 src/main.rs (+91 -102)
📝 src/node.rs (+28 -32)
📝 src/platform.rs (+7 -7)
📝 src/utils.rs (+6 -9)
📝 tests/test_exact_output.rs (+8 -11)
📝 tests/test_flags.rs (+1 -1)
📝 tests/tests_symlinks.rs (+12 -4)

📄 Description

  • 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 (significantly fewer allocations)
  • PartialOrd and PartialEq implementations on Node and DisplayNode now agree with each other (it's no longer possible to construct a Node for which node1 != node2 && !(node1 < node2) && !(node1 > node2)).
  • Replace #[cfg(...)] function definitions with simpler if cfg!(...) equivalents
    • The optimized code is the same and this reduces maintenance burden of keeping signatures synchronized
  • Simplify CLI Values handling by taking advantage of Values::default
  • Various spelling corrections in comments
  • Replace (sort, reverse) with sort_by

I can split this into several PRs if you'd like, but each change was so small that it was easier to put them all together.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bootandy/dust/pull/232 **Author:** [@Lucretiel](https://github.com/Lucretiel) **Created:** 7/31/2022 **Status:** ✅ Merged **Merged:** 8/20/2022 **Merged by:** [@bootandy](https://github.com/bootandy) **Base:** `master` ← **Head:** `cleanup` --- ### 📝 Commits (3) - [`0cdb7c1`](https://github.com/bootandy/dust/commit/0cdb7c1b7fcc5a4b7c1e3d47ceec563c3e7bbd25) Lots of code cleanup - [`fcf457b`](https://github.com/bootandy/dust/commit/fcf457b5ab168f7c3f6d9dca6cefab22d5a9259b) `get_new_root` no longer panics if there are 0 nodes - [`91ea8c9`](https://github.com/bootandy/dust/commit/91ea8c99d094b978080f5a6078d85bedae1876d5) Use correct error code type ### 📊 Changes **11 files changed** (+294 additions, -305 deletions) <details> <summary>View changed files</summary> 📝 `src/dir_walker.rs` (+29 -30) 📝 `src/display.rs` (+33 -19) 📝 `src/display_node.rs` (+7 -29) 📝 `src/filter.rs` (+72 -61) 📝 `src/main.rs` (+91 -102) 📝 `src/node.rs` (+28 -32) 📝 `src/platform.rs` (+7 -7) 📝 `src/utils.rs` (+6 -9) 📝 `tests/test_exact_output.rs` (+8 -11) 📝 `tests/test_flags.rs` (+1 -1) 📝 `tests/tests_symlinks.rs` (+12 -4) </details> ### 📄 Description - 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 `Option`s and `Result`s, where possible - Replaced nearly all `clone`s with reference-based equivalents - Summarizing nodes by file extension is now much more efficient (significantly fewer allocations) - `PartialOrd` and `PartialEq` implementations on `Node` and `DisplayNode` now agree with each other (it's no longer possible to construct a `Node` for which `node1 != node2 && !(node1 < node2) && !(node1 > node2)`). - Replace `#[cfg(...)]` function definitions with simpler if `cfg!(...)` equivalents - The optimized code is the same and this reduces maintenance burden of keeping signatures synchronized - Simplify CLI `Values` handling by taking advantage of Values::default - Various spelling corrections in comments - Replace (`sort`, `reverse`) with `sort_by` I can split this into several PRs if you'd like, but each change was so small that it was easier to put them all together. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
zhus added the pull-request label 2026-06-08 11:27:36 +03:00
zhus closed this issue 2026-06-08 11:27:37 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bootandy/archived-dust#371