From b59c0a78282b284a53d4bd1acbfc031b54f9c12d Mon Sep 17 00:00:00 2001 From: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com> Date: Sun, 19 Jan 2025 20:36:28 -0500 Subject: [PATCH] wip clippy issues --- compatibility/src/sdk/v7_libra_framework_sdk_builder.rs | 6 +++--- compatibility/src/version_five/hash_value_v5.rs | 2 +- compatibility/src/version_five/state_snapshot_v5.rs | 4 +--- compatibility/src/version_five/transaction_manifest_v5.rs | 7 +++---- .../cached-packages/src/libra_framework_sdk_builder.rs | 2 +- .../src/builder/framework_generate_upgrade_proposal.rs | 1 - types/src/core_types/app_cfg.rs | 1 - 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/compatibility/src/sdk/v7_libra_framework_sdk_builder.rs b/compatibility/src/sdk/v7_libra_framework_sdk_builder.rs index 7d7258282..cd0b61d1c 100644 --- a/compatibility/src/sdk/v7_libra_framework_sdk_builder.rs +++ b/compatibility/src/sdk/v7_libra_framework_sdk_builder.rs @@ -19,7 +19,7 @@ #![allow(dead_code)] #![allow(unused_imports)] -#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_arguments, clippy::doc_lazy_continuation)] use diem_types::{ account_address::AccountAddress, transaction::{EntryFunction, TransactionPayload}, @@ -44,8 +44,8 @@ type Bytes = Vec; // explorer and data warehouse //////// end //////// #[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize)] -#[cfg_attr(feature = "fuzzing", derive(proptest_derive::Arbitrary))] -#[cfg_attr(feature = "fuzzing", proptest(no_params))] +// #[cfg_attr(feature = "fuzzing", derive(proptest_derive::Arbitrary))] +// #[cfg_attr(feature = "fuzzing", proptest(no_params))] pub enum EntryFunctionCall { /// Offers rotation capability on behalf of `account` to the account at address `recipient_address`. /// An account can delegate its rotation capability to only one other address at one time. If the account diff --git a/compatibility/src/version_five/hash_value_v5.rs b/compatibility/src/version_five/hash_value_v5.rs index 778163b5b..f7b8026dd 100644 --- a/compatibility/src/version_five/hash_value_v5.rs +++ b/compatibility/src/version_five/hash_value_v5.rs @@ -264,7 +264,7 @@ impl HashValueV5 { /// generating basic mock hash values. /// /// Ex: HashValue::from_u64(0x1234) => HashValue([0, .., 0, 0x12, 0x34]) - #[cfg(any(test, feature = "fuzzing"))] + #[cfg(test)] pub fn from_u64(v: u64) -> Self { let mut hash = [0u8; Self::LENGTH]; let bytes = v.to_be_bytes(); diff --git a/compatibility/src/version_five/state_snapshot_v5.rs b/compatibility/src/version_five/state_snapshot_v5.rs index 05250ef9c..eec95abc7 100644 --- a/compatibility/src/version_five/state_snapshot_v5.rs +++ b/compatibility/src/version_five/state_snapshot_v5.rs @@ -45,9 +45,7 @@ pub struct AccountStateBlobRecord(HashValueV5, AccountStateBlob); ////// SNAPSHOT FILE IO ////// /// read snapshot manifest file into struct pub fn v5_read_from_snapshot_manifest(path: &Path) -> Result { - let config = std::fs::read_to_string(path).inspect_err(|e| { - format!("Error: cannot read file {:?}, error: {:?}", &path, e); - })?; + let config = std::fs::read_to_string(path).context(format!("Error: cannot read file at {:?}", &path))?; let map: StateSnapshotBackupV5 = serde_json::from_str(&config)?; diff --git a/compatibility/src/version_five/transaction_manifest_v5.rs b/compatibility/src/version_five/transaction_manifest_v5.rs index d3d59a8fe..243521bf7 100644 --- a/compatibility/src/version_five/transaction_manifest_v5.rs +++ b/compatibility/src/version_five/transaction_manifest_v5.rs @@ -1,6 +1,6 @@ // Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 -use anyhow::{ensure, Result}; +use anyhow::{ensure, Context, Result}; use diem_backup_cli::storage::FileHandle; use diem_types::transaction::Version; use serde::{Deserialize, Serialize}; @@ -78,9 +78,8 @@ impl TransactionBackup { ////// TX FILES IO ////// /// read tx manifest file into struct pub fn v5_read_from_transaction_manifest(path: &Path) -> Result { - let config = std::fs::read_to_string(path).inspect_err(|e| { - format!("Error: cannot read file {:?}, error: {:?}", &path, e); - })?; + let config = std::fs::read_to_string(path).context( + format!("Error: cannot read file {:?}", &path))?; let map: TransactionBackup = serde_json::from_str(&config)?; diff --git a/framework/cached-packages/src/libra_framework_sdk_builder.rs b/framework/cached-packages/src/libra_framework_sdk_builder.rs index 908c6ad70..d2ffcbf2d 100644 --- a/framework/cached-packages/src/libra_framework_sdk_builder.rs +++ b/framework/cached-packages/src/libra_framework_sdk_builder.rs @@ -12,7 +12,7 @@ #![allow(dead_code)] #![allow(unused_imports)] -#![allow(clippy::too_many_arguments)] +#![allow(clippy::too_many_arguments, clippy::doc_lazy_continuation)] use diem_types::{ account_address::AccountAddress, transaction::{EntryFunction, TransactionPayload}, diff --git a/framework/src/builder/framework_generate_upgrade_proposal.rs b/framework/src/builder/framework_generate_upgrade_proposal.rs index 1cf3564ed..f126becf5 100644 --- a/framework/src/builder/framework_generate_upgrade_proposal.rs +++ b/framework/src/builder/framework_generate_upgrade_proposal.rs @@ -150,7 +150,6 @@ pub fn write_to_file(result: Vec<(String, String)>, proposal_dir: PathBuf) -> an /// ... so that we can then submit it as part of a proposal framework/libra-framework/sources/modified_source/diem_governance.move /// ... so that then the VM doesn't complain about its size /diem-move/diem-vm/src/diem_vm_impl.rs /// ... and so that when the proposal is approved a third party can execute the source upgrade. - pub fn init_move_dir_wrapper( package_dir: PathBuf, script_name: &str, diff --git a/types/src/core_types/app_cfg.rs b/types/src/core_types/app_cfg.rs index 5efe8a1dd..05f0043b3 100644 --- a/types/src/core_types/app_cfg.rs +++ b/types/src/core_types/app_cfg.rs @@ -510,7 +510,6 @@ pub fn get_nickname(acc: AccountAddress) -> String { /// Transaction types #[derive(Debug, Clone, Serialize, Deserialize, clap::ValueEnum)] #[clap(rename_all = "kebab_case")] - pub enum TxType { /// critical txs Baseline,