File tree Expand file tree Collapse file tree 2 files changed +4
-25
lines changed
Expand file tree Collapse file tree 2 files changed +4
-25
lines changed Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ impl TimeWindowedTracker {
181181 samples. windows ( 2 ) . fold ( 0u8 , |total, w| {
182182 if w[ 1 ] > w[ 0 ] {
183183 let change = w[ 1 ] - w[ 0 ] ;
184- if max_change. map_or ( true , |max| change <= max) {
184+ if max_change. is_none_or ( |max| change <= max) {
185185 total. saturating_add ( change)
186186 } else {
187187 total
@@ -200,23 +200,6 @@ impl TimeWindowedTracker {
200200 self . calculate_momentum ( window, now, |m| m. weekly_pct ( ) , None )
201201 }
202202
203- fn detect_six_hour_reset ( & self ) -> bool {
204- if self . history . len ( ) < 2 {
205- return false ;
206- }
207-
208- let last_two: Vec < _ > = self . history . values ( ) . rev ( ) . take ( 2 ) . collect ( ) ;
209- if last_two. len ( ) < 2 {
210- return false ;
211- }
212-
213- let latest = last_two[ 0 ] . six_hour_pct ( ) ;
214- let previous = last_two[ 1 ] . six_hour_pct ( ) ;
215-
216- // Reset detected: significant drop (>20%)
217- previous > latest && ( previous - latest) > 20
218- }
219-
220203 fn time_since_any_change ( & self , now : Instant ) -> Duration {
221204 if self . history . len ( ) < 2 {
222205 return Duration :: MAX ;
Original file line number Diff line number Diff line change 11mod adaptive_poller;
2- mod system_events;
32
43use adaptive_poller:: { AdaptivePoller , PollerConfig , UsageMetrics } ;
54use serde:: { Deserialize , Serialize } ;
@@ -382,7 +381,7 @@ fn update_tray_icon(
382381 // Parse ISO 8601 timestamp and format it nicely
383382 s. split ( 'T' )
384383 . next ( )
385- . map ( |date| format ! ( "{}" , date) )
384+ . map ( |date| date. to_string ( ) )
386385 . unwrap_or_else ( || s. clone ( ) )
387386 } )
388387 . unwrap_or_else ( || "Unknown" . to_string ( ) )
@@ -537,11 +536,8 @@ pub fn run() {
537536 TrayIconBuilder :: with_id ( "main" )
538537 . icon ( icon)
539538 . menu ( & menu)
540- . on_menu_event ( |app, event| match event. id . as_ref ( ) {
541- "quit" => {
542- app. exit ( 0 ) ;
543- }
544- _ => { }
539+ . on_menu_event ( |app, event| if event. id . as_ref ( ) == "quit" {
540+ app. exit ( 0 ) ;
545541 } )
546542 . build ( app) ?;
547543
You can’t perform that action at this time.
0 commit comments