aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-nucleo/src
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@elliehuxtable.com>2026-03-16 15:49:54 -0700
committerEllie Huxtable <ellie@elliehuxtable.com>2026-03-16 16:18:41 -0700
commit0f67f59e585836145e436310caabb338b12062a7 (patch)
tree2f957419d1c84024b25c6525da3ea92897d7ecd4 /crates/atuin-nucleo/src
parentfeat: Add custom filtering and scoring mechanisms (diff)
downloadatuin-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/src')
-rw-r--r--crates/atuin-nucleo/src/boxcar.rs2
-rw-r--r--crates/atuin-nucleo/src/lib.rs16
-rw-r--r--crates/atuin-nucleo/src/pattern.rs8
-rw-r--r--crates/atuin-nucleo/src/pattern/tests.rs2
-rw-r--r--crates/atuin-nucleo/src/tests.rs2
-rw-r--r--crates/atuin-nucleo/src/worker.rs12
6 files changed, 21 insertions, 21 deletions
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,