From 0f67f59e585836145e436310caabb338b12062a7 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Mon, 16 Mar 2026 15:49:54 -0700 Subject: vendor nucleo fork into atuin workspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- crates/atuin-nucleo/matcher/src/chars/normalize.rs | 2 +- crates/atuin-nucleo/matcher/src/fuzzy_greedy.rs | 2 +- crates/atuin-nucleo/matcher/src/fuzzy_optimal.rs | 6 +++--- crates/atuin-nucleo/matcher/src/lib.rs | 18 ++++++++++-------- crates/atuin-nucleo/matcher/src/tests.rs | 2 +- crates/atuin-nucleo/matcher/src/utf32_str.rs | 8 ++++---- 6 files changed, 20 insertions(+), 18 deletions(-) (limited to 'crates/atuin-nucleo/matcher/src') 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_, 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 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. -- cgit v1.3.1