diff options
| author | Ellie Huxtable <ellie@elliehuxtable.com> | 2026-03-16 15:49:54 -0700 |
|---|---|---|
| committer | Ellie Huxtable <ellie@elliehuxtable.com> | 2026-03-16 16:18:41 -0700 |
| commit | 0f67f59e585836145e436310caabb338b12062a7 (patch) | |
| tree | 2f957419d1c84024b25c6525da3ea92897d7ecd4 /crates/atuin-nucleo | |
| parent | feat: Add custom filtering and scoring mechanisms (diff) | |
| download | atuin-0f67f59e585836145e436310caabb338b12062a7.zip | |
vendor nucleo fork into atuin workspace
Rename crates (nucleo → atuin-nucleo, nucleo-matcher → atuin-nucleo-matcher),
add to workspace members and dependencies, update all import paths, remove
vendored CI workflow, and suppress upstream clippy warnings.
format
codespell fixes
clippy clappy
Diffstat (limited to 'crates/atuin-nucleo')
| -rw-r--r-- | crates/atuin-nucleo/.github/workflows/ci.yml | 83 | ||||
| -rw-r--r-- | crates/atuin-nucleo/Cargo.toml | 15 | ||||
| -rw-r--r-- | crates/atuin-nucleo/bench/Cargo.toml | 6 | ||||
| -rw-r--r-- | crates/atuin-nucleo/bench/src/main.rs | 4 | ||||
| -rw-r--r-- | crates/atuin-nucleo/matcher/Cargo.toml | 4 | ||||
| -rw-r--r-- | crates/atuin-nucleo/matcher/fuzz/fuzz_targets/fuzz_target_1.rs | 2 | ||||
| -rw-r--r-- | crates/atuin-nucleo/matcher/src/chars/normalize.rs | 2 | ||||
| -rw-r--r-- | crates/atuin-nucleo/matcher/src/fuzzy_greedy.rs | 2 | ||||
| -rw-r--r-- | crates/atuin-nucleo/matcher/src/fuzzy_optimal.rs | 6 | ||||
| -rw-r--r-- | crates/atuin-nucleo/matcher/src/lib.rs | 18 | ||||
| -rw-r--r-- | crates/atuin-nucleo/matcher/src/tests.rs | 2 | ||||
| -rw-r--r-- | crates/atuin-nucleo/matcher/src/utf32_str.rs | 8 | ||||
| -rw-r--r-- | crates/atuin-nucleo/src/boxcar.rs | 2 | ||||
| -rw-r--r-- | crates/atuin-nucleo/src/lib.rs | 16 | ||||
| -rw-r--r-- | crates/atuin-nucleo/src/pattern.rs | 8 | ||||
| -rw-r--r-- | crates/atuin-nucleo/src/pattern/tests.rs | 2 | ||||
| -rw-r--r-- | crates/atuin-nucleo/src/tests.rs | 2 | ||||
| -rw-r--r-- | crates/atuin-nucleo/src/worker.rs | 12 |
18 files changed, 54 insertions, 140 deletions
diff --git a/crates/atuin-nucleo/.github/workflows/ci.yml b/crates/atuin-nucleo/.github/workflows/ci.yml deleted file mode 100644 index e478b6ae..00000000 --- a/crates/atuin-nucleo/.github/workflows/ci.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: CI -on: - pull_request: - push: - branches: - - master - -jobs: - check-msrv: - name: Check - strategy: - matrix: - toolchain: - - "1.65" - - stable - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Install toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ matrix.toolchain}} - - - uses: Swatinem/rust-cache@v2 - - - name: Run cargo check - run: cargo check - - name: Run cargo check withoult default features - run: cargo check --no-default-features - - test: - name: Test - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Install stable toolchain - uses: dtolnay/rust-toolchain@stable - - - uses: Swatinem/rust-cache@v2 - - - name: Run cargo test - run: cargo test --workspace - - lints: - name: Lints - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Install stable toolchain - uses: dtolnay/rust-toolchain@stable - with: - components: rustfmt, clippy - - - uses: Swatinem/rust-cache@v2 - - - name: Run cargo fmt - run: cargo fmt --all --check - - - name: Run cargo clippy - run: cargo clippy --workspace --all-targets -- -D warnings - - name: Run cargo clippy withoult default features - run: cargo clippy --workspace --all-targets --no-default-features -- -D warnings - - - name: Run cargo doc - run: cargo doc --no-deps --workspace --document-private-items - env: - RUSTDOCFLAGS: -D warnings - - typos: - name: Typos - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Run typos - uses: crate-ci/typos@v1.16.11 diff --git a/crates/atuin-nucleo/Cargo.toml b/crates/atuin-nucleo/Cargo.toml index eb6315fb..cd53e578 100644 --- a/crates/atuin-nucleo/Cargo.toml +++ b/crates/atuin-nucleo/Cargo.toml @@ -1,20 +1,17 @@ [package] -name = "nucleo" -description = "plug and play high performance fuzzy matcher" -authors = ["Pascal Kuthe <pascalkuthe@pm.me>"] -version = "0.5.0" +name = "atuin-nucleo" +description = "A fork of helix-editor/nucleo with filtering and custom scoring for Atuin" +authors = ["Pascal Kuthe <pascalkuthe@pm.me>", "Michelle Tilley <michelle@atuin.sh>"] +version = "0.6.0" edition = "2021" license = "MPL-2.0" -repository = "https://github.com/helix-editor/nucleo" +repository = "https://github.com/atuinsh/atuin" readme = "README.md" exclude = ["/typos.toml", "/tarpaulin.toml"] [lib] [dependencies] -nucleo-matcher = { version = "0.3.1", path = "matcher" } +atuin-nucleo-matcher = { version = "0.3.1", path = "matcher" } parking_lot = { version = "0.12.1", features = ["send_guard", "arc_lock"] } rayon = "1.7.0" - -[workspace] -members = ["matcher", "bench"] diff --git a/crates/atuin-nucleo/bench/Cargo.toml b/crates/atuin-nucleo/bench/Cargo.toml index 0dfb81d5..d71734e1 100644 --- a/crates/atuin-nucleo/bench/Cargo.toml +++ b/crates/atuin-nucleo/bench/Cargo.toml @@ -1,12 +1,10 @@ [package] -name = "benches" +name = "atuin-nucleo-bench" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] -nucleo = { version = "*", path = "../" } +atuin-nucleo = { version = "*", path = "../" } brunch = "0.5.0" fuzzy-matcher = "0.3.7" walkdir = "2" diff --git a/crates/atuin-nucleo/bench/src/main.rs b/crates/atuin-nucleo/bench/src/main.rs index bc77b03d..43e2ed26 100644 --- a/crates/atuin-nucleo/bench/src/main.rs +++ b/crates/atuin-nucleo/bench/src/main.rs @@ -2,9 +2,9 @@ use std::hint::black_box; use std::path::PathBuf; use std::process::Command; +use atuin_nucleo::{Utf32Str, Utf32String}; use brunch::{Bench, Benches}; use fuzzy_matcher::FuzzyMatcher; -use nucleo::{Utf32Str, Utf32String}; fn bench_dir() -> PathBuf { std::env::var_os("BENCHMARK_DIR") @@ -43,7 +43,7 @@ fn main() { Some((path.as_str().into(), path)) }) .unzip(); - let mut nucleo = nucleo::Matcher::new(nucleo::Config::DEFAULT.match_paths()); + let mut nucleo = atuin_nucleo::Matcher::new(atuin_nucleo::Config::DEFAULT.match_paths()); let skim = fuzzy_matcher::skim::SkimMatcherV2::default(); // TODO: unicode? diff --git a/crates/atuin-nucleo/matcher/Cargo.toml b/crates/atuin-nucleo/matcher/Cargo.toml index 4b90ddbb..feb10310 100644 --- a/crates/atuin-nucleo/matcher/Cargo.toml +++ b/crates/atuin-nucleo/matcher/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "nucleo-matcher" +name = "atuin-nucleo-matcher" description = "plug and play high performance fuzzy matcher" authors = ["Pascal Kuthe <pascalkuthe@pm.me>"] version = "0.3.1" edition = "2021" license = "MPL-2.0" -repository = "https://github.com/helix-editor/nucleo" +repository = "https://github.com/atuinsh/atuin" readme = "../README.md" [dependencies] diff --git a/crates/atuin-nucleo/matcher/fuzz/fuzz_targets/fuzz_target_1.rs b/crates/atuin-nucleo/matcher/fuzz/fuzz_targets/fuzz_target_1.rs index d9df7d36..00940d58 100644 --- a/crates/atuin-nucleo/matcher/fuzz/fuzz_targets/fuzz_target_1.rs +++ b/crates/atuin-nucleo/matcher/fuzz/fuzz_targets/fuzz_target_1.rs @@ -64,7 +64,7 @@ fuzz_target!(|data: Input<'_>| { (Some(greedy), Some(optimal)) => { assert!( greedy <= optimal, - "optimal score must be atleast the same as greedy score {greedy} {optimal}" + "optimal score must be at least the same as greedy score {greedy} {optimal}" ); if indices_greedy == indices_optimal { assert_eq!( diff --git a/crates/atuin-nucleo/matcher/src/chars/normalize.rs b/crates/atuin-nucleo/matcher/src/chars/normalize.rs index 3de501aa..7e3b3b17 100644 --- a/crates/atuin-nucleo/matcher/src/chars/normalize.rs +++ b/crates/atuin-nucleo/matcher/src/chars/normalize.rs @@ -19,7 +19,7 @@ /// /// # Example /// ``` -/// # use nucleo_matcher::chars::normalize; +/// # use atuin_nucleo_matcher::chars::normalize; /// assert_eq!(normalize('ä'), 'a'); /// assert_eq!(normalize('Æ'), 'Æ'); /// assert_eq!(normalize('ữ'), 'u'); diff --git a/crates/atuin-nucleo/matcher/src/fuzzy_greedy.rs b/crates/atuin-nucleo/matcher/src/fuzzy_greedy.rs index 8215bf31..386d289c 100644 --- a/crates/atuin-nucleo/matcher/src/fuzzy_greedy.rs +++ b/crates/atuin-nucleo/matcher/src/fuzzy_greedy.rs @@ -2,7 +2,7 @@ use crate::chars::Char; use crate::Matcher; impl Matcher { - /// greedy fallback algorithm, much faster (linear time) but reported scores/indicies + /// greedy fallback algorithm, much faster (linear time) but reported scores/indices /// might not be the best match pub(crate) fn fuzzy_match_greedy_<const INDICES: bool, H: Char + PartialEq<N>, N: Char>( &mut self, diff --git a/crates/atuin-nucleo/matcher/src/fuzzy_optimal.rs b/crates/atuin-nucleo/matcher/src/fuzzy_optimal.rs index 5d53ecfb..1bcebe2c 100644 --- a/crates/atuin-nucleo/matcher/src/fuzzy_optimal.rs +++ b/crates/atuin-nucleo/matcher/src/fuzzy_optimal.rs @@ -49,7 +49,7 @@ impl Matcher { .iter() .enumerate() .max_by_key(|(_, cell)| cell.score) - .expect("there must be atleast one match"); + .expect("there must be at least one match"); if INDICES { matrix.reconstruct_optimal_path(match_end as u16, indices, matrix_len, start as u32); } @@ -60,7 +60,7 @@ impl Matcher { const UNMATCHED: ScoreCell = ScoreCell { score: 0, // if matched is true then the consecutive bonus - // is always atleast BONUS_CONSECUTIVE so + // is always at least BONUS_CONSECUTIVE so // this constant can never occur naturally consecutive_bonus: 0, matched: true, @@ -145,7 +145,7 @@ impl<H: Char> MatcherDataView<'_, H> { (needle_char, row_start) = next; } else if !matched { *row_start = i; - // we have atleast one match + // we have at least one match matched = true; } } diff --git a/crates/atuin-nucleo/matcher/src/lib.rs b/crates/atuin-nucleo/matcher/src/lib.rs index 3e8874c5..9ae4b665 100644 --- a/crates/atuin-nucleo/matcher/src/lib.rs +++ b/crates/atuin-nucleo/matcher/src/lib.rs @@ -1,5 +1,7 @@ +#![allow(clippy::needless_return, mismatched_lifetime_syntaxes)] + /*! -`nucleo_matcher` is a low level crate that contains the matcher implementation +`atuin_nucleo_matcher` is a low level crate that contains the matcher implementation used by the high level `nucleo` crate. **NOTE**: If you are building an fzf-like interactive fuzzy finder that is @@ -20,8 +22,8 @@ can contain special characters to control what kind of match is performed (see [`AtomKind`](crate::pattern::AtomKind)). ``` -# use nucleo_matcher::{Matcher, Config}; -# use nucleo_matcher::pattern::{Pattern, Normalization, CaseMatching}; +# use atuin_nucleo_matcher::{Matcher, Config}; +# use atuin_nucleo_matcher::pattern::{Pattern, Normalization, CaseMatching}; let paths = ["foo/bar", "bar/foo", "foobar"]; let mut matcher = Matcher::new(Config::DEFAULT.match_paths()); let matches = Pattern::parse("foo bar", CaseMatching::Ignore, Normalization::Smart).match_list(paths, &mut matcher); @@ -34,8 +36,8 @@ If the pattern should be matched literally (without this special parsing) [`Pattern::new`](pattern::Pattern::new) can be used instead. ``` -# use nucleo_matcher::{Matcher, Config}; -# use nucleo_matcher::pattern::{Pattern, CaseMatching, AtomKind, Normalization}; +# use atuin_nucleo_matcher::{Matcher, Config}; +# use atuin_nucleo_matcher::pattern::{Pattern, CaseMatching, AtomKind, Normalization}; let paths = ["foo/bar", "bar/foo", "foobar"]; let mut matcher = Matcher::new(Config::DEFAULT.match_paths()); let matches = Pattern::new("foo bar", CaseMatching::Ignore, Normalization::Smart, AtomKind::Fuzzy).match_list(paths, &mut matcher); @@ -49,7 +51,7 @@ Word segmentation is performed automatically on any unescaped character for whic This is relevant, for instance, with non-english keyboard input. ``` -# use nucleo_matcher::pattern::{Atom, Pattern, Normalization, CaseMatching}; +# use atuin_nucleo_matcher::pattern::{Atom, Pattern, Normalization, CaseMatching}; assert_eq!( // double-width 'Ideographic Space', i.e. `'\u{3000}'` Pattern::parse("ほげ ふが", CaseMatching::Smart, Normalization::Smart).atoms, @@ -63,8 +65,8 @@ assert_eq!( If word segmentation is also not desired, a single `Atom` can be constructed directly. ``` -# use nucleo_matcher::{Matcher, Config}; -# use nucleo_matcher::pattern::{Pattern, Atom, CaseMatching, Normalization, AtomKind}; +# use atuin_nucleo_matcher::{Matcher, Config}; +# use atuin_nucleo_matcher::pattern::{Pattern, Atom, CaseMatching, Normalization, AtomKind}; let paths = ["foobar", "foo bar"]; let mut matcher = Matcher::new(Config::DEFAULT); let matches = Atom::new("foo bar", CaseMatching::Ignore, Normalization::Smart, AtomKind::Fuzzy, false).match_list(paths, &mut matcher); diff --git a/crates/atuin-nucleo/matcher/src/tests.rs b/crates/atuin-nucleo/matcher/src/tests.rs index 32a02403..a883c6ba 100644 --- a/crates/atuin-nucleo/matcher/src/tests.rs +++ b/crates/atuin-nucleo/matcher/src/tests.rs @@ -631,7 +631,7 @@ fn test_optimal() { + BONUS_NON_WORD, ), // this case is a cool example of why our algorithm is more than fzf - // we handle this corretly detect that it's better to match + // we handle this correctly detect that it's better to match // the second f instead of the third yielding a higher score // (despite using the same scoring function!) ( diff --git a/crates/atuin-nucleo/matcher/src/utf32_str.rs b/crates/atuin-nucleo/matcher/src/utf32_str.rs index 664dae7a..77bd9d51 100644 --- a/crates/atuin-nucleo/matcher/src/utf32_str.rs +++ b/crates/atuin-nucleo/matcher/src/utf32_str.rs @@ -45,14 +45,14 @@ fn has_ascii_graphemes(string: &str) -> bool { /// In the presence of a multi-codepoint grapheme (e.g. `"u\u{0308}"` which is `u + /// COMBINING_DIAERESIS`), the trailing codepoints are truncated. /// ``` -/// # use nucleo_matcher::Utf32String; +/// # use atuin_nucleo_matcher::Utf32String; /// assert_eq!(Utf32String::from("u\u{0308}").to_string(), "u"); /// ``` /// /// ### Indexing is done by grapheme /// Indexing into a string is done by grapheme rather than by codepoint. /// ``` -/// # use nucleo_matcher::Utf32String; +/// # use atuin_nucleo_matcher::Utf32String; /// assert!(Utf32String::from("au\u{0308}").len() == 2); /// ``` /// @@ -60,7 +60,7 @@ fn has_ascii_graphemes(string: &str) -> bool { /// Since the windows-style newline `\r\n` is ASCII only but considered to be a single grapheme, /// strings containing `\r\n` will still result in a `Unicode` variant. /// ``` -/// # use nucleo_matcher::Utf32String; +/// # use atuin_nucleo_matcher::Utf32String; /// let s = Utf32String::from("\r\n"); /// assert!(!s.slice(..).is_ascii()); /// assert!(s.len() == 1); @@ -73,7 +73,7 @@ fn has_ascii_graphemes(string: &str) -> bool { /// much hassle to deal with), we want to quickly iterate over codepoints (up to 5 /// times) during matching. /// -/// Doing codepoint segmentation on the fly not only blows trough the cache +/// Doing codepoint segmentation on the fly not only blows through the cache /// (lookup tables and I-cache) but also has nontrivial runtime compared to the /// matching itself. Furthermore there are many extra optimizations available /// for ASCII only text, but checking each match has too much overhead. diff --git a/crates/atuin-nucleo/src/boxcar.rs b/crates/atuin-nucleo/src/boxcar.rs index 9b48809d..726f4dff 100644 --- a/crates/atuin-nucleo/src/boxcar.rs +++ b/crates/atuin-nucleo/src/boxcar.rs @@ -51,7 +51,7 @@ pub(crate) struct Vec<T> { impl<T> Vec<T> { /// Constructs a new, empty `Vec<T>` with the specified capacity and matcher columns. pub fn with_capacity(capacity: u32, columns: u32) -> Vec<T> { - assert_ne!(columns, 0, "there must be atleast one matcher column"); + assert_ne!(columns, 0, "there must be at least one matcher column"); let init = match capacity { 0 => 0, // initialize enough buckets for `capacity` elements diff --git a/crates/atuin-nucleo/src/lib.rs b/crates/atuin-nucleo/src/lib.rs index 5a500481..efc7628c 100644 --- a/crates/atuin-nucleo/src/lib.rs +++ b/crates/atuin-nucleo/src/lib.rs @@ -16,7 +16,7 @@ The [`Nucleo`] struct serves as the main API entrypoint for this crate. Nucleo is used in the helix-editor and therefore has a large user base with lots or real world testing. The core matcher implementation is considered complete -and is unlikely to see major changes. The `nucleo-matcher` crate is finished and +and is unlikely to see major changes. The `atuin-nucleo-matcher` crate is finished and ready for widespread use, breaking changes should be very rare (a 1.0 release should not be far away). @@ -45,7 +45,7 @@ use rayon::ThreadPool; use crate::pattern::MultiPattern; use crate::worker::Worker; -pub use nucleo_matcher::{chars, Config, Matcher, Utf32Str, Utf32String}; +pub use atuin_nucleo_matcher::{chars, Config, Matcher, Utf32Str, Utf32String}; mod boxcar; mod par_sort; @@ -67,7 +67,7 @@ pub struct Item<'a, T> { /// and sent across threads. pub struct Injector<T> { items: Arc<boxcar::Vec<T>>, - notify: Arc<(dyn Fn() + Sync + Send)>, + notify: Arc<dyn Fn() + Sync + Send>, } impl<T> Clone for Injector<T> { @@ -93,10 +93,10 @@ impl<T> Injector<T> { /// /// You should favor this function over `push` if at least one of the following is true: /// - the number of items you're adding can be computed beforehand and is typically larger - /// than 1k + /// than 1k /// - you're able to batch incoming items /// - you're adding items from multiple threads concurrently (this function results in less - /// contention) + /// contention) pub fn extend<I>(&self, values: I, fill_columns: impl Fn(&T, &mut [Utf32String])) where I: IntoIterator<Item = T> + ExactSizeIterator, @@ -298,7 +298,7 @@ pub struct Nucleo<T: Sync + Send + 'static> { pool: ThreadPool, state: State, items: Arc<boxcar::Vec<T>>, - notify: Arc<(dyn Fn() + Sync + Send)>, + notify: Arc<dyn Fn() + Sync + Send>, snapshot: Snapshot<T>, /// The pattern matched by this matcher. To update the match pattern /// [`MultiPattern::reparse`](`pattern::MultiPattern::reparse`) should be used. @@ -316,7 +316,7 @@ pub struct Nucleo<T: Sync + Send + 'static> { impl<T: Sync + Send + 'static> Nucleo<T> { /// Constructs a new `nucleo` worker threadpool with the provided `config`. /// - /// `notify` is called everytime new information is available and + /// `notify` is called every time new information is available and /// [`tick`](Nucleo::tick) should be called. Note that `notify` is not /// debounced, that should be handled by the downstream crate (for example /// debouncing to only redraw at most every 1/60 seconds). @@ -329,7 +329,7 @@ impl<T: Sync + Send + 'static> Nucleo<T> { /// number of columns cannot be changed after construction. pub fn new( config: Config, - notify: Arc<(dyn Fn() + Sync + Send)>, + notify: Arc<dyn Fn() + Sync + Send>, num_threads: Option<usize>, columns: u32, ) -> Self { diff --git a/crates/atuin-nucleo/src/pattern.rs b/crates/atuin-nucleo/src/pattern.rs index 816b0a31..a9663274 100644 --- a/crates/atuin-nucleo/src/pattern.rs +++ b/crates/atuin-nucleo/src/pattern.rs @@ -1,5 +1,5 @@ -pub use nucleo_matcher::pattern::{Atom, AtomKind, CaseMatching, Normalization, Pattern}; -use nucleo_matcher::{Matcher, Utf32String}; +pub use atuin_nucleo_matcher::pattern::{Atom, AtomKind, CaseMatching, Normalization, Pattern}; +use atuin_nucleo_matcher::{Matcher, Utf32String}; #[cfg(test)] mod tests; @@ -56,7 +56,7 @@ impl MultiPattern { .0 .atoms .last() - .map_or(true, |last| !last.negative) + .is_none_or(|last| !last.negative) { self.cols[column].1 = Status::Update; } else { @@ -86,7 +86,7 @@ impl MultiPattern { } pub fn score(&self, haystack: &[Utf32String], matcher: &mut Matcher) -> Option<u32> { - // TODO: wheight columns? + // TODO: weight columns? let mut score = 0; for ((pattern, _), haystack) in self.cols.iter().zip(haystack) { score += pattern.score(haystack.slice(..), matcher)? diff --git a/crates/atuin-nucleo/src/pattern/tests.rs b/crates/atuin-nucleo/src/pattern/tests.rs index 40e8e328..59ed13f0 100644 --- a/crates/atuin-nucleo/src/pattern/tests.rs +++ b/crates/atuin-nucleo/src/pattern/tests.rs @@ -1,4 +1,4 @@ -use nucleo_matcher::pattern::{CaseMatching, Normalization}; +use atuin_nucleo_matcher::pattern::{CaseMatching, Normalization}; use crate::pattern::{MultiPattern, Status}; diff --git a/crates/atuin-nucleo/src/tests.rs b/crates/atuin-nucleo/src/tests.rs index 96c4d99c..1052264a 100644 --- a/crates/atuin-nucleo/src/tests.rs +++ b/crates/atuin-nucleo/src/tests.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use nucleo_matcher::Config; +use atuin_nucleo_matcher::Config; use crate::{pattern, Nucleo}; diff --git a/crates/atuin-nucleo/src/worker.rs b/crates/atuin-nucleo/src/worker.rs index ddd546ad..45e27cee 100644 --- a/crates/atuin-nucleo/src/worker.rs +++ b/crates/atuin-nucleo/src/worker.rs @@ -3,7 +3,7 @@ use std::mem::take; use std::sync::atomic::{self, AtomicBool, AtomicU32}; use std::sync::Arc; -use nucleo_matcher::Config; +use atuin_nucleo_matcher::Config; use parking_lot::Mutex; use rayon::{prelude::*, ThreadPool}; @@ -11,12 +11,12 @@ use crate::par_sort::par_quicksort; use crate::pattern::{self, MultiPattern}; use crate::{boxcar, Filter, Match, Scorer}; -struct Matchers(Box<[UnsafeCell<nucleo_matcher::Matcher>]>); +struct Matchers(Box<[UnsafeCell<atuin_nucleo_matcher::Matcher>]>); impl Matchers { // this is not a true mut from ref, we use a cell here #[allow(clippy::mut_from_ref)] - unsafe fn get(&self) -> &mut nucleo_matcher::Matcher { + unsafe fn get(&self) -> &mut atuin_nucleo_matcher::Matcher { &mut *self.0[rayon::current_thread_index().unwrap()].get() } } @@ -35,7 +35,7 @@ pub(crate) struct Worker<T: Sync + Send + 'static> { pub(crate) should_notify: Arc<AtomicBool>, pub(crate) was_canceled: bool, pub(crate) last_snapshot: u32, - notify: Arc<(dyn Fn() + Sync + Send)>, + notify: Arc<dyn Fn() + Sync + Send>, pub(crate) items: Arc<boxcar::Vec<T>>, in_flight: Vec<u32>, pub(crate) filter: Option<Filter<T>>, @@ -69,7 +69,7 @@ impl<T: Sync + Send + 'static> Worker<T> { pub(crate) fn new( worker_threads: Option<usize>, config: Config, - notify: Arc<(dyn Fn() + Sync + Send)>, + notify: Arc<dyn Fn() + Sync + Send>, cols: u32, ) -> (ThreadPool, Self) { let worker_threads = worker_threads @@ -80,7 +80,7 @@ impl<T: Sync + Send + 'static> Worker<T> { .build() .expect("creating threadpool failed"); let matchers = (0..worker_threads) - .map(|_| UnsafeCell::new(nucleo_matcher::Matcher::new(config.clone()))) + .map(|_| UnsafeCell::new(atuin_nucleo_matcher::Matcher::new(config.clone()))) .collect(); let worker = Worker { running: false, |
