From 863d9f3e1119a0258128400e92ee901f69d2810b Mon Sep 17 00:00:00 2001 From: Mehul Mathur Date: Sun, 20 Oct 2024 00:46:24 +0530 Subject: [PATCH] refactor: enable `clippy::pedantic` lint group (#282) # Rationale for this change We have cargo clippy running in our CI in order to enforce code quality. In order to increase our standards, we should enable the clippy::pedantic lint group. # What changes are included in this PR? This PR adds pedantic lint check to the toml file, replacing the existing individual lint checks that are part of pedantic group. # Are these changes tested? Yes. --- .github/workflows/lint-and-test.yml | 2 - Cargo.toml | 46 +------------------ .../src/proof_primitive/dory/pack_scalars.rs | 2 +- 3 files changed, 3 insertions(+), 47 deletions(-) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index ad8becb68..37f915241 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -141,8 +141,6 @@ jobs: run: export DEBIAN_FRONTEND=non-interactive && sudo apt-get update && sudo apt-get install -y clang lld - name: Run clippy run: cargo clippy --all-targets --all-features -- -D warnings - - name: Run clippy::pedantic for proof-of-sql-parser - run: cargo clippy --lib -p proof-of-sql-parser -- -D clippy::pedantic coverage: name: Code Coverage diff --git a/Cargo.toml b/Cargo.toml index 6bfa5468f..c1f8ad763 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,47 +65,5 @@ zerocopy = { version = "0.7.34" } missing_docs = "warn" [workspace.lints.clippy] -missing_panics_doc = "deny" -doc_markdown = "deny" -match_same_arms = "deny" -similar_names = "deny" -many_single_char_names = "deny" -explicit_iter_loop = "deny" -implicit_clone = "deny" -uninlined_format_args = "deny" -semicolon_if_nothing_returned = "deny" -unnested_or_patterns = "deny" -unreadable_literal = "deny" -must_use_candidate = "deny" -range_plus_one = "deny" -cloned_instead_of_copied = "deny" -from_iter_instead_of_collect = "deny" -cast_lossless = "deny" -redundant_closure_for_method_calls = "deny" -inconsistent_struct_constructor = "deny" -default_trait_access = "deny" -module_name_repetitions = "deny" -wildcard_imports = "deny" -unused_self = "deny" -manual_let_else = "deny" -struct_field_names = "deny" -unicode_not_nfc = "deny" -manual_string_new = "deny" -large_types_passed_by_value = "deny" -map_unwrap_or = "deny" -if_not_else = "deny" -explicit_deref_methods = "deny" -items_after_statements = "deny" -bool_to_int_with_if = "deny" -ptr_as_ptr = "deny" -match_wildcard_for_single_variants = "deny" -match_bool = "deny" -manual_assert = "deny" -trivially_copy_pass_by_ref = "deny" -unnecessary_wraps = "deny" -should_panic_without_expect = "deny" -needless_pass_by_value = "deny" -too_many_lines = "deny" -cast_possible_wrap = "deny" -cast_sign_loss = "deny" -cast_possible_truncation = "deny" +missing_errors_doc = "allow" +pedantic = { level = "warn", priority = -1 } diff --git a/crates/proof-of-sql/src/proof_primitive/dory/pack_scalars.rs b/crates/proof-of-sql/src/proof_primitive/dory/pack_scalars.rs index 1be1b836a..a62c5c67b 100644 --- a/crates/proof-of-sql/src/proof_primitive/dory/pack_scalars.rs +++ b/crates/proof-of-sql/src/proof_primitive/dory/pack_scalars.rs @@ -326,7 +326,7 @@ pub fn bit_table_and_scalars_for_packed_msm( // Add offsets to handle signed values to the bit table. bit_table.extend( - iter::repeat(u32::try_from(BYTE_SIZE).unwrap_or(u32::MAX)) + iter::repeat(u32::try_from(BYTE_SIZE).expect("BYTE_SIZE fits in u32")) .take(OFFSET_SIZE + committable_columns.len()), ); let bit_table_full_sum_in_bytes = bit_table.iter().sum::() as usize / BYTE_SIZE;