feat: Migrate to stable rust (#300)

This commit is contained in:
Dmitriy Kovalenko
2026-03-18 15:56:40 -07:00
committed by GitHub
parent 2b6ace888d
commit e64d2e2a55
8 changed files with 22 additions and 36 deletions
Generated
-1
View File
@@ -666,7 +666,6 @@ name = "fff-query-parser"
version = "0.2.4" version = "0.2.4"
dependencies = [ dependencies = [
"criterion", "criterion",
"smallvec",
"zlob", "zlob",
] ]
+1 -5
View File
@@ -43,11 +43,7 @@ parking_lot = "0.12"
pathdiff = "0.2.1" pathdiff = "0.2.1"
rayon = "1.8.0" rayon = "1.8.0"
regex = "1.11" regex = "1.11"
smallvec = { version = "1.13", features = [ smallvec = { version = "1.13", features = ["const_generics", "union"] }
"const_generics",
"union",
"may_dangle",
] }
thiserror = "2.0.10" thiserror = "2.0.10"
tracing = "0.1" tracing = "0.1"
-1
View File
@@ -14,7 +14,6 @@ default = []
zlob = ["dep:zlob"] zlob = ["dep:zlob"]
[dependencies] [dependencies]
smallvec = { workspace = true }
zlob = { workspace = true, optional = true } zlob = { workspace = true, optional = true }
[dev-dependencies] [dev-dependencies]
+2 -4
View File
@@ -1,5 +1,3 @@
use smallvec::SmallVec;
/// Constraint types that can be extracted from a query /// Constraint types that can be extracted from a query
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub enum Constraint<'a> { pub enum Constraint<'a> {
@@ -45,5 +43,5 @@ pub enum GitStatusFilter {
Unmodified, Unmodified,
} }
/// Stack-allocated buffer for text parts (up to 16 parts without heap allocation) /// Buffer for text parts during query parsing.
pub(crate) type TextPartsBuffer<'a> = SmallVec<[&'a str; 16]>; pub(crate) type TextPartsBuffer<'a> = Vec<&'a str>;
+4 -9
View File
@@ -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 //! This parser takes a search query and extracts structured constraints
//! while preserving text for fuzzy matching. Designed for maximum performance: //! while preserving text for fuzzy matching. Designed for maximum performance:
//! - Zero allocations for queries with ≤8 constraints (SmallVec)
//! - Single-pass parsing with minimal branching //! - Single-pass parsing with minimal branching
//! - Stack-allocated string buffers //! - Stack-allocated string buffers
//! //!
@@ -51,10 +50,7 @@ pub use constraints::{Constraint, GitStatusFilter};
pub use location::Location; pub use location::Location;
pub use parser::{FFFQuery, FuzzyQuery, QueryParser}; pub use parser::{FFFQuery, FuzzyQuery, QueryParser};
// Re-export SmallVec for convenience pub type ConstraintVec<'a> = Vec<Constraint<'a>>;
pub use smallvec::SmallVec;
pub type ConstraintVec<'a> = SmallVec<[Constraint<'a>; 8]>;
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
@@ -212,11 +208,10 @@ mod tests {
} }
#[test] #[test]
fn test_no_heap_allocation_for_small_queries() { fn test_small_constraint_count() {
let parser = QueryParser::default(); let parser = QueryParser::default();
let result = parser.parse("*.rs *.toml !test"); let result = parser.parse("*.rs *.toml !test");
// SmallVec should not have spilled to heap assert_eq!(result.constraints.len(), 3);
assert!(!result.constraints.spilled());
} }
#[test] #[test]
+1 -1
View File
@@ -1105,7 +1105,7 @@ mod tests {
)); ));
assert_eq!( assert_eq!(
result.fuzzy_query, result.fuzzy_query,
FuzzyQuery::Parts(smallvec::smallvec!["src", "components"]) FuzzyQuery::Parts(vec!["src", "components"])
); );
} }
Generated
+9 -9
View File
@@ -2,11 +2,11 @@
"nodes": { "nodes": {
"crane": { "crane": {
"locked": { "locked": {
"lastModified": 1773189535, "lastModified": 1773857772,
"narHash": "sha256-E1G/Or6MWeP+L6mpQ0iTFLpzSzlpGrITfU2220Gq47g=", "narHash": "sha256-5xsK26KRHf0WytBtsBnQYC/lTWDhQuT57HJ7SzuqZcM=",
"owner": "ipetkov", "owner": "ipetkov",
"repo": "crane", "repo": "crane",
"rev": "6fa2fb4cf4a89ba49fc9dd5a3eb6cde99d388269", "rev": "b556d7bbae5ff86e378451511873dfd07e4504cd",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -35,11 +35,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1773597492, "lastModified": 1773628058,
"narHash": "sha256-hQ284SkIeNaeyud+LS0WVLX+WL2rxcVZLFEaK0e03zg=", "narHash": "sha256-hpXH0z3K9xv0fHaje136KY872VT2T5uwxtezlAskQgY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a07d4ce6bee67d7c838a8a5796e75dff9caa21ef", "rev": "f8573b9c935cfaa162dd62cc9e75ae2db86f85df",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -64,11 +64,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1773716879, "lastModified": 1773803479,
"narHash": "sha256-vXCTasEzzTTd0ZGEuyle20H2hjRom66JeNr7i2ktHD0=", "narHash": "sha256-GD6i1F2vrSxbsmbS92+8+x3DbHOJ+yrS78Pm4xigW4M=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "1a9ddeb45c5751b800331363703641b84d1f41f0", "rev": "f17186f52e82ec5cf40920b58eac63b78692ac7c",
"type": "github" "type": "github"
}, },
"original": { "original": {
+5 -6
View File
@@ -1,10 +1,9 @@
[toolchain] [toolchain]
channel = "nightly-2026-03-14" channel = "stable"
components = [ components = [
"clippy-preview", "clippy",
"rustfmt-preview", "rustfmt",
"llvm-tools-preview", "llvm-tools",
"miri",
"rust-src", "rust-src",
"rust-analyzer-preview", "rust-analyzer",
] ]