From 82ddbe1e5e5510117de02a8ab175668937c8979d Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Thu, 12 Feb 2026 11:52:55 +0000 Subject: [PATCH 1/6] Fix rustfmt.toml --- rustfmt.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rustfmt.toml b/rustfmt.toml index c9460f60..6ed1ba85 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,5 +1,5 @@ -format_doc_comments = true -merge_imports = true +format_code_in_doc_comments = true +imports_granularity = "Crate" normalize_comments = true normalize_doc_attributes = true wrap_comments = true From 1be51c8b2c99fd74d11960693dc9c2112ebab496 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Thu, 12 Feb 2026 11:53:11 +0000 Subject: [PATCH 2/6] Update rustfmt.toml --- rustfmt.toml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rustfmt.toml b/rustfmt.toml index 6ed1ba85..c3f8d3c9 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,5 +1,10 @@ +condense_wildcard_suffixes = true format_code_in_doc_comments = true +format_macro_matchers = true +group_imports = "One" imports_granularity = "Crate" normalize_comments = true normalize_doc_attributes = true -wrap_comments = true +reorder_impl_items = true +use_field_init_shorthand = true +use_try_shorthand = true From ec4f3266c99abb0394d851b46ef541d2bc850971 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Thu, 12 Feb 2026 11:53:43 +0000 Subject: [PATCH 3/6] Format code --- engine/src/ast/index_expr.rs | 2 +- engine/src/functions/mod.rs | 2 +- engine/src/lhs_types/array.rs | 4 ++-- engine/src/lhs_types/map.rs | 4 ++-- engine/src/rhs_types/bytes.rs | 2 +- engine/src/types.rs | 5 +++-- ffi/src/lib.rs | 28 ++++++++++++++-------------- 7 files changed, 24 insertions(+), 23 deletions(-) diff --git a/engine/src/ast/index_expr.rs b/engine/src/ast/index_expr.rs index dd1116cd..a26aa87a 100644 --- a/engine/src/ast/index_expr.rs +++ b/engine/src/ast/index_expr.rs @@ -408,7 +408,7 @@ impl GetType for IndexExpr { (Type::Array(sub_ty), FieldIndex::MapEach) => sub_ty.into(), (Type::Map(sub_ty), FieldIndex::MapKey(_)) => sub_ty.into(), (Type::Map(sub_ty), FieldIndex::MapEach) => sub_ty.into(), - (_, _) => unreachable!(), + (..) => unreachable!(), } } ty diff --git a/engine/src/functions/mod.rs b/engine/src/functions/mod.rs index 5fed9c05..10e497de 100644 --- a/engine/src/functions/mod.rs +++ b/engine/src/functions/mod.rs @@ -407,7 +407,7 @@ pub trait FunctionDefinition: Debug + Send + Sync { ) -> Box Fn(FunctionArgs<'i, 'a>) -> Option> + Sync + Send + 'static>; } -/* Simple function APIs */ +// Simple function APIs type FunctionPtr = for<'i, 'a> fn(FunctionArgs<'i, 'a>) -> Option>; diff --git a/engine/src/lhs_types/array.rs b/engine/src/lhs_types/array.rs index ab594a15..0ecb00ad 100644 --- a/engine/src/lhs_types/array.rs +++ b/engine/src/lhs_types/array.rs @@ -322,8 +322,8 @@ impl ExactSizeIterator for ArrayIntoIter<'_> { } impl<'a> IntoIterator for Array<'a> { - type Item = LhsValue<'a>; type IntoIter = ArrayIntoIter<'a>; + type Item = LhsValue<'a>; fn into_iter(self) -> Self::IntoIter { match self.data { @@ -357,8 +357,8 @@ impl ExactSizeIterator for ArrayIter<'_, '_> { } impl<'a, 'b> IntoIterator for &'b Array<'a> { - type Item = &'b LhsValue<'a>; type IntoIter = ArrayIter<'a, 'b>; + type Item = &'b LhsValue<'a>; #[inline] fn into_iter(self) -> Self::IntoIter { diff --git a/engine/src/lhs_types/map.rs b/engine/src/lhs_types/map.rs index 8486fcdd..92b8d203 100644 --- a/engine/src/lhs_types/map.rs +++ b/engine/src/lhs_types/map.rs @@ -316,8 +316,8 @@ impl<'a> Iterator for MapIntoIter<'a> { } impl<'a> IntoIterator for Map<'a> { - type Item = (Cow<'a, [u8]>, LhsValue<'a>); type IntoIter = MapIntoIter<'a>; + type Item = (Cow<'a, [u8]>, LhsValue<'a>); fn into_iter(self) -> Self::IntoIter { match self.data { @@ -328,8 +328,8 @@ impl<'a> IntoIterator for Map<'a> { } impl<'a, 'b> IntoIterator for &'b Map<'a> { - type Item = (&'b [u8], &'b LhsValue<'a>); type IntoIter = MapIter<'a, 'b>; + type Item = (&'b [u8], &'b LhsValue<'a>); #[inline] fn into_iter(self) -> Self::IntoIter { diff --git a/engine/src/rhs_types/bytes.rs b/engine/src/rhs_types/bytes.rs index b3ab6338..f37ad943 100644 --- a/engine/src/rhs_types/bytes.rs +++ b/engine/src/rhs_types/bytes.rs @@ -147,8 +147,8 @@ impl AsRef<[u8]> for BytesExpr { } impl<'a> IntoIterator for &'a BytesExpr { - type Item = &'a u8; type IntoIter = std::slice::Iter<'a, u8>; + type Item = &'a u8; #[inline] fn into_iter(self) -> std::slice::Iter<'a, u8> { diff --git a/engine/src/types.rs b/engine/src/types.rs index 997a2600..5d49e1d6 100644 --- a/engine/src/types.rs +++ b/engine/src/types.rs @@ -138,7 +138,7 @@ pub struct TypeMismatchError { } macro_rules! replace_underscore { - ($name:ident ($val_ty:ty)) => { + ($name:ident($val_ty:ty)) => { Type::$name(_) }; ($name:ident) => { @@ -859,8 +859,9 @@ impl ExactSizeIterator for IntoIter<'_> { } impl<'a> IntoIterator for LhsValue<'a> { - type Item = LhsValue<'a>; type IntoIter = IntoIter<'a>; + type Item = LhsValue<'a>; + fn into_iter(self) -> Self::IntoIter { match self { LhsValue::Array(array) => IntoIter::IntoArray(array.into_iter()), diff --git a/ffi/src/lib.rs b/ffi/src/lib.rs index ccc0f258..479d93a9 100644 --- a/ffi/src/lib.rs +++ b/ffi/src/lib.rs @@ -172,7 +172,7 @@ macro_rules! wrap_type { }; } -/* Wrapper types needed by cbindgen to forward declare opaque structs */ +// Wrapper types needed by cbindgen to forward declare opaque structs #[derive(Debug, Default)] #[repr(Rust)] @@ -668,9 +668,8 @@ pub struct MatchingResult { } impl MatchingResult { - #[cfg(test)] - const MISSED: Self = Self { - status: Status::Success, + const ERROR: Self = Self { + status: Status::Error, matched: false, }; #[cfg(test)] @@ -678,8 +677,9 @@ impl MatchingResult { status: Status::Success, matched: true, }; - const ERROR: Self = Self { - status: Status::Error, + #[cfg(test)] + const MISSED: Self = Self { + status: Status::Success, matched: false, }; const PANIC: Self = Self { @@ -724,6 +724,14 @@ pub struct UsingResult { } impl UsingResult { + const ERROR: Self = Self { + status: Status::Error, + used: false, + }; + const PANIC: Self = Self { + status: Status::Error, + used: false, + }; #[cfg(test)] const UNUSED: Self = Self { status: Status::Success, @@ -734,14 +742,6 @@ impl UsingResult { status: Status::Success, used: true, }; - const ERROR: Self = Self { - status: Status::Error, - used: false, - }; - const PANIC: Self = Self { - status: Status::Error, - used: false, - }; } #[unsafe(no_mangle)] From 9da9c6f8462cbc4292ddd213c370e9f174c67961 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Thu, 12 Feb 2026 11:59:19 +0000 Subject: [PATCH 4/6] Format imports --- engine/src/ast/field_expr.rs | 11 ++++++----- engine/src/ast/function_expr.rs | 9 +++++---- engine/src/ast/logical_expr.rs | 6 ++++-- engine/src/ast/mod.rs | 4 +--- engine/src/ast/parse.rs | 8 +++++--- engine/src/execution_context.rs | 18 ++++++++---------- engine/src/functions/mod.rs | 10 ++++++---- engine/src/lhs_types/array.rs | 3 +-- engine/src/lhs_types/bytes.rs | 11 ++++++----- engine/src/lhs_types/map.rs | 3 +-- engine/src/lhs_types/mod.rs | 3 +-- engine/src/list_matcher.rs | 6 ++---- engine/src/panic.rs | 12 +++++++----- engine/src/rhs_types/ip.rs | 3 +-- engine/src/rhs_types/regex/imp_real.rs | 7 ++----- engine/src/rhs_types/regex/imp_stub.rs | 3 +-- engine/src/rhs_types/regex/mod.rs | 14 +++++++++----- engine/src/rhs_types/wildcard.rs | 8 +++++--- engine/src/scheme.rs | 15 +++++++-------- engine/src/searcher.rs | 3 +-- engine/src/types.rs | 6 ++++-- ffi/src/lib.rs | 4 ++-- fuzz/map-keys/src/main.rs | 1 - 23 files changed, 85 insertions(+), 83 deletions(-) diff --git a/engine/src/ast/field_expr.rs b/engine/src/ast/field_expr.rs index 6ac30266..8147e9ca 100644 --- a/engine/src/ast/field_expr.rs +++ b/engine/src/ast/field_expr.rs @@ -19,11 +19,13 @@ use crate::{ }; use serde::{Serialize, Serializer}; use sliceslice::MemchrSearcher; -use std::cmp::Ordering; -use std::collections::BTreeSet; -use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; #[cfg(any(target_arch = "x86", target_arch = "x86_64", target_arch = "wasm32"))] use std::sync::LazyLock; +use std::{ + cmp::Ordering, + collections::BTreeSet, + net::{IpAddr, Ipv4Addr, Ipv6Addr}, +}; const LESS: u8 = 0b001; const GREATER: u8 = 0b010; @@ -819,8 +821,7 @@ mod tests { }; use cidr::IpCidr; use serde::Deserialize; - use std::sync::LazyLock; - use std::{convert::TryFrom, iter::once, net::IpAddr}; + use std::{convert::TryFrom, iter::once, net::IpAddr, sync::LazyLock}; fn any_function<'a>(args: FunctionArgs<'_, 'a>) -> Option> { match args.next()? { diff --git a/engine/src/ast/function_expr.rs b/engine/src/ast/function_expr.rs index 6ad87eb7..8d2e4a2d 100644 --- a/engine/src/ast/function_expr.rs +++ b/engine/src/ast/function_expr.rs @@ -22,8 +22,10 @@ use crate::{ types::{GetType, LhsValue, RhsValue, Type}, }; use serde::Serialize; -use std::hash::{Hash, Hasher}; -use std::iter::once; +use std::{ + hash::{Hash, Hasher}, + iter::once, +}; /// Represents a function argument in a function call. #[derive(Debug, PartialEq, Eq, Clone, Hash, Serialize)] @@ -541,8 +543,7 @@ mod tests { scheme::{FieldIndex, IndexAccessError, Scheme}, types::{RhsValues, Type, TypeMismatchError}, }; - use std::convert::TryFrom; - use std::sync::LazyLock; + use std::{convert::TryFrom, sync::LazyLock}; fn any_function<'a>(args: FunctionArgs<'_, 'a>) -> Option> { match args.next()? { diff --git a/engine/src/ast/logical_expr.rs b/engine/src/ast/logical_expr.rs index 478b4e9f..2cb68fe3 100644 --- a/engine/src/ast/logical_expr.rs +++ b/engine/src/ast/logical_expr.rs @@ -327,8 +327,10 @@ impl Expr for LogicalExpr { fn test() { use super::field_expr::ComparisonExpr; use crate::{ - ast::field_expr::{ComparisonOpExpr, IdentifierExpr}, - ast::index_expr::IndexExpr, + ast::{ + field_expr::{ComparisonOpExpr, IdentifierExpr}, + index_expr::IndexExpr, + }, execution_context::ExecutionContext, lex::complete, lhs_types::Array, diff --git a/engine/src/ast/mod.rs b/engine/src/ast/mod.rs index 66323bb3..c93bb5c3 100644 --- a/engine/src/ast/mod.rs +++ b/engine/src/ast/mod.rs @@ -5,9 +5,7 @@ pub mod logical_expr; pub mod parse; pub mod visitor; -use self::index_expr::IndexExpr; -use self::logical_expr::LogicalExpr; -use self::parse::FilterParser; +use self::{index_expr::IndexExpr, logical_expr::LogicalExpr, parse::FilterParser}; use crate::{ compiler::{Compiler, DefaultCompiler}, filter::{CompiledExpr, CompiledValueExpr, Filter, FilterValue}, diff --git a/engine/src/ast/parse.rs b/engine/src/ast/parse.rs index e9984294..9a7948fb 100644 --- a/engine/src/ast/parse.rs +++ b/engine/src/ast/parse.rs @@ -3,9 +3,11 @@ use crate::{ lex::{LexErrorKind, LexResult, LexWith, complete}, scheme::Scheme, }; -use std::cmp::{max, min}; -use std::error::Error; -use std::fmt::{self, Debug, Display, Formatter}; +use std::{ + cmp::{max, min}, + error::Error, + fmt::{self, Debug, Display, Formatter}, +}; /// An opaque filter parsing error associated with the original input. /// diff --git a/engine/src/execution_context.rs b/engine/src/execution_context.rs index 26b4c86d..2a7724b3 100644 --- a/engine/src/execution_context.rs +++ b/engine/src/execution_context.rs @@ -3,12 +3,12 @@ use crate::{ scheme::{Field, List, Scheme, SchemeMismatchError}, types::{GetType, LhsValue, LhsValueSeed, Type, TypeMismatchError}, }; -use serde::Serialize; -use serde::de::{self, DeserializeSeed, Deserializer, MapAccess, SeqAccess, Visitor}; -use serde::ser::{SerializeMap, SerializeSeq, Serializer}; -use std::borrow::Cow; -use std::fmt; -use std::fmt::Debug; +use serde::{ + Serialize, + de::{self, DeserializeSeed, Deserializer, MapAccess, SeqAccess, Visitor}, + ser::{SerializeMap, SerializeSeq, Serializer}, +}; +use std::{borrow::Cow, fmt, fmt::Debug}; use thiserror::Error; /// An error that occurs when setting the field value in the [`crate::ExecutionContext`]. @@ -570,8 +570,7 @@ fn test_scheme_mismatch() { #[test] fn test_serde() { use crate::lhs_types::{Array, TypedMap}; - use std::net::IpAddr; - use std::str::FromStr; + use std::{net::IpAddr, str::FromStr}; let scheme = Scheme! { bool: Bool, @@ -730,8 +729,7 @@ fn test_serde() { #[test] fn test_clear() { - use std::net::IpAddr; - use std::str::FromStr; + use std::{net::IpAddr, str::FromStr}; let scheme = Scheme! { bool: Bool, diff --git a/engine/src/functions/mod.rs b/engine/src/functions/mod.rs index 10e497de..21afdd5b 100644 --- a/engine/src/functions/mod.rs +++ b/engine/src/functions/mod.rs @@ -10,10 +10,12 @@ use crate::{ pub use all::AllFunction; pub use any::AnyFunction; pub use concat::ConcatFunction; -use std::any::Any; -use std::convert::TryFrom; -use std::fmt::{self, Debug}; -use std::iter::once; +use std::{ + any::Any, + convert::TryFrom, + fmt::{self, Debug}, + iter::once, +}; use thiserror::Error; pub(crate) struct ExactSizeChain diff --git a/engine/src/lhs_types/array.rs b/engine/src/lhs_types/array.rs index 0ecb00ad..1dcf3ed7 100644 --- a/engine/src/lhs_types/array.rs +++ b/engine/src/lhs_types/array.rs @@ -1,3 +1,4 @@ +use super::{TypedMap, map::InnerMap}; use crate::{ lhs_types::AsRefIterator, types::{CompoundType, GetType, IntoValue, LhsValue, LhsValueSeed, Type, TypeMismatchError}, @@ -13,8 +14,6 @@ use std::{ hint::unreachable_unchecked, }; -use super::{TypedMap, map::InnerMap}; - // Ideally, we would want to use Cow<'a, LhsValue<'a>> here // but it doesnt work for unknown reasons // See https://github.com/rust-lang/rust/issues/23707#issuecomment-557312736 diff --git a/engine/src/lhs_types/bytes.rs b/engine/src/lhs_types/bytes.rs index 0ebf1f69..d81a52f4 100644 --- a/engine/src/lhs_types/bytes.rs +++ b/engine/src/lhs_types/bytes.rs @@ -1,8 +1,9 @@ -use serde::de::Visitor; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use std::borrow::{Borrow, Cow}; -use std::hash::{Hash, Hasher}; -use std::ops::Deref; +use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Visitor}; +use std::{ + borrow::{Borrow, Cow}, + hash::{Hash, Hasher}, + ops::Deref, +}; /// A byte string. #[derive(Debug, Clone)] diff --git a/engine/src/lhs_types/map.rs b/engine/src/lhs_types/map.rs index 92b8d203..00332825 100644 --- a/engine/src/lhs_types/map.rs +++ b/engine/src/lhs_types/map.rs @@ -1,3 +1,4 @@ +use super::{TypedArray, array::InnerArray}; use crate::{ TypeMismatchError, lhs_types::{AsRefIterator, Bytes}, @@ -15,8 +16,6 @@ use std::{ hash::{Hash, Hasher}, }; -use super::{TypedArray, array::InnerArray}; - #[derive(Debug, Clone)] pub(crate) enum InnerMap<'a> { Owned(BTreeMap, LhsValue<'a>>), diff --git a/engine/src/lhs_types/mod.rs b/engine/src/lhs_types/mod.rs index 170e2d41..e15854f4 100644 --- a/engine/src/lhs_types/mod.rs +++ b/engine/src/lhs_types/mod.rs @@ -2,13 +2,12 @@ mod array; mod bytes; mod map; -use crate::types::LhsValue; - pub use self::{ array::{Array, ArrayIntoIter, ArrayIter, TypedArray}, bytes::Bytes, map::{Map, MapIter, MapValuesIntoIter, TypedMap}, }; +use crate::types::LhsValue; pub struct AsRefIterator<'a, T: Iterator>>(T); diff --git a/engine/src/list_matcher.rs b/engine/src/list_matcher.rs index c8d38580..bc27619c 100644 --- a/engine/src/list_matcher.rs +++ b/engine/src/list_matcher.rs @@ -1,9 +1,7 @@ -use crate::LhsValue; -use crate::Type; +use crate::{LhsValue, Type}; use dyn_clone::DynClone; use serde::{Deserialize, Serialize}; -use std::any::Any; -use std::fmt::Debug; +use std::{any::Any, fmt::Debug}; /// Defines a new list to match against. /// diff --git a/engine/src/panic.rs b/engine/src/panic.rs index 9e60d394..87564647 100644 --- a/engine/src/panic.rs +++ b/engine/src/panic.rs @@ -1,9 +1,11 @@ use backtrace::Backtrace; -use std::cell::{Cell, RefCell}; -use std::io::{self, Write}; -use std::panic::UnwindSafe; -use std::process::abort; -use std::sync::atomic::{AtomicBool, Ordering}; +use std::{ + cell::{Cell, RefCell}, + io::{self, Write}, + panic::UnwindSafe, + process::abort, + sync::atomic::{AtomicBool, Ordering}, +}; /// Describes the fallback behavior when /// a panic occurs outside of `catch_panic`. diff --git a/engine/src/rhs_types/ip.rs b/engine/src/rhs_types/ip.rs index a5526d76..7f37280e 100644 --- a/engine/src/rhs_types/ip.rs +++ b/engine/src/rhs_types/ip.rs @@ -1,9 +1,8 @@ -pub use cidr::IpCidr; - use crate::{ lex::{Lex, LexError, LexErrorKind, LexResult, take_while}, strict_partial_ord::StrictPartialOrd, }; +pub use cidr::IpCidr; use cidr::{Ipv4Cidr, Ipv6Cidr, errors::NetworkParseError}; use serde::Serialize; use std::{ diff --git a/engine/src/rhs_types/regex/imp_real.rs b/engine/src/rhs_types/regex/imp_real.rs index 2b5a6480..95d9dbc3 100644 --- a/engine/src/rhs_types/regex/imp_real.rs +++ b/engine/src/rhs_types/regex/imp_real.rs @@ -1,10 +1,7 @@ -use regex_automata::MatchKind; -use regex_automata::nfa::thompson::WhichCaptures; - use super::Error; use crate::{ParserSettings, RegexFormat}; -use std::ops::Deref; -use std::sync::Arc; +use regex_automata::{MatchKind, nfa::thompson::WhichCaptures}; +use std::{ops::Deref, sync::Arc}; /// Wrapper around [`regex_automata::meta::Regex`] #[derive(Clone)] diff --git a/engine/src/rhs_types/regex/imp_stub.rs b/engine/src/rhs_types/regex/imp_stub.rs index 0f5a1081..00e03d0f 100644 --- a/engine/src/rhs_types/regex/imp_stub.rs +++ b/engine/src/rhs_types/regex/imp_stub.rs @@ -1,6 +1,5 @@ -use thiserror::Error; - use crate::{FilterParser, RegexFormat}; +use thiserror::Error; /// Dummy regex error. #[derive(Debug, PartialEq, Error)] diff --git a/engine/src/rhs_types/regex/mod.rs b/engine/src/rhs_types/regex/mod.rs index 3ed5b096..54205b6d 100644 --- a/engine/src/rhs_types/regex/mod.rs +++ b/engine/src/rhs_types/regex/mod.rs @@ -1,10 +1,14 @@ -use crate::lex::{LexErrorKind, LexResult, LexWith, span}; -use crate::rhs_types::bytes::lex_raw_string_as_str; -use crate::{Compare, ExecutionContext, FilterParser, LhsValue}; +use crate::{ + Compare, ExecutionContext, FilterParser, LhsValue, + lex::{LexErrorKind, LexResult, LexWith, span}, + rhs_types::bytes::lex_raw_string_as_str, +}; use cfg_if::cfg_if; use serde::{Serialize, Serializer}; -use std::fmt::{self, Debug, Display, Formatter}; -use std::hash::{Hash, Hasher}; +use std::{ + fmt::{self, Debug, Display, Formatter}, + hash::{Hash, Hasher}, +}; use thiserror::Error; cfg_if! { diff --git a/engine/src/rhs_types/wildcard.rs b/engine/src/rhs_types/wildcard.rs index 068e50f6..6cbd139a 100644 --- a/engine/src/rhs_types/wildcard.rs +++ b/engine/src/rhs_types/wildcard.rs @@ -1,6 +1,8 @@ -use crate::lex::{LexResult, LexWith}; -use crate::rhs_types::bytes::{BytesExpr, lex_quoted_or_raw_string}; -use crate::{FilterParser, LexErrorKind}; +use crate::{ + FilterParser, LexErrorKind, + lex::{LexResult, LexWith}, + rhs_types::bytes::{BytesExpr, lex_quoted_or_raw_string}, +}; use serde::{Serialize, Serializer}; use std::{ fmt::{self, Debug, Formatter}, diff --git a/engine/src/scheme.rs b/engine/src/scheme.rs index 57031911..2f6a33d4 100644 --- a/engine/src/scheme.rs +++ b/engine/src/scheme.rs @@ -9,17 +9,14 @@ use crate::{ types::{GetType, RhsValue, Type}, }; use fnv::FnvBuildHasher; -use serde::de::Visitor; -use serde::ser::SerializeMap; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use std::collections::hash_map::Entry; -use std::sync::Arc; +use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Visitor, ser::SerializeMap}; use std::{ - collections::HashMap, + collections::{HashMap, hash_map::Entry}, convert::TryFrom, fmt::{self, Debug, Formatter}, hash::{Hash, Hasher}, iter::Iterator, + sync::Arc, }; use thiserror::Error; @@ -981,8 +978,10 @@ macro_rules! Scheme { #[test] fn test_parse_error() { - use crate::ConcatFunction; - use crate::types::{ExpectedTypeList, TypeMismatchError}; + use crate::{ + ConcatFunction, + types::{ExpectedTypeList, TypeMismatchError}, + }; use indoc::indoc; let mut builder = Scheme! { diff --git a/engine/src/searcher.rs b/engine/src/searcher.rs index 403faf94..23846c71 100644 --- a/engine/src/searcher.rs +++ b/engine/src/searcher.rs @@ -1,8 +1,7 @@ +use crate::{Compare, ExecutionContext, LhsValue}; use memchr::memmem::{Finder, FinderBuilder}; use sliceslice::MemchrSearcher; -use crate::{Compare, ExecutionContext, LhsValue}; - pub struct EmptySearcher; impl Compare for EmptySearcher { diff --git a/engine/src/types.rs b/engine/src/types.rs index 5d49e1d6..05065af8 100644 --- a/engine/src/types.rs +++ b/engine/src/types.rs @@ -5,8 +5,10 @@ use crate::{ scheme::{FieldIndex, IndexAccessError}, strict_partial_ord::StrictPartialOrd, }; -use serde::de::{DeserializeSeed, Deserializer}; -use serde::{Deserialize, Serialize, Serializer}; +use serde::{ + Deserialize, Serialize, Serializer, + de::{DeserializeSeed, Deserializer}, +}; use std::{ cmp::Ordering, collections::BTreeSet, diff --git a/ffi/src/lib.rs b/ffi/src/lib.rs index 479d93a9..754a217d 100644 --- a/ffi/src/lib.rs +++ b/ffi/src/lib.rs @@ -9,13 +9,13 @@ use fnv::FnvHasher; use libc::c_char; use num_enum::{IntoPrimitive, TryFromPrimitive}; use serde::de::DeserializeSeed; -use std::cell::RefCell; -use std::ops::{Deref, DerefMut}; use std::{ + cell::RefCell, convert::TryFrom, hash::Hasher, io::{self, Write}, net::IpAddr, + ops::{Deref, DerefMut}, }; use wirefilter::{AlwaysList, GetType, NeverList, Type, catch_panic}; diff --git a/fuzz/map-keys/src/main.rs b/fuzz/map-keys/src/main.rs index a30d399c..80b2c36b 100644 --- a/fuzz/map-keys/src/main.rs +++ b/fuzz/map-keys/src/main.rs @@ -1,5 +1,4 @@ use std::sync::LazyLock; - use wirefilter::{ FunctionArgs, LhsValue, SimpleFunctionArgKind, SimpleFunctionDefinition, SimpleFunctionImpl, SimpleFunctionParam, Type, From 389ffe0a3b304b64b8518dfff3125b9ee5fc1f0d Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Thu, 12 Feb 2026 12:04:27 +0000 Subject: [PATCH 5/6] Format YAML --- .github/workflows/rust.yml | 122 ++++++++++++++++++------------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 51762eb3..8d28063d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,9 +2,9 @@ name: Rust on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] env: CARGO_TERM_COLOR: always @@ -12,29 +12,29 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: stable - components: clippy,rustfmt - - uses: tombi-toml/setup-tombi@v1 - - name: Print versions - run: | - cargo --version - rustc --version - clippy-driver --version - rustfmt --version - tombi --version - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose - - name: Run clippy - run: cargo clippy --verbose --all-targets -- -D clippy::all - - name: Check code formatting - run: cargo fmt --verbose --all -- --check - - name: Check toml formatting - run: tombi format --check + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + components: clippy,rustfmt + - uses: tombi-toml/setup-tombi@v1 + - name: Print versions + run: | + cargo --version + rustc --version + clippy-driver --version + rustfmt --version + tombi --version + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose + - name: Run clippy + run: cargo clippy --verbose --all-targets -- -D clippy::all + - name: Check code formatting + run: cargo fmt --verbose --all -- --check + - name: Check toml formatting + run: tombi format --check doc: name: Documentation @@ -42,19 +42,19 @@ jobs: env: RUSTDOCFLAGS: -D warnings steps: - - uses: actions/checkout@v4 - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: stable - - name: Print versions - run: | - cargo --version - rustc --version - rustdoc --version - - name: Doc - run: cargo doc --verbose - - name: Doc with all features - run: cargo doc --verbose --all-features + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + - name: Print versions + run: | + cargo --version + rustc --version + rustdoc --version + - name: Doc + run: cargo doc --verbose + - name: Doc with all features + run: cargo doc --verbose --all-features miri-test: name: Test with miri @@ -62,13 +62,13 @@ jobs: env: MIRIFLAGS: -Zmiri-disable-isolation steps: - - uses: actions/checkout@v4 - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: nightly - components: miri - - run: cargo miri test --verbose --no-default-features - - run: cargo miri test --verbose --all-features + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: nightly + components: miri + - run: cargo miri test --verbose --no-default-features + - run: cargo miri test --verbose --all-features sanitizer-test: name: Test with -Zsanitizer=${{ matrix.sanitizer }} @@ -78,19 +78,19 @@ jobs: matrix: sanitizer: [address, thread, leak] steps: - - uses: actions/checkout@v4 - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: nightly - components: rust-src - - name: Test with sanitizer - env: - RUSTFLAGS: -Zsanitizer=${{ matrix.sanitizer }} - RUSTDOCFLAGS: -Zsanitizer=${{ matrix.sanitizer }} - # only needed by asan - ASAN_OPTIONS: detect_stack_use_after_return=1,detect_leaks=0 - # Asan's leak detection occasionally complains - # about some small leaks if backtraces are captured, - # so ensure they're not - RUST_BACKTRACE: 0 - run: cargo test -Zbuild-std --verbose --target=x86_64-unknown-linux-gnu --lib --bins --tests + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: nightly + components: rust-src + - name: Test with sanitizer + env: + RUSTFLAGS: -Zsanitizer=${{ matrix.sanitizer }} + RUSTDOCFLAGS: -Zsanitizer=${{ matrix.sanitizer }} + # only needed by asan + ASAN_OPTIONS: detect_stack_use_after_return=1,detect_leaks=0 + # Asan's leak detection occasionally complains + # about some small leaks if backtraces are captured, + # so ensure they're not + RUST_BACKTRACE: 0 + run: cargo test -Zbuild-std --verbose --target=x86_64-unknown-linux-gnu --lib --bins --tests From e0fa5835b9fa27de34fb8f110b1e8235dc0c04f8 Mon Sep 17 00:00:00 2001 From: Utkarsh Gupta Date: Thu, 12 Feb 2026 12:05:25 +0000 Subject: [PATCH 6/6] Update rust.yml --- .github/workflows/rust.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8d28063d..bd29a5d6 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -16,23 +16,34 @@ jobs: - uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: stable - components: clippy,rustfmt - - uses: tombi-toml/setup-tombi@v1 + components: clippy - name: Print versions run: | cargo --version rustc --version clippy-driver --version - rustfmt --version - tombi --version - name: Build run: cargo build --verbose - name: Run tests run: cargo test --verbose - name: Run clippy run: cargo clippy --verbose --all-targets -- -D clippy::all + + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: nightly + components: rustfmt + - uses: tombi-toml/setup-tombi@v1 + - name: Print versions + run: | + rustfmt --version + tombi --version - name: Check code formatting - run: cargo fmt --verbose --all -- --check + run: cargo +nightly fmt --check - name: Check toml formatting run: tombi format --check