diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-13 00:58:32 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-13 00:58:32 +0200 |
| commit | 9352a0f7cfdd5f5fc102a25d8a93218bc3dbe462 (patch) | |
| tree | b998430c307c10defb79d91abe5d30471c5c4f12 /crates/turtle/src/atuin_daemon/search/mod.rs | |
| parent | chore(treewide): Remove `cargo` warnings to 0 (diff) | |
| download | atuin-9352a0f7cfdd5f5fc102a25d8a93218bc3dbe462.zip | |
chore(treewide): Fix some of `clippy`'s error
Just a run of `cargo clippy --fix`
Diffstat (limited to 'crates/turtle/src/atuin_daemon/search/mod.rs')
| -rw-r--r-- | crates/turtle/src/atuin_daemon/search/mod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/turtle/src/atuin_daemon/search/mod.rs b/crates/turtle/src/atuin_daemon/search/mod.rs index 60d923cd..04beb459 100644 --- a/crates/turtle/src/atuin_daemon/search/mod.rs +++ b/crates/turtle/src/atuin_daemon/search/mod.rs @@ -93,7 +93,7 @@ impl FrecencyData { let frequency_score = (f64::from(self.count).ln() * 20.0).min(100.0); // Apply multipliers and combine scores, then round to u32 - ((recency_score * recency_mul) + (frequency_score * frequency_mul)).round() as u32 + recency_score.mul_add(recency_mul, frequency_score * frequency_mul).round() as u32 } } @@ -261,8 +261,8 @@ type FrecencyMap = Arc<HashMap<Arc<str>, u32>>; /// although this should never happen due to precomputing the frecency map. pub(crate) struct SearchIndex { /// Map from command text to command data. - /// Using DashMap for concurrent read/write access, wrapped in Arc for sharing with scorer. - /// Keys are Arc<str> to enable zero-copy sharing with frecency_map. + /// Using `DashMap` for concurrent read/write access, wrapped in Arc for sharing with scorer. + /// Keys are Arc<str> to enable zero-copy sharing with `frecency_map`. commands: Arc<DashMap<Arc<str>, CommandData>>, /// Nucleo fuzzy matcher - items are command strings. nucleo: RwLock<Nucleo<String>>, @@ -416,7 +416,7 @@ impl SearchIndex { .global_frecency .compute(now, recency_mul, frequency_mul); // Apply overall frecency multiplier and round to u32 - let frecency = (frecency as f64 * frecency_mul).round() as u32; + let frecency = (f64::from(frecency) * frecency_mul).round() as u32; // Arc::clone is cheap - just increments reference count frecency_map.insert(Arc::clone(entry.key()), frecency); } |
