diff --git a/Cargo.lock b/Cargo.lock index e18ccb48d5..3f33109d13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3628,9 +3628,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] @@ -4285,9 +4285,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.57" +version = "0.10.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +checksum = "a9dfc0783362704e97ef3bd24261995a699468440099ef95d869b4d9732f829a" dependencies = [ "bitflags 2.4.1", "cfg-if", @@ -4317,9 +4317,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.93" +version = "0.9.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +checksum = "2f55da20b29f956fb01f0add8683eb26ee13ebe3ebd935e49898717c6b4b2830" dependencies = [ "cc", "libc", @@ -8752,9 +8752,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -8762,9 +8762,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", @@ -8777,9 +8777,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" dependencies = [ "cfg-if", "js-sys", @@ -8789,9 +8789,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote 1.0.33", "wasm-bindgen-macro-support", @@ -8799,9 +8799,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", @@ -8812,15 +8812,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "wasm-bindgen-test" -version = "0.3.37" +version = "0.3.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e6e302a7ea94f83a6d09e78e7dc7d9ca7b186bc2829c24a22d0753efd680671" +checksum = "c6433b7c56db97397842c46b67e11873eda263170afeb3a2dc74a7cb370fee0d" dependencies = [ "console_error_panic_hook", "js-sys", @@ -8832,19 +8832,20 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.37" +version = "0.3.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecb993dd8c836930ed130e020e77d9b2e65dd0fbab1b67c790b0f5d80b11a575" +checksum = "493fcbab756bb764fa37e6bee8cec2dd709eb4273d06d0c282a5e74275ded735" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", + "syn 2.0.38", ] [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" dependencies = [ "js-sys", "wasm-bindgen", @@ -9126,18 +9127,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.21" +version = "0.7.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686b7e407015242119c33dab17b8f61ba6843534de936d94368856528eae4dcc" +checksum = "e50cbb27c30666a6108abd6bc7577556265b44f243e2be89a8bc4e07a528c107" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.21" +version = "0.7.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020f3dfe25dfc38dfea49ce62d5d45ecdd7f0d8a724fa63eb36b6eba4ec76806" +checksum = "a25f293fe55f0a48e7010d65552bb63704f6ceb55a1a385da10d41d8f78e4a3d" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", diff --git a/crates/bin/pcli/src/command.rs b/crates/bin/pcli/src/command.rs index f9763ad843..a7946e6605 100644 --- a/crates/bin/pcli/src/command.rs +++ b/crates/bin/pcli/src/command.rs @@ -30,6 +30,7 @@ use self::ceremony::CeremonyCmd; // // https://docs.rs/clap/latest/clap/builder/struct.App.html#method.display_order #[derive(Debug, clap::Subcommand)] +#[allow(clippy::large_enum_variant)] pub enum Command { /// Initialize `pcli` with a new wallet, or reset it. /// diff --git a/crates/bin/pcli/src/command/ceremony.rs b/crates/bin/pcli/src/command/ceremony.rs index 31306dd1b9..7a9a914620 100644 --- a/crates/bin/pcli/src/command/ceremony.rs +++ b/crates/bin/pcli/src/command/ceremony.rs @@ -108,11 +108,17 @@ impl CeremonyCmd { let index = match *phase { 1 => AddressIndex { account: 0, - randomizer: b"ceremnyaddr1".as_slice().try_into().unwrap(), + randomizer: b"ceremnyaddr1" + .as_slice() + .try_into() + .expect("12 bytes long"), }, 2 => AddressIndex { account: 0, - randomizer: b"ceremnyaddr2".as_slice().try_into().unwrap(), + randomizer: b"ceremnyaddr2" + .as_slice() + .try_into() + .expect("12 bytes long"), }, _ => anyhow::bail!("phase must be 1 or 2."), }; diff --git a/crates/bin/pcli/src/config.rs b/crates/bin/pcli/src/config.rs index 8977ca613e..9de3748ec4 100644 --- a/crates/bin/pcli/src/config.rs +++ b/crates/bin/pcli/src/config.rs @@ -45,6 +45,7 @@ impl PcliConfig { /// The custody backend to use. #[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] #[serde(tag = "backend")] +#[allow(clippy::large_enum_variant)] pub enum CustodyConfig { /// A view-only client that can't sign transactions. ViewOnly, diff --git a/crates/bin/pd/src/testnet/generate.rs b/crates/bin/pd/src/testnet/generate.rs index f87030b17d..a2164010f4 100644 --- a/crates/bin/pd/src/testnet/generate.rs +++ b/crates/bin/pd/src/testnet/generate.rs @@ -66,7 +66,7 @@ impl TestnetConfig { epoch_duration: Option, unbonding_epochs: Option, ) -> anyhow::Result { - let external_addresses = external_addresses.unwrap_or(Vec::new()); + let external_addresses = external_addresses.unwrap_or_default(); let testnet_validators = Self::collect_validators( validators_input_file, diff --git a/crates/bin/pd/src/testnet/join.rs b/crates/bin/pd/src/testnet/join.rs index 87bd6018a6..d9d9fb772d 100644 --- a/crates/bin/pd/src/testnet/join.rs +++ b/crates/bin/pd/src/testnet/join.rs @@ -215,10 +215,8 @@ pub async fn fetch_peers(tm_url: &Url) -> anyhow::Result> ); seeds.push(peer_tm_address) // Otherwise, we check if we've found enough. - } else { - if peers.len() <= threshold { - peers.push(peer_tm_address) - } + } else if peers.len() <= threshold { + peers.push(peer_tm_address) } } if peers.len() < threshold && seeds.is_empty() { diff --git a/crates/core/app/src/genesis/app_state.rs b/crates/core/app/src/genesis/app_state.rs index 2c6c7e6e52..018a9774ff 100644 --- a/crates/core/app/src/genesis/app_state.rs +++ b/crates/core/app/src/genesis/app_state.rs @@ -11,6 +11,7 @@ use serde::{Deserialize, Serialize}; /// The application state at genesis. #[derive(Deserialize, Serialize, Debug, Clone)] #[serde(try_from = "pb::GenesisAppState", into = "pb::GenesisAppState")] +#[allow(clippy::large_enum_variant)] pub enum AppState { /// The application state at genesis. Content(Content), diff --git a/crates/core/asset/src/asset/denom_metadata.rs b/crates/core/asset/src/asset/denom_metadata.rs index ff83ad3cbf..3051219145 100644 --- a/crates/core/asset/src/asset/denom_metadata.rs +++ b/crates/core/asset/src/asset/denom_metadata.rs @@ -380,7 +380,7 @@ impl Eq for DenomMetadata {} impl PartialOrd for DenomMetadata { fn partial_cmp(&self, other: &Self) -> Option { - self.inner.base_denom.partial_cmp(&other.inner.base_denom) + Some(self.cmp(other)) } } diff --git a/crates/core/component/ibc/src/component/msg_handler/update_client.rs b/crates/core/component/ibc/src/component/msg_handler/update_client.rs index ad48d18f4a..722d3f4960 100644 --- a/crates/core/component/ibc/src/component/msg_handler/update_client.rs +++ b/crates/core/component/ibc/src/component/msg_handler/update_client.rs @@ -61,8 +61,6 @@ impl MsgHandler for MsgUpdateClient { .get_verified_consensus_state(trusted_height, self.client_id.clone()) .await?; - let last_trusted_consensus_state = last_trusted_consensus_state; - // We also have to convert from an IBC height, which has two // components, to a Tendermint height, which has only one. let trusted_height = trusted_height diff --git a/crates/core/component/stake/src/component.rs b/crates/core/component/stake/src/component.rs index 19c73e8a84..fbfbbb0a79 100644 --- a/crates/core/component/stake/src/component.rs +++ b/crates/core/component/stake/src/component.rs @@ -314,13 +314,13 @@ pub(crate) trait StakingImpl: StateWriteExt { for d in changes.delegations { delegations_by_validator .entry(d.validator_identity.clone()) - .or_insert_with(Vec::new) + .or_default() .push(d); } for u in changes.undelegations { undelegations_by_validator .entry(u.validator_identity.clone()) - .or_insert_with(Vec::new) + .or_default() .push(u); } } diff --git a/crates/crypto/proof-setup/src/all.rs b/crates/crypto/proof-setup/src/all.rs index 406dcf1313..7d86239d28 100644 --- a/crates/crypto/proof-setup/src/all.rs +++ b/crates/crypto/proof-setup/src/all.rs @@ -373,7 +373,7 @@ impl Phase2CeremonyContribution { &old.0[0], &old.0[1], &old.0[2], &old.0[3], &old.0[4], &old.0[5], &old.0[6], ]; Self(transform_parallel(data, |old_i| { - Phase2Contribution::make(&mut OsRng, ContributionHash::dummy(), &old_i) + Phase2Contribution::make(&mut OsRng, ContributionHash::dummy(), old_i) })) } } @@ -698,7 +698,7 @@ impl Phase1CeremonyContribution { &old.0[0], &old.0[1], &old.0[2], &old.0[3], &old.0[4], &old.0[5], &old.0[6], ]; Self(transform_parallel(data, |old_i| { - Phase1Contribution::make(&mut OsRng, ContributionHash::dummy(), &old_i) + Phase1Contribution::make(&mut OsRng, ContributionHash::dummy(), old_i) })) } } @@ -723,7 +723,7 @@ impl AllExtraTransitionInformation { } pub fn from_bytes(data: &[u8]) -> Result { - Ok(from_bytes_unchecked::(data)?) + from_bytes_unchecked::(data) } } diff --git a/crates/crypto/proof-setup/src/single/phase1.rs b/crates/crypto/proof-setup/src/single/phase1.rs index 73f063e244..60e1c6dea4 100644 --- a/crates/crypto/proof-setup/src/single/phase1.rs +++ b/crates/crypto/proof-setup/src/single/phase1.rs @@ -72,7 +72,6 @@ impl RawCRSElements { /// /// This checks if the structure of the elements uses the secret scalars /// hidden behind the group elements correctly. - #[must_use] pub fn validate(self) -> anyhow::Result { // 0. Check that we can extract a valid degree out of these elements. let d = self diff --git a/crates/storage/src/snapshot.rs b/crates/storage/src/snapshot.rs index 12c48ab0df..e5ca370a06 100644 --- a/crates/storage/src/snapshot.rs +++ b/crates/storage/src/snapshot.rs @@ -471,7 +471,6 @@ impl TreeReader for Inner { /// Gets node given a node key. Returns `None` if the node does not exist. fn get_node_option(&self, node_key: &NodeKey) -> Result> { - let node_key = node_key; let db_node_key = DbNodeKey::from(node_key.clone()); tracing::trace!(?node_key); diff --git a/tools/summonerd/src/coordinator.rs b/tools/summonerd/src/coordinator.rs index d9be3c8fab..e1eca4e782 100644 --- a/tools/summonerd/src/coordinator.rs +++ b/tools/summonerd/src/coordinator.rs @@ -98,6 +98,6 @@ impl Coordinator { } tracing::info!("STRIKE (invalid or partial contribution)"); self.storage.strike(&address).await?; - return Ok(()); + Ok(()) } } diff --git a/tools/summonerd/src/main.rs b/tools/summonerd/src/main.rs index 82a9ef2cb0..044fec14fc 100644 --- a/tools/summonerd/src/main.rs +++ b/tools/summonerd/src/main.rs @@ -94,6 +94,7 @@ struct Opt { #[derive(Debug, clap::Subcommand)] /// Hello folks +#[allow(clippy::large_enum_variant)] enum Command { /// Generate a phase 1 root (for testing purposes). GeneratePhase1 { @@ -318,8 +319,8 @@ fn write_params( let vk_location = target_dir.join(format!("{}_vk.param", name)); let id_location = target_dir.join(format!("{}_id.rs", name)); - let pk_file = fs::File::create(&pk_location)?; - let vk_file = fs::File::create(&vk_location)?; + let pk_file = fs::File::create(pk_location)?; + let vk_file = fs::File::create(vk_location)?; let pk_writer = BufWriter::new(pk_file); let vk_writer = BufWriter::new(vk_file); diff --git a/tools/summonerd/src/server.rs b/tools/summonerd/src/server.rs index bc4818373e..ac720a7cfa 100644 --- a/tools/summonerd/src/server.rs +++ b/tools/summonerd/src/server.rs @@ -87,15 +87,13 @@ impl server::CeremonyCoordinatorService for CoordinatorService { } ContributionAllowed::Banned => { tracing::debug!(?address, "is banned"); - return Err(Status::permission_denied(format!( - "nyo contwibution *cries* fow you" - ))); + return Err(Status::permission_denied( + "nyo contwibution *cries* fow you".to_string(), + )); } ContributionAllowed::AlreadyContributed => { tracing::debug!(?address, "already contributed"); - return Err(Status::permission_denied(format!( - "Thanks again for your contribution! Participating once is enough to guarantee security, and we'd like to allow other people to participate as well." - ))); + return Err(Status::permission_denied("Thanks again for your contribution! Participating once is enough to guarantee security, and we'd like to allow other people to participate as well.".to_string())); } }; tracing::info!(?amount, ?address, "bid"); diff --git a/tools/summonerd/src/storage.rs b/tools/summonerd/src/storage.rs index 5e7f3ba6cb..d155276977 100644 --- a/tools/summonerd/src/storage.rs +++ b/tools/summonerd/src/storage.rs @@ -179,7 +179,7 @@ impl Storage { .query_row( "SELECT strikes FROM participant_metadata WHERE address = ?1", [address.to_vec()], - |row| Ok(row.get::(0)?), + |row| row.get::(0), ) .optional()? .unwrap_or(0); @@ -200,7 +200,7 @@ impl Storage { // - Bid more than min amount // - Hasn't already contributed // - Not banned - let amount = knower.total_amount_sent_to_me(&address).await?; + let amount = knower.total_amount_sent_to_me(address).await?; if amount < Amount::from(self.config.min_bid_u64) { return Ok(ContributionAllowed::DidntBidEnough(amount)); } @@ -416,13 +416,13 @@ impl Storage { let tx = conn.transaction()?; let maybe_data = tx .query_row("SELECT data FROM transition_aux WHERE id = 0", [], |row| { - Ok(row.get::>(0)?) + row.get::>(0) }) .optional()?; if let Some(data) = maybe_data { Ok(Some(AllExtraTransitionInformation::from_bytes(&data)?)) } else { - return Ok(None); + Ok(None) } } }