diff --git a/.github/actions/toolchains/rust/action.yml b/.github/actions/toolchains/rust/action.yml index 4b36770..61e2642 100644 --- a/.github/actions/toolchains/rust/action.yml +++ b/.github/actions/toolchains/rust/action.yml @@ -4,7 +4,7 @@ inputs: toolchain: description: 'Rust toolchain version' required: false - default: '1.89.0' + default: '1.92.0' components: description: 'Additional components to install' required: false diff --git a/README.md b/README.md index 96c3698..cbad574 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **Regorus** is - *Rego*-*Rus(t)* - A fast, light-weight [Rego](https://www.openpolicyagent.org/docs/latest/policy-language/) - interpreter written in Rust. + interpreter written in Rust. - *Rigorous* - A rigorous enforcer of well-defined Rego semantics. Regorus is also diff --git a/src/ast.rs b/src/ast.rs index 4e16f50..74cbf6b 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -1,3 +1,4 @@ +#![allow(clippy::missing_const_for_fn, clippy::pattern_type_mismatch)] // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/src/builtins/aggregates.rs b/src/builtins/aggregates.rs index 9d7fc9d..ae35c47 100644 --- a/src/builtins/aggregates.rs +++ b/src/builtins/aggregates.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch)] + use crate::ast::{Expr, Ref}; use crate::builtins; use crate::builtins::utils::{ensure_args_count, ensure_numeric}; diff --git a/src/builtins/arrays.rs b/src/builtins/arrays.rs index 5f75e7d..ceb4660 100644 --- a/src/builtins/arrays.rs +++ b/src/builtins/arrays.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::as_conversions)] use crate::ast::{Expr, Ref}; use crate::builtins; diff --git a/src/builtins/comparison.rs b/src/builtins/comparison.rs index 574f57e..f3319e8 100644 --- a/src/builtins/comparison.rs +++ b/src/builtins/comparison.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch)] + use crate::ast::BoolOp; use crate::value::Value; diff --git a/src/builtins/conversions.rs b/src/builtins/conversions.rs index 96d20ad..bd53b08 100644 --- a/src/builtins/conversions.rs +++ b/src/builtins/conversions.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::unseparated_literal_suffix, clippy::pattern_type_mismatch)] + use crate::ast::{Expr, Ref}; use crate::builtins; use crate::builtins::utils::ensure_args_count; diff --git a/src/builtins/encoding.rs b/src/builtins/encoding.rs index 2eda12b..54a9a3d 100644 --- a/src/builtins/encoding.rs +++ b/src/builtins/encoding.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::unused_trait_names, clippy::pattern_type_mismatch)] use crate::ast::{Expr, Ref}; use crate::builtins; diff --git a/src/builtins/glob.rs b/src/builtins/glob.rs index 1e0ff05..820e126 100644 --- a/src/builtins/glob.rs +++ b/src/builtins/glob.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch)] + use crate::ast::{Expr, Ref}; use crate::builtins; use crate::builtins::utils::{ensure_args_count, ensure_string, ensure_string_collection}; diff --git a/src/builtins/graph.rs b/src/builtins/graph.rs index a4926b9..cdb2a78 100644 --- a/src/builtins/graph.rs +++ b/src/builtins/graph.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch)] + use crate::ast::{Expr, Ref}; use crate::builtins; use crate::builtins::utils::{ensure_args_count, ensure_object}; diff --git a/src/builtins/mod.rs b/src/builtins/mod.rs index 0a300c3..8d6bcce 100644 --- a/src/builtins/mod.rs +++ b/src/builtins/mod.rs @@ -1,6 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::arithmetic_side_effects, + clippy::expect_used, + clippy::indexing_slicing, + clippy::panic, + clippy::shadow_unrelated, + clippy::unwrap_used, + clippy::missing_const_for_fn, + clippy::option_if_let_else, + clippy::semicolon_if_nothing_returned, + clippy::useless_let_if_seq +)] // builtins perform validated indexing and intentional arithmetic/string ops + mod aggregates; mod arrays; mod bitwise; diff --git a/src/builtins/net.rs b/src/builtins/net.rs index c311779..7e0c185 100644 --- a/src/builtins/net.rs +++ b/src/builtins/net.rs @@ -1,3 +1,10 @@ +#![allow( + clippy::panic, + clippy::expect_used, + clippy::needless_continue, + clippy::unused_trait_names +)] // net builtins panic/expect in invariant checks + use core::net::IpAddr; use ipnet::IpNet; use std::format; diff --git a/src/builtins/numbers.rs b/src/builtins/numbers.rs index 4f4dc39..8a3b2ec 100644 --- a/src/builtins/numbers.rs +++ b/src/builtins/numbers.rs @@ -1,6 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::unseparated_literal_suffix, + clippy::as_conversions, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] + use crate::ast::{ArithOp, Expr, Ref}; use crate::builtins; use crate::builtins::utils::{ensure_args_count, ensure_numeric}; diff --git a/src/builtins/objects.rs b/src/builtins/objects.rs index c326fd1..d1b05ec 100644 --- a/src/builtins/objects.rs +++ b/src/builtins/objects.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch)] + use crate::ast::{Expr, Ref}; use crate::builtins; use crate::builtins::utils::{ensure_args_count, ensure_array, ensure_object}; diff --git a/src/builtins/regex.rs b/src/builtins/regex.rs index f155949..c524fed 100644 --- a/src/builtins/regex.rs +++ b/src/builtins/regex.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::as_conversions)] use crate::ast::{Expr, Ref}; use crate::builtins; diff --git a/src/builtins/semver.rs b/src/builtins/semver.rs index 6f4c916..228df29 100644 --- a/src/builtins/semver.rs +++ b/src/builtins/semver.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::as_conversions, clippy::pattern_type_mismatch)] use crate::ast::{Expr, Ref}; use crate::builtins; diff --git a/src/builtins/sets.rs b/src/builtins/sets.rs index afae1e0..82e3491 100644 --- a/src/builtins/sets.rs +++ b/src/builtins/sets.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch)] + use crate::ast::{Expr, Ref}; use crate::builtins; use crate::builtins::utils::{ensure_args_count, ensure_set}; diff --git a/src/builtins/strings.rs b/src/builtins/strings.rs index 9479e18..fad09d0 100644 --- a/src/builtins/strings.rs +++ b/src/builtins/strings.rs @@ -1,6 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::unseparated_literal_suffix, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] + use crate::ast::{Expr, Ref}; use crate::builtins; use crate::builtins::utils::{ diff --git a/src/builtins/test.rs b/src/builtins/test.rs index fea5516..7ef0fd5 100644 --- a/src/builtins/test.rs +++ b/src/builtins/test.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::indexing_slicing)] use crate::ast::{Expr, Ref}; use crate::builtins; diff --git a/src/builtins/time.rs b/src/builtins/time.rs index d35aa6b..848fc19 100644 --- a/src/builtins/time.rs +++ b/src/builtins/time.rs @@ -1,6 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. - +#![allow( + clippy::as_conversions, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] use crate::ast::{Expr, Ref}; use crate::builtins; use crate::builtins::utils::{ensure_args_count, ensure_numeric, ensure_string}; diff --git a/src/builtins/time/compat.rs b/src/builtins/time/compat.rs index 04feba7..77cf511 100644 --- a/src/builtins/time/compat.rs +++ b/src/builtins/time/compat.rs @@ -31,6 +31,12 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#![allow( + clippy::arithmetic_side_effects, + clippy::unseparated_literal_suffix, + clippy::pattern_type_mismatch +)] // ported Go time parsing uses intentional arithmetic and explicit suffixes + use crate::*; use core::fmt; use core::iter; @@ -584,6 +590,11 @@ where #[cfg(test)] mod tests { + #![allow( + clippy::unwrap_used, + clippy::unused_trait_names, + clippy::as_conversions + )] // test fixtures build durations with unwrap for brevity use chrono::{Datelike, Month, TimeZone, Timelike, Weekday}; use chrono_tz::PST8PDT; diff --git a/src/builtins/time/diff.rs b/src/builtins/time/diff.rs index 8846e51..1eace5b 100644 --- a/src/builtins/time/diff.rs +++ b/src/builtins/time/diff.rs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT and Apache 2.0 License. - +#![allow(clippy::as_conversions, clippy::unused_trait_names)] use anyhow::{anyhow, Result}; use chrono::{DateTime, Datelike, FixedOffset, NaiveDate, Timelike}; diff --git a/src/builtins/tracing.rs b/src/builtins/tracing.rs index 6d9bb8e..02ffd6a 100644 --- a/src/builtins/tracing.rs +++ b/src/builtins/tracing.rs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. - use crate::ast::{Expr, Ref}; use crate::builtins; use crate::builtins::utils::{ensure_args_count, ensure_string}; diff --git a/src/builtins/types.rs b/src/builtins/types.rs index 4549543..f1bc97c 100644 --- a/src/builtins/types.rs +++ b/src/builtins/types.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::indexing_slicing, clippy::pattern_type_mismatch)] use crate::ast::{Expr, Ref}; use crate::builtins; diff --git a/src/builtins/units.rs b/src/builtins/units.rs index af446c2..bdc1b70 100644 --- a/src/builtins/units.rs +++ b/src/builtins/units.rs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. - +#![allow(clippy::unused_trait_names)] use alloc::borrow::Cow; use core::str::FromStr; diff --git a/src/builtins/utils.rs b/src/builtins/utils.rs index 1cce846..5085c56 100644 --- a/src/builtins/utils.rs +++ b/src/builtins/utils.rs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch)] use crate::ast::{Expr, Ref}; use crate::lexer::Span; use crate::number::Number; diff --git a/src/builtins/uuid.rs b/src/builtins/uuid.rs index e10ea7b..59b8838 100644 --- a/src/builtins/uuid.rs +++ b/src/builtins/uuid.rs @@ -1,6 +1,6 @@ +#![allow(clippy::missing_const_for_fn, clippy::as_conversions)] // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. - use crate::ast::{Expr, Ref}; use crate::builtins; use crate::builtins::utils::{ensure_args_count, ensure_string}; diff --git a/src/compiled_policy.rs b/src/compiled_policy.rs index 6e1214d..2292032 100644 --- a/src/compiled_policy.rs +++ b/src/compiled_policy.rs @@ -1,5 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::redundant_pub_crate, + clippy::missing_const_for_fn, + clippy::option_if_let_else, + clippy::pattern_type_mismatch +)] use crate::ast::*; use crate::compiler::hoist::HoistedLoopsLookup; diff --git a/src/compiler.rs b/src/compiler.rs index 61bb013..ffeb93d 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -1,6 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::missing_const_for_fn, + clippy::option_if_let_else, + clippy::if_then_some_else_none, + clippy::unused_self, + clippy::semicolon_if_nothing_returned, + clippy::useless_let_if_seq +)] //! Compiler-related functionality for Regorus. //! //! This module contains utilities and data structures used during diff --git a/src/compiler/context.rs b/src/compiler/context.rs index ffecbf4..36d07e0 100644 --- a/src/compiler/context.rs +++ b/src/compiler/context.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::unused_trait_names)] //! Compilation context types shared across compiler components. //! diff --git a/src/compiler/destructuring_planner/assignment.rs b/src/compiler/destructuring_planner/assignment.rs index 5947de0..3e88bdb 100644 --- a/src/compiler/destructuring_planner/assignment.rs +++ b/src/compiler/destructuring_planner/assignment.rs @@ -1,5 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::unreachable, + clippy::expect_used, + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] //! Assignment-specific planning utilities. diff --git a/src/compiler/destructuring_planner/context.rs b/src/compiler/destructuring_planner/context.rs index 0a68068..9aa8e0b 100644 --- a/src/compiler/destructuring_planner/context.rs +++ b/src/compiler/destructuring_planner/context.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::redundant_pub_crate)] //! Context traits shared across planner submodules. diff --git a/src/compiler/destructuring_planner/destructuring.rs b/src/compiler/destructuring_planner/destructuring.rs index 98819d6..31d8dd9 100644 --- a/src/compiler/destructuring_planner/destructuring.rs +++ b/src/compiler/destructuring_planner/destructuring.rs @@ -1,5 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::redundant_pub_crate, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] //! Functions responsible for building destructuring plans. diff --git a/src/compiler/destructuring_planner/error.rs b/src/compiler/destructuring_planner/error.rs index 0145d62..aa31b7e 100644 --- a/src/compiler/destructuring_planner/error.rs +++ b/src/compiler/destructuring_planner/error.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch)] + //! Error definitions for the destructuring planner. use alloc::format; diff --git a/src/compiler/destructuring_planner/parameters.rs b/src/compiler/destructuring_planner/parameters.rs index 71d1534..176d861 100644 --- a/src/compiler/destructuring_planner/parameters.rs +++ b/src/compiler/destructuring_planner/parameters.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::unused_trait_names)] //! Planner helpers for function parameters and loop indices. diff --git a/src/compiler/destructuring_planner/plans.rs b/src/compiler/destructuring_planner/plans.rs index aec9e14..1481f41 100644 --- a/src/compiler/destructuring_planner/plans.rs +++ b/src/compiler/destructuring_planner/plans.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::unused_trait_names, clippy::pattern_type_mismatch)] //! Core data structures used by the destructuring planner. diff --git a/src/compiler/destructuring_planner/some_in.rs b/src/compiler/destructuring_planner/some_in.rs index d7eba39..c4b3034 100644 --- a/src/compiler/destructuring_planner/some_in.rs +++ b/src/compiler/destructuring_planner/some_in.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch)] + //! Planner support for `some .. in` expressions. use alloc::collections::BTreeSet; diff --git a/src/compiler/destructuring_planner/utils.rs b/src/compiler/destructuring_planner/utils.rs index 3f1afaa..fcde1d6 100644 --- a/src/compiler/destructuring_planner/utils.rs +++ b/src/compiler/destructuring_planner/utils.rs @@ -1,5 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::redundant_pub_crate, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] //! Shared helper routines for the destructuring planner modules. diff --git a/src/compiler/hoist.rs b/src/compiler/hoist.rs index 8f6e392..233fde9 100644 --- a/src/compiler/hoist.rs +++ b/src/compiler/hoist.rs @@ -1,5 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::arithmetic_side_effects, + clippy::indexing_slicing, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] //! Loop hoisting functionality for compilation. //! @@ -277,6 +283,7 @@ impl HoistedLoopsLookup { self.query_contexts.truncate_modules(module_count); } + #[cfg(debug_assertions)] pub fn module_len(&self) -> usize { self.statement_loops.module_len() } diff --git a/src/engine.rs b/src/engine.rs index c11a212..24bef16 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -1,5 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::missing_const_for_fn, + clippy::semicolon_if_nothing_returned, + clippy::print_stderr, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] use crate::ast::*; use crate::compiled_policy::CompiledPolicy; diff --git a/src/indexchecker.rs b/src/indexchecker.rs index b6ab59e..cf4d51b 100644 --- a/src/indexchecker.rs +++ b/src/indexchecker.rs @@ -1,7 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. - +#![allow( + clippy::panic_in_result_fn, + clippy::arithmetic_side_effects, + clippy::shadow_unrelated, + clippy::unused_self, + clippy::pattern_type_mismatch +)] #![cfg(debug_assertions)] +#![allow(clippy::panic)] // debug-only index checks panic on invariants use crate::ast::*; use alloc::collections::BTreeSet; diff --git a/src/interpreter.rs b/src/interpreter.rs index c800415..5fdcad1 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -1,5 +1,22 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::unwrap_used, + clippy::unimplemented, + clippy::panic_in_result_fn, + clippy::shadow_unrelated, + clippy::missing_const_for_fn, + clippy::semicolon_if_nothing_returned, + clippy::useless_let_if_seq, + clippy::option_if_let_else, + clippy::unused_self, + clippy::print_stderr, + clippy::needless_continue, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] use crate::ast::*; use crate::builtins::{self, BuiltinFcn}; @@ -3432,6 +3449,7 @@ impl Interpreter { } /// Evaluate a default rule and return the resulting value for compiler consumers. + #[cfg(feature = "rvm")] pub fn eval_default_rule_for_compiler(&mut self, rule_path: &str) -> Result { self.input = Value::Undefined; self.data = Value::Undefined; diff --git a/src/interpreter/target/resolve.rs b/src/interpreter/target/resolve.rs index 7389e0d..5970348 100644 --- a/src/interpreter/target/resolve.rs +++ b/src/interpreter/target/resolve.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::indexing_slicing)] use super::super::error::TargetCompileError; #[cfg(feature = "azure_policy")] diff --git a/src/languages/azure_rbac/ast/expr.rs b/src/languages/azure_rbac/ast/expr.rs index 3bc3f03..d979d74 100644 --- a/src/languages/azure_rbac/ast/expr.rs +++ b/src/languages/azure_rbac/ast/expr.rs @@ -1,3 +1,4 @@ +#![allow(clippy::missing_const_for_fn)] // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/src/languages/azure_rbac/ast/operators.rs b/src/languages/azure_rbac/ast/operators.rs index c9a87f1..ef05218 100644 --- a/src/languages/azure_rbac/ast/operators.rs +++ b/src/languages/azure_rbac/ast/operators.rs @@ -1,3 +1,4 @@ +#![allow(clippy::missing_const_for_fn, clippy::pattern_type_mismatch)] // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/src/languages/azure_rbac/parser/condition_parser.rs b/src/languages/azure_rbac/parser/condition_parser.rs index 309828b..61e85e5 100644 --- a/src/languages/azure_rbac/parser/condition_parser.rs +++ b/src/languages/azure_rbac/parser/condition_parser.rs @@ -1,5 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::unused_trait_names)] +#![allow(missing_debug_implementations)] // parser structs are internal; Debug not required use alloc::boxed::Box; use alloc::format; diff --git a/src/languages/azure_rbac/parser/error.rs b/src/languages/azure_rbac/parser/error.rs index ff211e8..1b1ac03 100644 --- a/src/languages/azure_rbac/parser/error.rs +++ b/src/languages/azure_rbac/parser/error.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch)] use alloc::string::String; diff --git a/src/languages/azure_rbac/parser/primary.rs b/src/languages/azure_rbac/parser/primary.rs index c216e28..dc02cbb 100644 --- a/src/languages/azure_rbac/parser/primary.rs +++ b/src/languages/azure_rbac/parser/primary.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::arithmetic_side_effects, clippy::unused_trait_names)] use alloc::format; use alloc::string::{String, ToString}; diff --git a/src/languages/azure_rbac/tests.rs b/src/languages/azure_rbac/tests.rs index 6c52a2a..961cb8e 100644 --- a/src/languages/azure_rbac/tests.rs +++ b/src/languages/azure_rbac/tests.rs @@ -5,6 +5,7 @@ #[cfg(test)] mod condition_tests { + #![allow(clippy::panic, clippy::unwrap_used, clippy::expect_used)] // tests unwrap/expect to assert parse results use crate::languages::azure_rbac::parser::*; use alloc::string::String; use alloc::vec; diff --git a/src/languages/rego/compiler/comprehensions.rs b/src/languages/rego/compiler/comprehensions.rs index cbb3063..5f99647 100644 --- a/src/languages/rego/compiler/comprehensions.rs +++ b/src/languages/rego/compiler/comprehensions.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::as_conversions)] use super::{CompilationContext, Compiler, ComprehensionType, ContextType, Register, Result}; use crate::ast::{ExprRef, Query}; diff --git a/src/languages/rego/compiler/core.rs b/src/languages/rego/compiler/core.rs index 4718d4f..4d97107 100644 --- a/src/languages/rego/compiler/core.rs +++ b/src/languages/rego/compiler/core.rs @@ -1,5 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::arithmetic_side_effects, + clippy::expect_used, + clippy::as_conversions, + clippy::unused_trait_names +)] use super::{CompilationContext, Compiler, CompilerError, Register, Result, Scope}; use crate::ast::ExprRef; diff --git a/src/languages/rego/compiler/destructuring.rs b/src/languages/rego/compiler/destructuring.rs index 83e7162..674878c 100644 --- a/src/languages/rego/compiler/destructuring.rs +++ b/src/languages/rego/compiler/destructuring.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch)] use super::Compiler; use super::Register; use crate::compiler::destructuring_planner::plans::{ diff --git a/src/languages/rego/compiler/error.rs b/src/languages/rego/compiler/error.rs index 26e5297..d413fbe 100644 --- a/src/languages/rego/compiler/error.rs +++ b/src/languages/rego/compiler/error.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch)] use alloc::format; use alloc::string::String; diff --git a/src/languages/rego/compiler/expressions.rs b/src/languages/rego/compiler/expressions.rs index 574b73b..3f39214 100644 --- a/src/languages/rego/compiler/expressions.rs +++ b/src/languages/rego/compiler/expressions.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::unused_trait_names, clippy::pattern_type_mismatch)] mod collection_literals; mod operations; diff --git a/src/languages/rego/compiler/expressions/collection_literals.rs b/src/languages/rego/compiler/expressions/collection_literals.rs index fc34dfa..1ff8871 100644 --- a/src/languages/rego/compiler/expressions/collection_literals.rs +++ b/src/languages/rego/compiler/expressions/collection_literals.rs @@ -1,5 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] use super::{Compiler, Register, Result}; use crate::ast::ExprRef; diff --git a/src/languages/rego/compiler/expressions/operations.rs b/src/languages/rego/compiler/expressions/operations.rs index 1fbd79d..311ed0e 100644 --- a/src/languages/rego/compiler/expressions/operations.rs +++ b/src/languages/rego/compiler/expressions/operations.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch)] use super::{Compiler, CompilerError, Register, Result}; use crate::ast::{ArithOp, BinOp, BoolOp, ExprRef}; diff --git a/src/languages/rego/compiler/function_calls.rs b/src/languages/rego/compiler/function_calls.rs index e3f19df..adc30cd 100644 --- a/src/languages/rego/compiler/function_calls.rs +++ b/src/languages/rego/compiler/function_calls.rs @@ -1,5 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::arithmetic_side_effects, + clippy::indexing_slicing, + clippy::unseparated_literal_suffix, + clippy::as_conversions, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] use super::{Compiler, CompilerError, Register, Result}; use crate::ast::ExprRef; diff --git a/src/languages/rego/compiler/loops.rs b/src/languages/rego/compiler/loops.rs index 4809627..327669c 100644 --- a/src/languages/rego/compiler/loops.rs +++ b/src/languages/rego/compiler/loops.rs @@ -1,5 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::as_conversions, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] use super::{CompilationContext, Compiler, CompilerError, ContextType, Register, Result}; use crate::ast::{self, ExprRef, LiteralStmt, Query}; diff --git a/src/languages/rego/compiler/mod.rs b/src/languages/rego/compiler/mod.rs index cb94918..3faea56 100644 --- a/src/languages/rego/compiler/mod.rs +++ b/src/languages/rego/compiler/mod.rs @@ -1,3 +1,11 @@ +#![allow( + missing_debug_implementations, + clippy::missing_const_for_fn, + clippy::option_if_let_else, + clippy::if_then_some_else_none, + clippy::unused_self +)] // compiler internals do not require Debug + mod comprehensions; mod core; mod destructuring; diff --git a/src/languages/rego/compiler/program.rs b/src/languages/rego/compiler/program.rs index df7654e..5e67182 100644 --- a/src/languages/rego/compiler/program.rs +++ b/src/languages/rego/compiler/program.rs @@ -1,5 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::as_conversions, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] use super::{Compiler, CompilerError, Result}; use crate::interpreter::Interpreter; diff --git a/src/languages/rego/compiler/queries.rs b/src/languages/rego/compiler/queries.rs index c8c3cac..f781b67 100644 --- a/src/languages/rego/compiler/queries.rs +++ b/src/languages/rego/compiler/queries.rs @@ -1,5 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] use super::{Compiler, CompilerError, ComprehensionType, ContextType, Result}; use crate::ast::{self, LiteralStmt, Query}; diff --git a/src/languages/rego/compiler/references.rs b/src/languages/rego/compiler/references.rs index 327db58..3c44b72 100644 --- a/src/languages/rego/compiler/references.rs +++ b/src/languages/rego/compiler/references.rs @@ -1,5 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::expect_used, + clippy::as_conversions, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] use super::{Compiler, CompilerError, Register, Result, WorklistEntry}; use crate::lexer::Span; diff --git a/src/languages/rego/compiler/rules.rs b/src/languages/rego/compiler/rules.rs index 78b296a..dacdc99 100644 --- a/src/languages/rego/compiler/rules.rs +++ b/src/languages/rego/compiler/rules.rs @@ -1,5 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::unwrap_used, + clippy::shadow_unrelated, + clippy::as_conversions, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] use super::{CompilationContext, Compiler, CompilerError, ContextType, Result, WorklistEntry}; use crate::ast::{Expr, Rule, RuleHead}; @@ -105,12 +114,11 @@ impl<'a> Compiler<'a> { } fn find_module_index_for_rule(&self, rule_ref: &crate::ast::NodeRef) -> Result { - let rule_ptr = rule_ref.as_ref() as *const Rule; + let rule = rule_ref.as_ref(); for (module_idx, module) in self.policy.get_modules().iter().enumerate() { for policy_rule in &module.policy { - let policy_rule_ptr = policy_rule.as_ref() as *const Rule; - if policy_rule_ptr == rule_ptr { + if core::ptr::eq(policy_rule.as_ref(), rule) { return Ok(module_idx as u32); } } @@ -126,12 +134,11 @@ impl<'a> Compiler<'a> { ) -> Result<(String, u32)> { if let Some(rule_definitions) = rules.get(rule_path) { if let Some(first_rule_ref) = rule_definitions.first() { - let rule_ptr = first_rule_ref.as_ref() as *const Rule; + let rule = first_rule_ref.as_ref(); for (module_index, module) in self.policy.get_modules().iter().enumerate() { for policy_rule in &module.policy { - let policy_rule_ptr = policy_rule.as_ref() as *const Rule; - if policy_rule_ptr == rule_ptr { + if core::ptr::eq(policy_rule.as_ref(), rule) { let package_path = match get_path_string(&module.package.refr, Some("data")) { Ok(path) => path, diff --git a/src/lexer.rs b/src/lexer.rs index 6b37e78..ecaa98a 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -1,5 +1,17 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::std_instead_of_core, + clippy::arithmetic_side_effects, + clippy::indexing_slicing, + clippy::shadow_unrelated, + clippy::missing_const_for_fn, + clippy::semicolon_if_nothing_returned, + clippy::unseparated_literal_suffix, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] +#![allow(missing_debug_implementations)] // lexer types are internal use crate::*; use core::cmp; diff --git a/src/lib.rs b/src/lib.rs index bc89bec..60e84a8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,104 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +// Unsafe code should not be used. +// Hard to reason about correctness, and maintainability. +#![forbid(unsafe_code)] +// Ensure that all lint names are valid. +#![deny(unknown_lints)] +// Fail-fast lints: correctness, safety, and API surface +#![deny( + // Panic sources - catch all ways code can panic + clippy::panic, // forbid explicit panic! macro + clippy::unreachable, // catches unreachable! macro usage + clippy::todo, // blocks remaining todo! placeholders + clippy::unimplemented, // blocks unimplemented! placeholders + clippy::unwrap_used, // reject Result/Option unwraps + clippy::expect_used, // reject expect with panic messages + clippy::manual_assert, // prefer assert! over manual if/panic + clippy::indexing_slicing, // reject unchecked [] indexing + clippy::arithmetic_side_effects, // reject overflowing/unchecked math + clippy::panic_in_result_fn, // disallow panic inside functions returning Result + + // Rust warnings/upstream + dead_code, // ban unused items + deprecated, // prevent use of deprecated APIs + deprecated_in_future, // catch items scheduled for deprecation + exported_private_dependencies, // avoid leaking private deps in public API + future_incompatible, // catch patterns slated to break + invalid_doc_attributes, // ensure doc attributes are valid + keyword_idents, // disallow identifiers that are keywords + macro_use_extern_crate, // block legacy macro_use extern crate + missing_debug_implementations, // require Debug on public types + // TODO: Address in future pass + // missing_docs, // require docs on public items + non_ascii_idents, // disallow non-ASCII identifiers + nonstandard_style, // enforce idiomatic naming/style + noop_method_call, // catch no-op method calls + trivial_bounds, // forbid useless trait bounds + trivial_casts, // block needless casts + unreachable_code, // catch dead/unreachable code + unreachable_patterns, // catch unreachable match arms + // TODO: Address in future pass + // unreachable_pub, + unused_extern_crates, // remove unused extern crate declarations + unused_import_braces, // avoid unused braces in imports + absolute_paths_not_starting_with_crate, // enforce crate:: prefix for absolute paths + + // Unsafe code / low-level hazards + clippy::unseparated_literal_suffix, // enforce underscore before literal suffixes + clippy::print_stderr, // discourage printing to stderr + clippy::use_debug, // discourage Debug formatting in display contexts + + // Documentation & diagnostics + // TODO: Address in future pass + // clippy::doc_link_with_quotes, // avoid quoted intra-doc links + // clippy::doc_markdown, // flag bad Markdown in docs + // clippy::missing_docs_in_private_items, // require docs on private items + // clippy::missing_errors_doc, // require docs for error cases + + // API correctness / style + clippy::missing_const_for_fn, // suggest const fn where possible + clippy::option_if_let_else, // prefer map_or/unwrap_or_else over if/let + clippy::if_then_some_else_none, // prefer Option combinators over if/else + clippy::semicolon_if_nothing_returned, // enforce trailing semicolon for unit + clippy::unused_self, // remove unused self parameters + clippy::used_underscore_binding, // avoid using bindings prefixed with _ + clippy::useless_let_if_seq, // simplify let-if sequences + clippy::similar_names, // flag confusingly similar identifiers + clippy::shadow_unrelated, // discourage shadowing unrelated variables + clippy::redundant_pub_crate, // avoid pub(crate) on already pub items + clippy::wildcard_dependencies, // disallow wildcard Cargo dependency versions + // TODO: Address in future pass + // clippy::wildcard_imports, // discourage glob imports + + // Numeric correctness + // TODO: Address in future pass + clippy::float_cmp, // avoid exact float equality checks + clippy::float_cmp_const, // avoid comparing floats to consts directly + clippy::float_equality_without_abs, // require tolerance in float equality + clippy::suspicious_operation_groupings, // catch ambiguous operator precedence + + // no_std hygiene + clippy::std_instead_of_core, // prefer core/alloc over std in no_std + + // Misc polish + clippy::dbg_macro, // forbid dbg! in production code + clippy::debug_assert_with_mut_call, // avoid mutating inside debug_assert + clippy::empty_line_after_outer_attr, // enforce spacing after outer attrs + clippy::empty_structs_with_brackets, // use unit structs without braces +)] +// Advisory lints: useful, but not fatal +#![warn( + clippy::assertions_on_result_states, // avoid asserts on Result state + clippy::match_like_matches_macro, // prefer matches! macro over verbose match + clippy::needless_continue, // remove redundant continue statements + clippy::unused_trait_names, // drop unused trait imports + clippy::verbose_file_reads, // prefer concise file read helpers + clippy::as_conversions, // discourage lossy as casts + clippy::pattern_type_mismatch, // catch mismatched types in patterns +)] #![cfg_attr(docsrs, feature(doc_cfg))] -#![allow(unknown_lints)] -#![allow(clippy::doc_lazy_continuation)] // Use README.md as crate documentation. #![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/README.md"))] // We'll default to building for no_std - use core, alloc instead of std. @@ -86,10 +181,10 @@ use std::collections::{hash_map::Entry as MapEntry, HashMap as Map, HashSet as S use alloc::collections::{btree_map::Entry as MapEntry, BTreeMap as Map, BTreeSet as Set}; use alloc::{ - borrow::ToOwned, + borrow::ToOwned as _, boxed::Box, format, - string::{String, ToString}, + string::{String, ToString as _}, vec, vec::Vec, }; @@ -414,6 +509,7 @@ impl fmt::Debug for dyn Extension { pub mod coverage { use crate::*; + #[allow(missing_debug_implementations)] #[derive(Default, serde::Serialize, serde::Deserialize)] /// Coverage information about a rego policy file. pub struct File { @@ -430,6 +526,7 @@ pub mod coverage { pub not_covered: alloc::collections::BTreeSet, } + #[allow(missing_debug_implementations)] #[derive(Default, serde::Serialize, serde::Deserialize)] /// Policy coverage report. pub struct Report { @@ -444,6 +541,7 @@ pub mod coverage { /// Lines that are not covered are red. /// /// + #[allow(clippy::arithmetic_side_effects)] pub fn to_string_pretty(&self) -> anyhow::Result { let mut s = String::default(); s.push_str("COVERAGE REPORT:\n"); @@ -454,8 +552,8 @@ pub mod coverage { } s.push_str(&format!("{}:\n", file.path)); - for (line, code) in file.code.split('\n').enumerate() { - let line = line as u32 + 1; + for (line_idx, code) in file.code.split('\n').enumerate() { + let line = u32::try_from(line_idx + 1).unwrap_or(u32::MAX); if file.not_covered.contains(&line) { s.push_str(&format!("\x1b[31m {line:4} {code}\x1b[0m\n")); } else if file.covered.contains(&line) { diff --git a/src/lookup.rs b/src/lookup.rs index 0cdafef..aad6430 100644 --- a/src/lookup.rs +++ b/src/lookup.rs @@ -1,5 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::std_instead_of_core, + clippy::arithmetic_side_effects, + clippy::indexing_slicing, + clippy::missing_const_for_fn, + clippy::if_then_some_else_none, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] //! Lookup table for associating data structures with AST nodes. //! diff --git a/src/number.rs b/src/number.rs index 459d062..cfdde84 100644 --- a/src/number.rs +++ b/src/number.rs @@ -1,5 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::arithmetic_side_effects, + clippy::float_cmp, + clippy::unwrap_used, + clippy::unreachable, + clippy::option_if_let_else, + clippy::unseparated_literal_suffix, + clippy::as_conversions, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] use alloc::format; use alloc::string::{String, ToString}; diff --git a/src/parser.rs b/src/parser.rs index a898e0c..87f4fa9 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1,5 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::arithmetic_side_effects, + clippy::indexing_slicing, + clippy::shadow_unrelated, + clippy::missing_const_for_fn, + clippy::semicolon_if_nothing_returned, + clippy::unused_self, + clippy::print_stderr, + clippy::as_conversions, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] +#![allow(missing_debug_implementations)] // parser types are internal use crate::ast::*; use crate::lexer::*; diff --git a/src/policy_info.rs b/src/policy_info.rs index 301307d..743e491 100644 --- a/src/policy_info.rs +++ b/src/policy_info.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(missing_debug_implementations)] // policy info structs used for serialization only + #[cfg(feature = "azure_policy")] use crate::engine::PolicyParameters; use crate::*; diff --git a/src/query/traversal.rs b/src/query/traversal.rs index 56d42a6..d67c0dc 100644 --- a/src/query/traversal.rs +++ b/src/query/traversal.rs @@ -1,3 +1,8 @@ +#![allow( + clippy::if_then_some_else_none, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/src/registry.rs b/src/registry.rs index 993890d..019d9a1 100644 --- a/src/registry.rs +++ b/src/registry.rs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(missing_debug_implementations, clippy::pattern_type_mismatch)] // registry internals are not debug logged #![allow(dead_code)] use crate::*; use core::fmt; diff --git a/src/registry/tests/core.rs b/src/registry/tests/core.rs index 9590019..d16798e 100644 --- a/src/registry/tests/core.rs +++ b/src/registry/tests/core.rs @@ -1,6 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::panic, + clippy::unwrap_used, + clippy::expect_used, + clippy::shadow_unrelated, + clippy::assertions_on_result_states +)] // registry tests unwrap/panic to assert outcomes + use super::super::registry::*; use crate::{schema::Schema, *}; use serde_json::json; diff --git a/src/registry/tests/effect.rs b/src/registry/tests/effect.rs index a7da06f..b64716f 100644 --- a/src/registry/tests/effect.rs +++ b/src/registry/tests/effect.rs @@ -1,6 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::panic, + clippy::unwrap_used, + clippy::unreachable, + clippy::indexing_slicing, + clippy::assertions_on_result_states, + clippy::pattern_type_mismatch +)] // registry effect tests unwrap/panic for invariant checks + use super::super::registry::*; use crate::{ registry::{instances::EFFECT_SCHEMA_REGISTRY, schemas::effect}, diff --git a/src/registry/tests/resource.rs b/src/registry/tests/resource.rs index 2c42829..b85e73e 100644 --- a/src/registry/tests/resource.rs +++ b/src/registry/tests/resource.rs @@ -1,6 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::panic, + clippy::unwrap_used, + clippy::unreachable, + clippy::indexing_slicing, + clippy::assertions_on_result_states, + clippy::pattern_type_mismatch +)] // registry resource tests unwrap/panic for fixture setup + use super::super::registry::*; use crate::{ registry::{instances::RESOURCE_SCHEMA_REGISTRY, schemas::resource}, diff --git a/src/registry/tests/target.rs b/src/registry/tests/target.rs index 3024a2e..439ba9a 100644 --- a/src/registry/tests/target.rs +++ b/src/registry/tests/target.rs @@ -1,6 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::panic, + clippy::unwrap_used, + clippy::indexing_slicing, + clippy::unreachable, + clippy::assertions_on_result_states, + clippy::pattern_type_mismatch +)] // registry target tests unwrap/panic for expectations + use super::super::registry::*; use crate::{ registry::{instances::TARGET_REGISTRY, targets}, diff --git a/src/rvm/instructions/display.rs b/src/rvm/instructions/display.rs index e22de52..f025775 100644 --- a/src/rvm/instructions/display.rs +++ b/src/rvm/instructions/display.rs @@ -1,3 +1,8 @@ +#![allow( + clippy::option_if_let_else, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/src/rvm/instructions/mod.rs b/src/rvm/instructions/mod.rs index 792c80f..4829038 100644 --- a/src/rvm/instructions/mod.rs +++ b/src/rvm/instructions/mod.rs @@ -1,3 +1,4 @@ +#![allow(clippy::missing_const_for_fn)] // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/src/rvm/instructions/params.rs b/src/rvm/instructions/params.rs index 216996b..b14d44c 100644 --- a/src/rvm/instructions/params.rs +++ b/src/rvm/instructions/params.rs @@ -1,5 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::missing_const_for_fn, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] use alloc::vec::Vec; use serde::{Deserialize, Serialize}; diff --git a/src/rvm/program/core.rs b/src/rvm/program/core.rs index 80544c3..c00a120e 100644 --- a/src/rvm/program/core.rs +++ b/src/rvm/program/core.rs @@ -1,3 +1,8 @@ +#![allow( + clippy::missing_const_for_fn, + clippy::as_conversions, + clippy::unused_trait_names +)] // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/src/rvm/program/listing.rs b/src/rvm/program/listing.rs index e48c73e..2307eba 100644 --- a/src/rvm/program/listing.rs +++ b/src/rvm/program/listing.rs @@ -1,5 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::unwrap_used, + clippy::arithmetic_side_effects, + clippy::indexing_slicing, + clippy::option_if_let_else, + clippy::missing_const_for_fn, + clippy::as_conversions, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] use alloc::format; use alloc::string::{String, ToString}; diff --git a/src/rvm/program/recompile.rs b/src/rvm/program/recompile.rs index 5042b6d..bee7f36 100644 --- a/src/rvm/program/recompile.rs +++ b/src/rvm/program/recompile.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::unused_trait_names)] use super::Program; use alloc::string::{String, ToString}; diff --git a/src/rvm/program/rule_tree.rs b/src/rvm/program/rule_tree.rs index 4b12656..3f25a00 100644 --- a/src/rvm/program/rule_tree.rs +++ b/src/rvm/program/rule_tree.rs @@ -1,5 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::arithmetic_side_effects, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] use alloc::format; use alloc::string::{String, ToString}; diff --git a/src/rvm/program/serialization/binary.rs b/src/rvm/program/serialization/binary.rs index 1f40906..7410679 100644 --- a/src/rvm/program/serialization/binary.rs +++ b/src/rvm/program/serialization/binary.rs @@ -1,5 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::as_conversions, + clippy::unused_trait_names +)] use alloc::format; use alloc::string::{String, ToString}; diff --git a/src/rvm/program/serialization/json.rs b/src/rvm/program/serialization/json.rs index 97063fe..005e4d7 100644 --- a/src/rvm/program/serialization/json.rs +++ b/src/rvm/program/serialization/json.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::as_conversions, clippy::unused_trait_names)] + use alloc::format; use alloc::string::{String, ToString}; use alloc::vec::Vec; diff --git a/src/rvm/program/serialization/mod.rs b/src/rvm/program/serialization/mod.rs index b74066a..f8c4406 100644 --- a/src/rvm/program/serialization/mod.rs +++ b/src/rvm/program/serialization/mod.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::redundant_pub_crate)] pub(crate) mod binary; mod json; diff --git a/src/rvm/program/serialization/value.rs b/src/rvm/program/serialization/value.rs index 96fd37d..e1abc2a 100644 --- a/src/rvm/program/serialization/value.rs +++ b/src/rvm/program/serialization/value.rs @@ -1,5 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::redundant_pub_crate, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] use alloc::collections::{BTreeMap, BTreeSet}; use alloc::format; diff --git a/src/rvm/program/types.rs b/src/rvm/program/types.rs index 966c31d..390360b 100644 --- a/src/rvm/program/types.rs +++ b/src/rvm/program/types.rs @@ -1,6 +1,11 @@ +#![allow(clippy::missing_const_for_fn)] // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. - +#![allow( + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::as_conversions +)] use alloc::string::String; use alloc::vec::Vec; use serde::{Deserialize, Serialize}; diff --git a/src/rvm/tests/instruction_parser.rs b/src/rvm/tests/instruction_parser.rs index 780e3dd..788c5f1 100644 --- a/src/rvm/tests/instruction_parser.rs +++ b/src/rvm/tests/instruction_parser.rs @@ -1,6 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::unwrap_used, + clippy::arithmetic_side_effects, + clippy::option_if_let_else, + clippy::unused_trait_names, + clippy::pattern_type_mismatch +)] // tests unwrap conversions and slice math for brevity + use crate::rvm::instructions::{Instruction, LoopMode}; use alloc::string::{String, ToString}; use alloc::vec::Vec; diff --git a/src/rvm/tests/test_utils.rs b/src/rvm/tests/test_utils.rs index c86e6e4..0049fe5 100644 --- a/src/rvm/tests/test_utils.rs +++ b/src/rvm/tests/test_utils.rs @@ -1,5 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::shadow_unrelated, + clippy::as_conversions +)] //! Test utility functions for RVM serialization diff --git a/src/rvm/tests/vm.rs b/src/rvm/tests/vm.rs index 3cb54b2..aca0de7 100644 --- a/src/rvm/tests/vm.rs +++ b/src/rvm/tests/vm.rs @@ -1,6 +1,21 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::panic, + clippy::panic_in_result_fn, + clippy::unwrap_used, + clippy::manual_assert, + clippy::indexing_slicing, + clippy::option_if_let_else, + clippy::semicolon_if_nothing_returned, + clippy::unseparated_literal_suffix, + clippy::use_debug, + clippy::unused_trait_names, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] // VM tests assert/unwrap and use manual panics to validate scenarios + #[cfg(test)] mod tests { use crate::rvm::tests::instruction_parser::{parse_instruction, parse_loop_mode}; diff --git a/src/rvm/vm/arithmetic.rs b/src/rvm/vm/arithmetic.rs index 6be5251..7dbc773 100644 --- a/src/rvm/vm/arithmetic.rs +++ b/src/rvm/vm/arithmetic.rs @@ -1,3 +1,9 @@ +#![allow( + clippy::unused_self, + clippy::missing_const_for_fn, + clippy::unseparated_literal_suffix, + clippy::pattern_type_mismatch +)] // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/src/rvm/vm/comprehension.rs b/src/rvm/vm/comprehension.rs index acaf6b7..2db4ea0 100644 --- a/src/rvm/vm/comprehension.rs +++ b/src/rvm/vm/comprehension.rs @@ -1,5 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::option_if_let_else, + clippy::useless_let_if_seq, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] use crate::rvm::instructions::{ComprehensionBeginParams, ComprehensionMode}; use crate::value::Value; diff --git a/src/rvm/vm/context.rs b/src/rvm/vm/context.rs index f03fbec..302413d 100644 --- a/src/rvm/vm/context.rs +++ b/src/rvm/vm/context.rs @@ -1,5 +1,10 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::arithmetic_side_effects, + clippy::missing_const_for_fn, + clippy::pattern_type_mismatch +)] use crate::rvm::instructions::{ComprehensionMode, LoopMode}; use crate::value::Value; diff --git a/src/rvm/vm/dispatch.rs b/src/rvm/vm/dispatch.rs index 82aae74..b4916d1 100644 --- a/src/rvm/vm/dispatch.rs +++ b/src/rvm/vm/dispatch.rs @@ -1,5 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::used_underscore_binding, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] use crate::rvm::instructions::{Instruction, LiteralOrRegister}; use crate::rvm::program::Program; diff --git a/src/rvm/vm/execution.rs b/src/rvm/vm/execution.rs index d6b95eb..cbe63b3 100644 --- a/src/rvm/vm/execution.rs +++ b/src/rvm/vm/execution.rs @@ -1,5 +1,14 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::expect_used, + clippy::option_if_let_else, + clippy::as_conversions, + clippy::needless_continue, + clippy::pattern_type_mismatch +)] use crate::rvm::instructions::Instruction; use crate::rvm::program::Program; use crate::value::Value; diff --git a/src/rvm/vm/execution_model.rs b/src/rvm/vm/execution_model.rs index 2400a76..c581d25 100644 --- a/src/rvm/vm/execution_model.rs +++ b/src/rvm/vm/execution_model.rs @@ -1,3 +1,4 @@ +#![allow(clippy::missing_const_for_fn)] // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. diff --git a/src/rvm/vm/functions.rs b/src/rvm/vm/functions.rs index 9bd0beb..31c8f66 100644 --- a/src/rvm/vm/functions.rs +++ b/src/rvm/vm/functions.rs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::indexing_slicing, clippy::as_conversions)] use crate::builtins; use crate::value::Value; use alloc::string::String; diff --git a/src/rvm/vm/loops.rs b/src/rvm/vm/loops.rs index 422ab86..e32cff9 100644 --- a/src/rvm/vm/loops.rs +++ b/src/rvm/vm/loops.rs @@ -1,6 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::expect_used, + clippy::arithmetic_side_effects, + clippy::unwrap_used, + clippy::shadow_unrelated, + clippy::missing_const_for_fn, + clippy::unused_self, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] // VM loop handling indexes directly for performance and clarity + use crate::rvm::instructions::LoopMode; use crate::value::Value; diff --git a/src/rvm/vm/machine.rs b/src/rvm/vm/machine.rs index b7ecbb2..9b0d396 100644 --- a/src/rvm/vm/machine.rs +++ b/src/rvm/vm/machine.rs @@ -1,6 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + missing_debug_implementations, + clippy::missing_const_for_fn, + clippy::pattern_type_mismatch +)] // VM structs are not debug printed + use crate::rvm::program::Program; use crate::value::Value; use crate::CompiledPolicy; diff --git a/src/rvm/vm/mod.rs b/src/rvm/vm/mod.rs index 695f920..f7a366b 100644 --- a/src/rvm/vm/mod.rs +++ b/src/rvm/vm/mod.rs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -extern crate alloc; - mod arithmetic; mod comprehension; mod context; diff --git a/src/rvm/vm/rules.rs b/src/rvm/vm/rules.rs index a479842..7394c1a 100644 --- a/src/rvm/vm/rules.rs +++ b/src/rvm/vm/rules.rs @@ -1,6 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::expect_used, + clippy::shadow_unrelated, + clippy::unused_self, + clippy::semicolon_if_nothing_returned, + clippy::missing_const_for_fn, + clippy::as_conversions, + clippy::needless_continue, + clippy::pattern_type_mismatch +)] // VM rule execution indexes directly and uses expect for invariant checks + use crate::rvm::instructions::FunctionCallParams; use crate::rvm::program::{RuleInfo, RuleType}; use crate::value::Value; diff --git a/src/rvm/vm/virtual_data.rs b/src/rvm/vm/virtual_data.rs index 9803ad8..ba289c8 100644 --- a/src/rvm/vm/virtual_data.rs +++ b/src/rvm/vm/virtual_data.rs @@ -1,6 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::unwrap_used, + clippy::unused_self, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] // virtual data paths index directly for speed; unwraps assert invariants + use crate::rvm::instructions::LiteralOrRegister; use crate::value::Value; use alloc::vec::Vec; diff --git a/src/scheduler.rs b/src/scheduler.rs index c4722df..1d7316c 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -1,6 +1,20 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::unwrap_used, + clippy::shadow_unrelated, + clippy::unused_self, + clippy::option_if_let_else, + clippy::semicolon_if_nothing_returned, + clippy::print_stderr, + clippy::use_debug, + clippy::as_conversions, + clippy::pattern_type_mismatch +)] // scheduler logic indexes arrays and unwraps queues intentionally + use crate::ast::Expr::*; use crate::ast::*; use crate::lexer::*; diff --git a/src/schema.rs b/src/schema.rs index bfa7886..5d945a0 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch)] + /// There are two type systems of interest: /// 1. JSON Schema used by Azure Policy for some of its metadata. /// 2. Bicep's type system generated from Azure API swagger files. diff --git a/src/schema/error.rs b/src/schema/error.rs index b092db9..b17ff9c 100644 --- a/src/schema/error.rs +++ b/src/schema/error.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::use_debug, clippy::pattern_type_mismatch)] + use crate::*; type String = Rc; diff --git a/src/schema/meta.rs b/src/schema/meta.rs index 7443583..8c66222 100644 --- a/src/schema/meta.rs +++ b/src/schema/meta.rs @@ -1,6 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::expect_used, + clippy::missing_const_for_fn, + clippy::option_if_let_else +)] // meta schema loader expects static resources #![allow(dead_code)] use crate::*; use lazy_static::lazy_static; diff --git a/src/schema/meta/tests.rs b/src/schema/meta/tests.rs index 8ac23d8..2b0230d 100644 --- a/src/schema/meta/tests.rs +++ b/src/schema/meta/tests.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::unwrap_used, clippy::assertions_on_result_states)] // meta-schema tests unwrap errors to assert failures + use super::*; use serde_json::json; diff --git a/src/schema/tests/azure.rs b/src/schema/tests/azure.rs index 023f57a..c1fe5f5 100644 --- a/src/schema/tests/azure.rs +++ b/src/schema/tests/azure.rs @@ -1,6 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::panic, + clippy::unwrap_used, + clippy::expect_used, + clippy::pattern_type_mismatch +)] // azure schema tests panic/unwrap to assert structures + use super::super::*; #[test] diff --git a/src/schema/tests/suite.rs b/src/schema/tests/suite.rs index 0bec536..40cc551 100644 --- a/src/schema/tests/suite.rs +++ b/src/schema/tests/suite.rs @@ -1,6 +1,18 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::panic, + clippy::unwrap_used, + clippy::expect_used, + clippy::indexing_slicing, + clippy::shadow_unrelated, + clippy::semicolon_if_nothing_returned, + clippy::pattern_type_mismatch, + clippy::assertions_on_result_states, + clippy::as_conversions +)] // schema suite tests panic/unwrap to assert specific error shapes + use super::super::*; use crate::{format, vec}; use serde_json::json; diff --git a/src/schema/tests/validate/effect.rs b/src/schema/tests/validate/effect.rs index c6bb4b8..0557774 100644 --- a/src/schema/tests/validate/effect.rs +++ b/src/schema/tests/validate/effect.rs @@ -1,6 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::unwrap_used, + clippy::panic, + clippy::pattern_type_mismatch, + clippy::assertions_on_result_states +)] // test cases assert failures via unwrap/expect panic paths and pattern matching + use crate::{ schema::{error::ValidationError, validate::SchemaValidator, Schema}, *, diff --git a/src/schema/tests/validate/resource.rs b/src/schema/tests/validate/resource.rs index 3f54e5d..97535e9 100644 --- a/src/schema/tests/validate/resource.rs +++ b/src/schema/tests/validate/resource.rs @@ -1,6 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + clippy::shadow_unrelated, + clippy::pattern_type_mismatch, + clippy::assertions_on_result_states, + clippy::as_conversions +)] // test cases use unwrap/expect and panic to assert error flows + use crate::{ schema::{error::ValidationError, validate::SchemaValidator, Schema}, *, diff --git a/src/schema/validate.rs b/src/schema/validate.rs index 1e56e8e..9f3391c 100644 --- a/src/schema/validate.rs +++ b/src/schema/validate.rs @@ -1,7 +1,9 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(missing_debug_implementations)] // validator is zero-sized marker #![allow(dead_code)] +#![allow(clippy::pattern_type_mismatch, clippy::needless_continue)] use crate::{ schema::{error::ValidationError, Schema, Type}, diff --git a/src/target/deserialize.rs b/src/target/deserialize.rs index 58b3040..4d0ecdb 100644 --- a/src/target/deserialize.rs +++ b/src/target/deserialize.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::unused_trait_names)] + use crate::registry::instances::{EFFECT_SCHEMA_REGISTRY, RESOURCE_SCHEMA_REGISTRY}; use crate::{format, Rc, Schema, Vec}; use alloc::collections::BTreeMap; diff --git a/src/target/resource_schema_selector.rs b/src/target/resource_schema_selector.rs index d0a81d5..0fb8554 100644 --- a/src/target/resource_schema_selector.rs +++ b/src/target/resource_schema_selector.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::option_if_let_else, clippy::pattern_type_mismatch)] + use crate::schema::Type; use crate::{format, Rc, Schema, Value}; use alloc::collections::BTreeMap; diff --git a/src/target/tests/deserialize.rs b/src/target/tests/deserialize.rs index bc31bd8..6e40902 100644 --- a/src/target/tests/deserialize.rs +++ b/src/target/tests/deserialize.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::unwrap_used, clippy::unused_trait_names)] // tests unwrap intentional failures and import ToString anonymously + use super::super::*; use crate::Value; use alloc::string::ToString; diff --git a/src/test_utils.rs b/src/test_utils.rs index f408e35..34c465f 100644 --- a/src/test_utils.rs +++ b/src/test_utils.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::pattern_type_mismatch, clippy::unused_trait_names)] + //! Shared helpers for YAML-driven integration tests. use crate::Value; diff --git a/src/tests/interpreter/mod.rs b/src/tests/interpreter/mod.rs index bce2157..6c93f8a 100644 --- a/src/tests/interpreter/mod.rs +++ b/src/tests/interpreter/mod.rs @@ -1,6 +1,17 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::panic, + clippy::panic_in_result_fn, + clippy::unwrap_used, + clippy::expect_used, + clippy::indexing_slicing, + clippy::semicolon_if_nothing_returned, + clippy::pattern_type_mismatch, + clippy::print_stderr +)] // test harness asserts and unwraps to validate interpreter behavior + use std::env; use crate::test_utils::{check_output, ValueOrVec}; diff --git a/src/tests/scheduler/analyzer/mod.rs b/src/tests/scheduler/analyzer/mod.rs index 90aa009..7361400 100644 --- a/src/tests/scheduler/analyzer/mod.rs +++ b/src/tests/scheduler/analyzer/mod.rs @@ -1,6 +1,17 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::panic, + clippy::panic_in_result_fn, + clippy::unwrap_used, + clippy::indexing_slicing, + clippy::std_instead_of_core, + clippy::semicolon_if_nothing_returned, + clippy::pattern_type_mismatch, + clippy::as_conversions +)] // scheduler analyzer tests rely on asserts/unwraps and std conveniences + use crate::*; use crate::{ast::*, lexer::*, parser::*, scheduler::*}; use anyhow::{anyhow, bail, Result}; diff --git a/src/tests/scheduler/mod.rs b/src/tests/scheduler/mod.rs index 1dece4b..a3f87e0 100644 --- a/src/tests/scheduler/mod.rs +++ b/src/tests/scheduler/mod.rs @@ -1,6 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::panic_in_result_fn, + clippy::indexing_slicing, + clippy::as_conversions +)] // scheduler tests assert and index directly for clarity + use crate::scheduler::*; use crate::*; use anyhow::{bail, Result}; diff --git a/src/utils.rs b/src/utils.rs index e0ca2d5..acd6f8d 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,6 +1,13 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::arithmetic_side_effects, + clippy::shadow_unrelated, + clippy::pattern_type_mismatch, + clippy::as_conversions +)] // small arithmetic checks are intentional + use crate::ast::*; use crate::builtins::*; use crate::lexer::*; diff --git a/src/value.rs b/src/value.rs index ad72e50..578deee 100644 --- a/src/value.rs +++ b/src/value.rs @@ -1,6 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow( + clippy::indexing_slicing, + clippy::shadow_unrelated, + clippy::option_if_let_else, + clippy::semicolon_if_nothing_returned, + clippy::pattern_type_mismatch, + clippy::unused_trait_names, + clippy::as_conversions +)] // value helpers index paths directly for performance + use crate::number::Number; use alloc::collections::{BTreeMap, BTreeSet};