From f4544d261e56941a2bc3e2dc94e68838bbf911fe Mon Sep 17 00:00:00 2001 From: elipeter Date: Tue, 24 Jun 2025 18:06:02 +0200 Subject: [PATCH] Fixed clippy errors --- src/utils/query_cache.rs | 13 ++++++------- src/walk.rs | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/utils/query_cache.rs b/src/utils/query_cache.rs index 5e827914..78f22332 100644 --- a/src/utils/query_cache.rs +++ b/src/utils/query_cache.rs @@ -1,7 +1,5 @@ use std::collections::HashMap; -use std::sync::RwLock; - -use once_cell::sync::Lazy; +use std::sync::{Arc, LazyLock, RwLock}; use tree_sitter::{Language, Query}; use crate::patterns::{self, Pattern}; @@ -9,11 +7,12 @@ use crate::patterns::{self, Pattern}; #[derive(Clone)] pub struct CompiledQuery { pub meta: Pattern, - pub query: std::sync::Arc, + pub query: Arc, } -static CACHE: Lazy>>>> = - Lazy::new(|| RwLock::new(HashMap::new())); +type QuerySet = Arc>; +static CACHE: LazyLock>> = + LazyLock::new(|| RwLock::new(HashMap::new())); /// Return **one shared Arc** to the per-language query set. /// Cloning the `Arc` is O(1) and the underlying Vec lives for the @@ -37,7 +36,7 @@ pub fn for_lang(lang: &'static str, ts_lang: Language) -> std::sync::Arc Receiver { let root = root.to_path_buf(); let scan_hidden = cfg.scanner.scan_hidden_files; let follow = cfg.scanner.follow_symlinks; - let max_bytes = cfg.scanner.max_file_size_mb.unwrap_or(0) as u64 * 1_048_576; + let max_bytes = cfg.scanner.max_file_size_mb.unwrap_or(0) * 1_048_576; // ----- 3 the background walker thread --------------------------------- thread::spawn(move || { @@ -94,7 +94,7 @@ pub fn spawn_senders(root: &Path, cfg: &Config) -> Receiver { _ => {} } } - + tracing::debug!("sending {:?}", entry); b.push(entry.into_path()); WalkState::Continue