Skip to content

Commit 0d6af21

Browse files
fcouryclaude
andcommitted
fix: resolve clippy warnings
- Add Default derive for OverlayManager instead of manual implementation - Add Default derive for TimerUsage instead of manual implementation - Follows clippy's recommendations for cleaner, more idiomatic code 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 08ca515 commit 0d6af21

3 files changed

Lines changed: 8 additions & 16 deletions

File tree

.hookman/hooks/pre-push.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
hook_type = "pre-push"
2+
3+
[[commands]]
4+
id = "clippy"
5+
command = "cargo clippy"

src/plugin/overlay.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,15 @@ impl PluginOverlay {
158158
}
159159
}
160160

161+
#[derive(Default)]
161162
pub struct OverlayManager {
162163
overlays: HashMap<String, PluginOverlay>,
163164
z_order: Vec<String>, // Track rendering order
164165
}
165166

166167
impl OverlayManager {
167168
pub fn new() -> Self {
168-
Self {
169-
overlays: HashMap::new(),
170-
z_order: Vec::new(),
171-
}
169+
Self::default()
172170
}
173171

174172
pub fn create_overlay(&mut self, id: String, config: OverlayConfig) -> &mut PluginOverlay {

src/plugin/timer_stats.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,14 @@ lazy_static::lazy_static! {
55
static ref TIMER_STATS: Mutex<HashMap<String, TimerUsage>> = Mutex::new(HashMap::new());
66
}
77

8-
#[derive(Debug, Clone)]
8+
#[derive(Debug, Clone, Default)]
99
pub struct TimerUsage {
1010
pub active_timeouts: usize,
1111
pub active_intervals: usize,
1212
pub total_created: usize,
1313
pub total_cleared: usize,
1414
}
1515

16-
impl Default for TimerUsage {
17-
fn default() -> Self {
18-
Self {
19-
active_timeouts: 0,
20-
active_intervals: 0,
21-
total_created: 0,
22-
total_cleared: 0,
23-
}
24-
}
25-
}
26-
2716
pub fn record_timer_created(plugin_name: &str, is_interval: bool) {
2817
let mut stats = TIMER_STATS.lock().unwrap();
2918
let usage = stats.entry(plugin_name.to_string()).or_default();

0 commit comments

Comments
 (0)