Commit 72169fe
authored
refactor: drop stale and redundant dependencies (#199)
Audit the full direct dependency set in `Cargo.toml`, then remove or replace crates that were dead, redundant with the standard library, or duplicated with an existing dependency. Five crates (`arrayvec`, `ctrlc`, `directories`, `signal-hook 0.4.4`, plus the macOS `objc2`/`block2`/`dispatch2` chain pulled in by `ctrlc`) are now completely gone from the build graph; three more (`lazy_static`, `once_cell`, `fastrand`) remain transitively but are no longer directly referenced by our code.
Replacements:
- `lazy_static!` → `std::sync::LazyLock` in `src/ui/tui/progress.rs` (edition 2024 already mandates Rust 1.85+).
- `once_cell::sync::Lazy` / `OnceCell` → `std::sync::LazyLock` / `OnceLock` across `executor/output_sync.rs`, `pty/terminal.rs`, `utils/logging.rs`, `ssh/ssh_config/env_cache/global.rs`, `ssh/config_cache/global.rs`.
- `fastrand::u64(range)` → `rand::random_range(range)` in the three forwarding reconnect-jitter sites; `rand` 0.10 was already a direct dependency.
- `directories::ProjectDirs` / `BaseDirs` → `dirs::config_dir` / `dirs::home_dir`, unifying on `dirs` which was already used in 16 other sites and produces equivalent platform paths.
- `ctrlc::set_handler` → `tokio::signal::ctrl_c` inside a `tokio::spawn`, guarded by `Handle::try_current` to preserve the previous best-effort semantics in non-runtime contexts. The only caller (`execute_traditional`) is already async, and the matching test runs under `#[tokio::test]`.
- `signal-hook = "0.4.4"` → `"0.3"` so we share the same instance `crossterm` already pulls in via `signal-hook-mio`. Our usage (`Signals::new`, `Signals::forever`, `consts::SIGWINCH`) has identical signatures across both major lines, so no source change was needed — only the `Cargo.toml` pin.
The `arrayvec` crate was declared but unused anywhere in the source tree, so it is simply dropped.
Build, full `cargo test -p bssh` (1303 tests), `cargo clippy --all-targets`, and `cargo fmt --check` all pass. `Cargo.lock` loses 76 lines including the entire `signal-hook 0.4.4` subtree.1 parent 3e005d6 commit 72169fe
14 files changed
Lines changed: 54 additions & 135 deletions
File tree
- src
- commands
- config
- executor
- forwarding
- dynamic
- pty
- ssh
- config_cache
- ssh_config/env_cache
- ui/tui
- utils
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
48 | | - | |
49 | 47 | | |
50 | 48 | | |
51 | 49 | | |
52 | 50 | | |
53 | 51 | | |
54 | 52 | | |
55 | | - | |
56 | | - | |
57 | | - | |
| 53 | + | |
58 | 54 | | |
59 | | - | |
60 | 55 | | |
61 | 56 | | |
62 | 57 | | |
63 | | - | |
64 | 58 | | |
65 | 59 | | |
66 | 60 | | |
| |||
85 | 79 | | |
86 | 80 | | |
87 | 81 | | |
88 | | - | |
89 | 82 | | |
90 | 83 | | |
91 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
37 | 42 | | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
51 | 59 | | |
52 | 60 | | |
53 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
222 | 221 | | |
223 | 222 | | |
224 | 223 | | |
225 | | - | |
226 | | - | |
| 224 | + | |
| 225 | + | |
227 | 226 | | |
228 | 227 | | |
229 | 228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | | - | |
| 19 | + | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
| 22 | + | |
24 | 23 | | |
25 | 24 | | |
26 | | - | |
| 25 | + | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
| 235 | + | |
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
| 244 | + | |
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
33 | | - | |
| 32 | + | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
0 commit comments