Skip to content

Commit ac04efa

Browse files
committed
style: clippy clean when not all features are enabled
1 parent 5d286ad commit ac04efa

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎src/ast.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ pub(crate) type NumberType = i64;
1919

2020
/// Allowed non-alphanumeric characters in Scheme symbol names
2121
/// Most represent mathematical symbols or predicates ("?"), "$" supported for JavaScript identifiers
22+
#[cfg(any(feature = "scheme", feature = "jsonlogic"))]
2223
pub(crate) const SYMBOL_SPECIAL_CHARS: &str = "+-*/<>=!?_$";
2324

2425
/// Check if a string is a valid symbol name
2526
/// Valid: non-empty, no leading digit, no "-digit" prefix, alphanumeric + SYMBOL_SPECIAL_CHARS
2627
/// Note: This function is tested as part of the parser tests in parser.rs
28+
#[cfg(any(feature = "scheme", feature = "jsonlogic"))]
2729
pub(crate) fn is_valid_symbol(name: &str) -> bool {
2830
let mut chars = name.chars();
2931

‎src/builtinops.rs‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ use crate::evaluator::{
5656
Arity, Environment, NumIter, StringIter, ValueIter, eval_and, eval_define, eval_if,
5757
eval_lambda, eval_or, eval_quote,
5858
};
59+
#[cfg(any(feature = "scheme", feature = "jsonlogic", test))]
5960
use std::collections::HashMap;
6061
use std::sync::{Arc, LazyLock};
6162

@@ -112,12 +113,13 @@ impl PartialEq for BuiltinOp {
112113

113114
impl BuiltinOp {
114115
/// Check if this operation is a special form
115-
#[cfg_attr(not(test), expect(dead_code))]
116+
#[cfg(test)]
116117
pub(crate) fn is_special_form(&self) -> bool {
117118
matches!(self.op_kind, OpKind::SpecialForm(_))
118119
}
119120

120121
/// Check if the given number of arguments is valid for this operation
122+
#[cfg(any(feature = "scheme", feature = "jsonlogic"))]
121123
pub(crate) fn validate_arity(&self, arg_count: usize) -> Result<(), Error> {
122124
self.arity.validate(arg_count)
123125
}
@@ -518,12 +520,14 @@ static BUILTIN_OPS: LazyLock<Vec<BuiltinOp>> = LazyLock::new(|| {
518520
});
519521

520522
/// Lazy static map from scheme_id to BuiltinOp (private - use find_builtin_op_by_scheme_id)
523+
#[cfg(any(feature = "scheme", feature = "jsonlogic", test))]
521524
static BUILTIN_SCHEME: LazyLock<HashMap<&'static str, &'static BuiltinOp>> = LazyLock::new(|| {
522525
let ops: &'static [BuiltinOp] = BUILTIN_OPS.as_slice();
523526
ops.iter().map(|op| (op.scheme_id, op)).collect()
524527
});
525528

526529
/// Lazy static map from jsonlogic_id to BuiltinOp (private - use find_builtin_op_by_jsonlogic_id)
530+
#[cfg(any(feature = "jsonlogic", test))]
527531
static BUILTIN_JSONLOGIC: LazyLock<HashMap<&'static str, &'static BuiltinOp>> =
528532
LazyLock::new(|| {
529533
let ops: &'static [BuiltinOp] = BUILTIN_OPS.as_slice();
@@ -536,21 +540,25 @@ pub(crate) fn get_builtin_ops() -> &'static [BuiltinOp] {
536540
}
537541

538542
/// Find a builtin operation by its Scheme identifier
543+
#[cfg(any(feature = "scheme", feature = "jsonlogic", test))]
539544
pub(crate) fn find_scheme_op(id: &str) -> Option<&'static BuiltinOp> {
540545
BUILTIN_SCHEME.get(id).copied()
541546
}
542547

543548
/// Find a builtin operation by its JSONLogic identifier
549+
#[cfg(any(feature = "jsonlogic", test))]
544550
pub(crate) fn find_jsonlogic_op(id: &str) -> Option<&'static BuiltinOp> {
545551
BUILTIN_JSONLOGIC.get(id).copied()
546552
}
547553

548554
/// Get the quote builtin operation - guaranteed to exist
555+
#[cfg(any(feature = "scheme", feature = "jsonlogic"))]
549556
pub(crate) fn get_quote_op() -> &'static BuiltinOp {
550557
find_scheme_op("quote").expect("quote builtin operation must be available")
551558
}
552559

553560
/// Get the list builtin operation - guaranteed to exist
561+
#[cfg(feature = "jsonlogic")]
554562
pub(crate) fn get_list_op() -> &'static BuiltinOp {
555563
find_scheme_op("list").expect("list builtin operation must be available")
556564
}

0 commit comments

Comments
 (0)