chore: Add clippy lints (#529)

Lints are added (deny) at crate level.

In each offending file, the failing lints are explicitly allowed.
Each file will be fixed in subsequent PRs.

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2025-12-23 15:59:34 -06:00
committed by GitHub
parent 604591a0f7
commit 249dcd0b43
121 changed files with 703 additions and 23 deletions
+5
View File
@@ -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.
+1
View File
@@ -1,3 +1,4 @@
#![allow(clippy::missing_const_for_fn)]
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
+7
View File
@@ -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};
+5
View File
@@ -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.
+10
View File
@@ -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};
+1
View File
@@ -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};
+5
View File
@@ -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};
+6
View File
@@ -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};
+2
View File
@@ -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;
+1
View File
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#![allow(clippy::redundant_pub_crate)]
pub(crate) mod binary;
mod json;
+5
View File
@@ -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;
+6 -1
View File
@@ -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};
+8
View File
@@ -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;
+6
View File
@@ -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
+15
View File
@@ -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};
+6
View File
@@ -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.
+8
View File
@@ -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;
+5
View File
@@ -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;
+7
View File
@@ -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;
+9
View File
@@ -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;
+1
View File
@@ -1,3 +1,4 @@
#![allow(clippy::missing_const_for_fn)]
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
+1
View File
@@ -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;
+12
View File
@@ -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;
+6
View File
@@ -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;
-2
View File
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
extern crate alloc;
mod arithmetic;
mod comprehension;
mod context;
+13
View File
@@ -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;
+9
View File
@@ -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;