diff --git a/Cargo.lock b/Cargo.lock index 60513a8..9411c7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -666,7 +666,6 @@ name = "fff-query-parser" version = "0.2.4" dependencies = [ "criterion", - "smallvec", "zlob", ] diff --git a/Cargo.toml b/Cargo.toml index 140ada2..7f7f78c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,11 +43,7 @@ parking_lot = "0.12" pathdiff = "0.2.1" rayon = "1.8.0" regex = "1.11" -smallvec = { version = "1.13", features = [ - "const_generics", - "union", - "may_dangle", -] } +smallvec = { version = "1.13", features = ["const_generics", "union"] } thiserror = "2.0.10" tracing = "0.1" diff --git a/crates/fff-query-parser/Cargo.toml b/crates/fff-query-parser/Cargo.toml index 131a60b..5acd8a7 100644 --- a/crates/fff-query-parser/Cargo.toml +++ b/crates/fff-query-parser/Cargo.toml @@ -14,7 +14,6 @@ default = [] zlob = ["dep:zlob"] [dependencies] -smallvec = { workspace = true } zlob = { workspace = true, optional = true } [dev-dependencies] diff --git a/crates/fff-query-parser/src/constraints.rs b/crates/fff-query-parser/src/constraints.rs index ea53a5c..a116143 100644 --- a/crates/fff-query-parser/src/constraints.rs +++ b/crates/fff-query-parser/src/constraints.rs @@ -1,5 +1,3 @@ -use smallvec::SmallVec; - /// Constraint types that can be extracted from a query #[derive(Debug, Clone, PartialEq, Eq)] pub enum Constraint<'a> { @@ -45,5 +43,5 @@ pub enum GitStatusFilter { Unmodified, } -/// Stack-allocated buffer for text parts (up to 16 parts without heap allocation) -pub(crate) type TextPartsBuffer<'a> = SmallVec<[&'a str; 16]>; +/// Buffer for text parts during query parsing. +pub(crate) type TextPartsBuffer<'a> = Vec<&'a str>; diff --git a/crates/fff-query-parser/src/lib.rs b/crates/fff-query-parser/src/lib.rs index b3d000b..eabc956 100644 --- a/crates/fff-query-parser/src/lib.rs +++ b/crates/fff-query-parser/src/lib.rs @@ -1,8 +1,7 @@ -//! Fast, zero-allocation query parser for file search +//! Fast query parser for file search //! //! This parser takes a search query and extracts structured constraints //! while preserving text for fuzzy matching. Designed for maximum performance: -//! - Zero allocations for queries with ≤8 constraints (SmallVec) //! - Single-pass parsing with minimal branching //! - Stack-allocated string buffers //! @@ -51,10 +50,7 @@ pub use constraints::{Constraint, GitStatusFilter}; pub use location::Location; pub use parser::{FFFQuery, FuzzyQuery, QueryParser}; -// Re-export SmallVec for convenience -pub use smallvec::SmallVec; - -pub type ConstraintVec<'a> = SmallVec<[Constraint<'a>; 8]>; +pub type ConstraintVec<'a> = Vec>; #[cfg(test)] mod tests { @@ -212,11 +208,10 @@ mod tests { } #[test] - fn test_no_heap_allocation_for_small_queries() { + fn test_small_constraint_count() { let parser = QueryParser::default(); let result = parser.parse("*.rs *.toml !test"); - // SmallVec should not have spilled to heap - assert!(!result.constraints.spilled()); + assert_eq!(result.constraints.len(), 3); } #[test] diff --git a/crates/fff-query-parser/src/parser.rs b/crates/fff-query-parser/src/parser.rs index c3c9b6f..743784e 100644 --- a/crates/fff-query-parser/src/parser.rs +++ b/crates/fff-query-parser/src/parser.rs @@ -1105,7 +1105,7 @@ mod tests { )); assert_eq!( result.fuzzy_query, - FuzzyQuery::Parts(smallvec::smallvec!["src", "components"]) + FuzzyQuery::Parts(vec!["src", "components"]) ); } diff --git a/flake.lock b/flake.lock index 9d67273..d784474 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "crane": { "locked": { - "lastModified": 1773189535, - "narHash": "sha256-E1G/Or6MWeP+L6mpQ0iTFLpzSzlpGrITfU2220Gq47g=", + "lastModified": 1773857772, + "narHash": "sha256-5xsK26KRHf0WytBtsBnQYC/lTWDhQuT57HJ7SzuqZcM=", "owner": "ipetkov", "repo": "crane", - "rev": "6fa2fb4cf4a89ba49fc9dd5a3eb6cde99d388269", + "rev": "b556d7bbae5ff86e378451511873dfd07e4504cd", "type": "github" }, "original": { @@ -35,11 +35,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1773597492, - "narHash": "sha256-hQ284SkIeNaeyud+LS0WVLX+WL2rxcVZLFEaK0e03zg=", + "lastModified": 1773628058, + "narHash": "sha256-hpXH0z3K9xv0fHaje136KY872VT2T5uwxtezlAskQgY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a07d4ce6bee67d7c838a8a5796e75dff9caa21ef", + "rev": "f8573b9c935cfaa162dd62cc9e75ae2db86f85df", "type": "github" }, "original": { @@ -64,11 +64,11 @@ ] }, "locked": { - "lastModified": 1773716879, - "narHash": "sha256-vXCTasEzzTTd0ZGEuyle20H2hjRom66JeNr7i2ktHD0=", + "lastModified": 1773803479, + "narHash": "sha256-GD6i1F2vrSxbsmbS92+8+x3DbHOJ+yrS78Pm4xigW4M=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "1a9ddeb45c5751b800331363703641b84d1f41f0", + "rev": "f17186f52e82ec5cf40920b58eac63b78692ac7c", "type": "github" }, "original": { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 8bd63ce..050b239 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,10 +1,9 @@ [toolchain] -channel = "nightly-2026-03-14" +channel = "stable" components = [ - "clippy-preview", - "rustfmt-preview", - "llvm-tools-preview", - "miri", + "clippy", + "rustfmt", + "llvm-tools", "rust-src", - "rust-analyzer-preview", + "rust-analyzer", ]