Skip to content

refactor: code cleanup and streamlining#767

Open
dacrab wants to merge 1 commit into
MalpenZibo:mainfrom
dacrab:refactor/code-cleanup
Open

refactor: code cleanup and streamlining#767
dacrab wants to merge 1 commit into
MalpenZibo:mainfrom
dacrab:refactor/code-cleanup

Conversation

@dacrab
Copy link
Copy Markdown
Contributor

@dacrab dacrab commented May 21, 2026

Summary

Mechanical cleanup: removes dead code, eliminates duplication, and reduces unnecessary allocations. Net result: -82 lines.

Changes

Change Impact
Add toggle_sub_menu() helper to Settings Replaces 7 identical if/else toggle blocks
Remove ActiveConnectionState enum Dead code (never used, #[allow(unused)])
Remove WiredDevice proxy trait Dead code (never instantiated)
Sort with (u8, &str) tuple key Eliminates 2 String allocations per comparison
Combine niri.rs match arms with ` `
launcher.rs API: String&str Eliminates 16 unnecessary .to_string()/.clone() calls
Extract connection_id() helper Replaces 3 duplicate D-Bus settings extraction chains

Testing

  • cargo check
  • cargo clippy -- -D warnings ✓ (zero warnings)

- Add toggle_sub_menu helper to Settings, replacing 7 duplicate blocks
- Remove dead code: ActiveConnectionState enum, WiredDevice proxy trait
- Fix sort allocation: use (u8, &str) tuple key instead of format!()
- Combine duplicate match arms in niri.rs
- Change launcher.rs API from String to &str, eliminating unnecessary
  .to_string()/.clone() at 16 call sites
- Extract connection_id helper in network/dbus.rs, replacing 3 duplicate
  extraction chains
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant