From 1a63f7cb83195f6223c07cc0045898ce6fb8d7fb Mon Sep 17 00:00:00 2001 From: i1i1 Date: Tue, 3 Aug 2021 12:10:34 +0300 Subject: [PATCH] rust update to 1.54 Signed-off-by: i1i1 --- .github/workflows/iroha2-dev-pr.yml | 16 ++--- .github/workflows/iroha2-dev.yml | 6 +- .github/workflows/iroha2.yml | 2 +- clippy.toml | 1 + iroha/benches/validation.rs | 8 +-- iroha/docs/src/main.rs | 4 +- iroha/src/block.rs | 4 +- iroha/src/block_sync.rs | 18 +++--- iroha/src/kura.rs | 2 +- iroha/src/lib.rs | 8 +-- iroha/src/queue.rs | 20 +++---- iroha/src/smartcontracts/isi/account.rs | 28 ++++----- iroha/src/smartcontracts/isi/asset.rs | 20 +++---- iroha/src/smartcontracts/isi/domain.rs | 22 +++---- iroha/src/smartcontracts/isi/mod.rs | 10 ++-- iroha/src/smartcontracts/isi/permissions.rs | 2 +- iroha/src/smartcontracts/isi/query.rs | 24 ++++---- iroha/src/smartcontracts/isi/world.rs | 8 +-- iroha/src/sumeragi/mod.rs | 42 +++++++------- iroha/src/sumeragi/network_topology.rs | 2 +- iroha/src/torii.rs | 6 +- iroha/src/tx.rs | 26 ++++----- iroha/src/wsv.rs | 6 +- .../test_network/tests/sumeragi_with_mock.rs | 2 +- iroha_actor/src/broker.rs | 4 +- iroha_actor/src/deadlock.rs | 4 +- iroha_actor/src/envelope.rs | 4 +- iroha_actor/src/lib.rs | 27 ++++----- iroha_client/src/client.rs | 12 ++-- iroha_client/src/http_client.rs | 2 +- iroha_data_model/src/lib.rs | 8 +-- iroha_data_model/src/query.rs | 2 +- iroha_dsl/tests/dsl.rs | 12 ++-- iroha_http_server/src/lib.rs | 4 ++ iroha_logger/src/lib.rs | 2 +- .../tests/from_variant/02-double-from.stderr | 4 +- .../from_variant/04-container-from.stderr | 4 +- iroha_network/src/lib.rs | 5 +- iroha_p2p/src/network.rs | 6 +- iroha_p2p/tests/mod.rs | 8 +-- iroha_permissions_validators/src/lib.rs | 58 +++++++++---------- iroha_schema/iroha_schema_derive/src/lib.rs | 2 +- iroha_telemetry/src/futures.rs | 3 +- .../tests/ui/fail_invalid_range_equal.stderr | 4 +- .../tests/ui/fail_invalid_range_less.stderr | 4 +- lints.toml | 2 +- 46 files changed, 224 insertions(+), 244 deletions(-) create mode 100644 clippy.toml diff --git a/.github/workflows/iroha2-dev-pr.yml b/.github/workflows/iroha2-dev-pr.yml index d37dc572a3a..9de71d3a163 100644 --- a/.github/workflows/iroha2-dev-pr.yml +++ b/.github/workflows/iroha2-dev-pr.yml @@ -14,7 +14,7 @@ env: jobs: check: runs-on: [self-hosted, Linux] #ubuntu-latest - container: rust:1.52-buster + container: rust:1.54-buster steps: - uses: actions/checkout@v2 - uses: actions/cache@v2 @@ -53,7 +53,7 @@ jobs: test: runs-on: [self-hosted, Linux] #ubuntu-latest - container: rust:1.52-buster + container: rust:1.54-buster steps: - uses: actions/checkout@v2 - uses: actions/cache@v2 @@ -73,7 +73,7 @@ jobs: test-iroha_network-mock: runs-on: [self-hosted, Linux] #ubuntu-latest - container: rust:1.52-buster + container: rust:1.54-buster steps: - uses: actions/checkout@v2 - uses: actions/cache@v2 @@ -97,7 +97,7 @@ jobs: test-deadlock_detection: runs-on: [self-hosted, Linux] #ubuntu-latest - container: rust:1.52-buster + container: rust:1.54-buster steps: - uses: actions/checkout@v2 - uses: actions/cache@v2 @@ -128,7 +128,7 @@ jobs: - name: Install latest rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.52 + toolchain: 1.54 - name: Install dependencies if: ${{ false }} run: | @@ -152,7 +152,7 @@ jobs: print-telemetry: runs-on: [self-hosted, Linux] #ubuntu-latest - container: rust:1.52-buster + container: rust:1.54-buster steps: - uses: actions/checkout@v2 - uses: actions/cache@v2 @@ -240,7 +240,7 @@ jobs: # 2 Coverage bot can have results from `iroha2-dev` to report accurate coverage changes. coverage: runs-on: [self-hosted, Linux] - container: rust:1.52-buster + container: rust:1.54-buster steps: - uses: actions/checkout@v2 - name: Install dependencies @@ -277,7 +277,7 @@ jobs: bench: runs-on: [self-hosted, Linux] - container: rust:1.52-buster + container: rust:1.54-buster if: ${{ false }} steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/iroha2-dev.yml b/.github/workflows/iroha2-dev.yml index 589b1a923c4..146dddd5b87 100644 --- a/.github/workflows/iroha2-dev.yml +++ b/.github/workflows/iroha2-dev.yml @@ -14,7 +14,7 @@ env: jobs: archive-artifacts: runs-on: [self-hosted, Linux] - container: rust:1.52-buster + container: rust:1.54-buster steps: - uses: actions/checkout@v2 - uses: actions/cache@v2 @@ -49,7 +49,7 @@ jobs: deploy: runs-on: [self-hosted, Linux] - container: rust:1.52-buster + container: rust:1.54-buster steps: - uses: actions/checkout@v2 - name: Check Dockerhub credentials @@ -88,7 +88,7 @@ jobs: # 2 Coverage bot can have results from `iroha2-dev` to report accurate coverage changes. coverage: runs-on: [self-hosted, Linux] - container: rust:1.52-buster + container: rust:1.54-buster steps: - uses: actions/checkout@v2 - name: Install dependencies diff --git a/.github/workflows/iroha2.yml b/.github/workflows/iroha2.yml index da61c77f9da..5e1f9c0c25c 100644 --- a/.github/workflows/iroha2.yml +++ b/.github/workflows/iroha2.yml @@ -16,7 +16,7 @@ env: jobs: coverage: runs-on: [self-hosted, Linux] #ubuntu-latest - container: rust:1.52-buster + container: rust:1.54-buster steps: - uses: actions/checkout@v2 - name: Set nightly toolchain diff --git a/clippy.toml b/clippy.toml new file mode 100644 index 00000000000..cda8d17eed4 --- /dev/null +++ b/clippy.toml @@ -0,0 +1 @@ +avoid-breaking-exported-api = false diff --git a/iroha/benches/validation.rs b/iroha/benches/validation.rs index 52111f22d29..bfa0f18783e 100644 --- a/iroha/benches/validation.rs +++ b/iroha/benches/validation.rs @@ -53,8 +53,8 @@ fn build_test_wsv(keys: &KeyPair) -> WorldStateView { let account_id = AccountId::new(START_ACCOUNT, START_DOMAIN); let mut account = Account::new(account_id.clone()); account.signatories.push(keys.public_key.clone()); - drop(domain.accounts.insert(account_id, account)); - drop(domains.insert(START_DOMAIN.to_string(), domain)); + domain.accounts.insert(account_id, account); + domains.insert(START_DOMAIN.to_string(), domain); World::with(domains, BTreeSet::new()) }) } @@ -173,14 +173,14 @@ fn validate_blocks(criterion: &mut Criterion) { let account_id = AccountId::new("root", &domain_name); let account = Account::with_signatory(account_id.clone(), key_pair.public_key); let mut accounts = BTreeMap::new(); - drop(accounts.insert(account_id, account)); + accounts.insert(account_id, account); let domain = Domain { name: domain_name.clone(), accounts, asset_definitions, }; let mut domains = BTreeMap::new(); - drop(domains.insert(domain_name, domain)); + domains.insert(domain_name, domain); let wsv = WorldStateView::new(World::with(domains, BTreeSet::new())); // Pepare test transaction let keys = KeyPair::generate().expect("Failed to generate keys"); diff --git a/iroha/docs/src/main.rs b/iroha/docs/src/main.rs index 65b2eedd4ac..2a8cdd5b53f 100644 --- a/iroha/docs/src/main.rs +++ b/iroha/docs/src/main.rs @@ -67,7 +67,7 @@ where Value::String(s) => (s.clone(), false), _ => unreachable!("Only strings and objects in docs"), }; - let doc = doc.strip_prefix(" ").unwrap_or(&doc); + let doc = doc.strip_prefix(' ').unwrap_or(&doc); let defaults = Self::default() .get_recursive(get_field) .expect("Failed to get defaults."); @@ -86,7 +86,7 @@ where Self::get_markdown_with_depth(writer, docs, field, depth + 1)?; } - drop(field.pop()); + field.pop(); } Ok(()) } diff --git a/iroha/src/block.rs b/iroha/src/block.rs index 9caedbddebf..b85526a91be 100644 --- a/iroha/src/block.rs +++ b/iroha/src/block.rs @@ -52,7 +52,7 @@ impl Chain { /// Put latest block. pub fn push(&self, block: VersionedCommittedBlock) { let height = block.as_inner_v1().header.height; - drop(self.blocks.insert(height, block)); + self.blocks.insert(height, block); } /// Iterator over height and block. @@ -633,7 +633,7 @@ impl From<&CommittedBlock> for Vec { .header .invalidated_blocks_hashes .iter() - .cloned() + .copied() .map(|hash| { PipelineEvent::new( PipelineEntityType::Block, diff --git a/iroha/src/block_sync.rs b/iroha/src/block_sync.rs index c01ec0ca140..c28ecc3c3d9 100644 --- a/iroha/src/block_sync.rs +++ b/iroha/src/block_sync.rs @@ -113,16 +113,14 @@ impl Handler for BlockSynchroni self.wsv.latest_block_hash(), self.peer_id.clone(), )); - drop( - futures::future::join_all( - self.sumeragi - .send(GetSortedPeers) - .await - .iter() - .map(|peer| message.clone().send_to(peer)), - ) - .await, - ); + futures::future::join_all( + self.sumeragi + .send(GetSortedPeers) + .await + .iter() + .map(|peer| message.clone().send_to(peer)), + ) + .await; } } diff --git a/iroha/src/kura.rs b/iroha/src/kura.rs index 941a257d912..d6907f55671 100644 --- a/iroha/src/kura.rs +++ b/iroha/src/kura.rs @@ -428,7 +428,7 @@ mod tests { let dir = tempfile::tempdir().unwrap(); let mut kura = Kura::::new(Mode::Strict, dir.path(), Arc::default(), Broker::new()).unwrap(); - drop(kura.init().await.expect("Failed to init Kura.")); + kura.init().await.expect("Failed to init Kura."); let _ = kura .store(block) .await diff --git a/iroha/src/lib.rs b/iroha/src/lib.rs index 4f1adb02d64..3f37bc36196 100644 --- a/iroha/src/lib.rs +++ b/iroha/src/lib.rs @@ -145,11 +145,9 @@ where #[cfg(feature = "telemetry")] if let Some(telemetry) = telemetry { - drop( - telemetry::start(&config.telemetry, telemetry) - .await - .wrap_err("Failed to setup telemetry")?, - ); + telemetry::start(&config.telemetry, telemetry) + .await + .wrap_err("Failed to setup telemetry")?; } let query_validator = Arc::new(query_validator); let sumeragi: AlwaysAddr<_> = S::from_configuration( diff --git a/iroha/src/queue.rs b/iroha/src/queue.rs index 36ba411adb8..40a274a571b 100644 --- a/iroha/src/queue.rs +++ b/iroha/src/queue.rs @@ -182,11 +182,9 @@ impl Queue { } if expired || tx.is_in_blockchain(&*self.wsv) { - drop( - self.pending_tx_by_hash - .remove(&tx_hash) - .expect("Should always be present, as contained in queue"), - ); + self.pending_tx_by_hash + .remove(&tx_hash) + .expect("Should always be present, as contained in queue"); continue; } @@ -194,11 +192,9 @@ impl Queue { Ok(passed) => passed, Err(e) => { iroha_logger::error!(%e, "Not passed signature"); - drop( - self.pending_tx_by_hash - .remove(&tx_hash) - .expect("Should always be present, as contained in queue"), - ); + self.pending_tx_by_hash + .remove(&tx_hash) + .expect("Should always be present, as contained in queue"); continue; } }; @@ -291,8 +287,8 @@ mod tests { let account_id = AccountId::new("alice", "wonderland"); let mut account = Account::new(account_id.clone()); account.signatories.push(public_key); - drop(domain.accounts.insert(account_id, account)); - drop(domains.insert("wonderland".to_string(), domain)); + domain.accounts.insert(account_id, account); + domains.insert("wonderland".to_string(), domain); World::with(domains, PeersIds::new()) } diff --git a/iroha/src/smartcontracts/isi/account.rs b/iroha/src/smartcontracts/isi/account.rs index ec20e9701a1..85f58f07d83 100644 --- a/iroha/src/smartcontracts/isi/account.rs +++ b/iroha/src/smartcontracts/isi/account.rs @@ -62,7 +62,7 @@ pub mod isi { .iter() .position(|key| key == &public_key) { - drop(account.signatories.remove(index)); + account.signatories.remove(index); } Ok(()) })?; @@ -81,11 +81,11 @@ pub mod isi { let account_metadata_limits = wsv.config.account_metadata_limits; let id = self.object_id.clone(); wsv.modify_account(&id, |account| { - drop(account.metadata.insert_with_limits( + account.metadata.insert_with_limits( self.key.clone(), self.value, account_metadata_limits, - )); + )?; Ok(()) })?; Ok(()) @@ -101,12 +101,10 @@ pub mod isi { wsv: &WorldStateView, ) -> Result<(), Error> { wsv.modify_account(&self.object_id, |account| { - drop( - account - .metadata - .remove(&self.key) - .ok_or_else(|| FindError::MetadataKey(self.key.clone()))?, - ); + account + .metadata + .remove(&self.key) + .ok_or_else(|| FindError::MetadataKey(self.key.clone()))?; Ok(()) })?; Ok(()) @@ -139,12 +137,10 @@ pub mod isi { _authority: ::Id, wsv: &WorldStateView, ) -> Result<(), Error> { - drop( - wsv.world() - .roles - .get(&self.object) - .ok_or_else(|| FindError::Role(self.object.clone()))?, - ); + wsv.world() + .roles + .get(&self.object) + .ok_or_else(|| FindError::Role(self.object.clone()))?; let id = self.destination_id.clone(); wsv.modify_account(&id, |account| { @@ -212,7 +208,7 @@ pub mod query { .id .evaluate(wsv, &Context::default()) .wrap_err("Failed to get id")?; - Ok(wsv.map_account(&id, Clone::clone)?) + wsv.map_account(&id, Clone::clone) } } diff --git a/iroha/src/smartcontracts/isi/asset.rs b/iroha/src/smartcontracts/isi/asset.rs index 0a757503852..f94a4ad2f9b 100644 --- a/iroha/src/smartcontracts/isi/asset.rs +++ b/iroha/src/smartcontracts/isi/asset.rs @@ -50,7 +50,7 @@ pub mod isi { wsv, AssetValueType::Quantity, )?; - drop(wsv.asset_or_insert(&self.destination_id, 0_u32)?); + wsv.asset_or_insert(&self.destination_id, 0_u32)?; wsv.modify_asset(&self.destination_id, |asset| { let quantity: &mut u32 = asset.try_as_mut()?; *quantity = quantity @@ -75,7 +75,7 @@ pub mod isi { wsv, AssetValueType::BigQuantity, )?; - drop(wsv.asset_or_insert(&self.destination_id, 0_u128)?); + wsv.asset_or_insert(&self.destination_id, 0_u128)?; wsv.modify_asset(&self.destination_id, |asset| { let quantity: &mut u128 = asset.try_as_mut()?; *quantity = quantity @@ -97,14 +97,14 @@ pub mod isi { ) -> Result<(), Error> { assert_asset_type(&self.object_id.definition_id, wsv, AssetValueType::Store)?; let asset_metadata_limits = wsv.config.asset_metadata_limits; - drop(wsv.asset_or_insert(&self.object_id, Metadata::new())?); + wsv.asset_or_insert(&self.object_id, Metadata::new())?; wsv.modify_asset(&self.object_id, |asset| { let store: &mut Metadata = asset.try_as_mut()?; - drop(store.insert_with_limits( + store.insert_with_limits( self.key.clone(), self.value.clone(), asset_metadata_limits, - )); + )?; Ok(()) })?; Ok(()) @@ -170,11 +170,9 @@ pub mod isi { assert_asset_type(&self.object_id.definition_id, wsv, AssetValueType::Store)?; wsv.modify_asset(&self.object_id, |asset| { let store: &mut Metadata = asset.try_as_mut()?; - drop( - store - .remove(&self.key) - .ok_or_else(|| FindError::MetadataKey(self.key.clone()))?, - ); + store + .remove(&self.key) + .ok_or_else(|| FindError::MetadataKey(self.key.clone()))?; Ok(()) })?; Ok(()) @@ -206,7 +204,7 @@ pub mod isi { .ok_or_else(|| error!("Source account does not have enough asset quantity."))?; Ok(()) })?; - drop(wsv.asset_or_insert(&self.destination_id, 0_u32)); + wsv.asset_or_insert(&self.destination_id, 0_u32)?; wsv.modify_asset(&self.destination_id, |asset| { let quantity: &mut u32 = asset.try_as_mut()?; *quantity = quantity diff --git a/iroha/src/smartcontracts/isi/domain.rs b/iroha/src/smartcontracts/isi/domain.rs index 26408905543..b4fe24b8314 100644 --- a/iroha/src/smartcontracts/isi/domain.rs +++ b/iroha/src/smartcontracts/isi/domain.rs @@ -50,11 +50,9 @@ pub mod isi { wsv: &WorldStateView, ) -> Result<(), Error> { let account_id = self.object_id; - drop( - wsv.domain_mut(&account_id.domain_name)? - .accounts - .remove(&account_id), - ); + wsv.domain_mut(&account_id.domain_name)? + .accounts + .remove(&account_id); Ok(()) } } @@ -99,11 +97,9 @@ pub mod isi { wsv: &WorldStateView, ) -> Result<(), Error> { let asset_definition_id = self.object_id; - drop( - wsv.domain_mut(&asset_definition_id.domain_name)? - .asset_definitions - .remove(&asset_definition_id), - ); + wsv.domain_mut(&asset_definition_id.domain_name)? + .asset_definitions + .remove(&asset_definition_id); for mut domain in wsv.domains().iter_mut() { for account in domain.accounts.values_mut() { let keys = account @@ -112,9 +108,9 @@ pub mod isi { .filter(|(asset_id, _asset)| asset_id.definition_id == asset_definition_id) .map(|(asset_id, _asset)| asset_id.clone()) .collect::>(); - keys.iter().for_each(|asset_id| { - drop(account.assets.remove(asset_id)); - }); + for id in &keys { + account.assets.remove(id); + } } } Ok(()) diff --git a/iroha/src/smartcontracts/isi/mod.rs b/iroha/src/smartcontracts/isi/mod.rs index 32da2fbd9b4..96234990357 100644 --- a/iroha/src/smartcontracts/isi/mod.rs +++ b/iroha/src/smartcontracts/isi/mod.rs @@ -22,7 +22,7 @@ use super::{Evaluate, Execute}; use crate::{prelude::*, wsv::WorldTrait}; /// Instruction execution error type -#[allow(clippy::clippy::pub_enum_variant_names)] +#[allow(clippy::enum_variant_names)] #[derive(Debug, FromVariant, Error)] pub enum Error { /// Failed to find some entity @@ -442,13 +442,13 @@ mod tests { let mut account = Account::new(account_id.clone()); let key_pair = KeyPair::generate()?; account.signatories.push(key_pair.public_key); - drop(domain.accounts.insert(account_id.clone(), account)); + domain.accounts.insert(account_id.clone(), account); let asset_definition_id = AssetDefinitionId::new("rose", "wonderland"); - drop(domain.asset_definitions.insert( + domain.asset_definitions.insert( asset_definition_id.clone(), AssetDefinitionEntry::new(AssetDefinition::new_store(asset_definition_id), account_id), - )); - drop(domains.insert("wonderland".to_string(), domain)); + ); + domains.insert("wonderland".to_string(), domain); Ok(World::with(domains, PeersIds::new())) } diff --git a/iroha/src/smartcontracts/isi/permissions.rs b/iroha/src/smartcontracts/isi/permissions.rs index c3d52033245..74081eed4e6 100644 --- a/iroha/src/smartcontracts/isi/permissions.rs +++ b/iroha/src/smartcontracts/isi/permissions.rs @@ -783,7 +783,7 @@ mod tests { let _ = bob_account .permission_tokens .insert(PermissionToken::new("token", BTreeMap::default())); - drop(domain.accounts.insert(bob_id.clone(), bob_account)); + domain.accounts.insert(bob_id.clone(), bob_account); let domains = vec![("test".to_string(), domain)]; let wsv = WorldStateView::new(World::with(domains, BTreeSet::new())); let validator: HasTokenBoxed<_> = Box::new(GrantedToken); diff --git a/iroha/src/smartcontracts/isi/query.rs b/iroha/src/smartcontracts/isi/query.rs index 637df91e178..bde5d9f4e97 100644 --- a/iroha/src/smartcontracts/isi/query.rs +++ b/iroha/src/smartcontracts/isi/query.rs @@ -211,16 +211,16 @@ mod tests { let mut account = Account::new(account_id.clone()); let key_pair = KeyPair::generate()?; account.signatories.push(key_pair.public_key); - drop(domain.accounts.insert(account_id.clone(), account)); + domain.accounts.insert(account_id.clone(), account); let asset_definition_id = AssetDefinitionId::new("rose", "wonderland"); - drop(domain.asset_definitions.insert( + domain.asset_definitions.insert( asset_definition_id.clone(), AssetDefinitionEntry::new( AssetDefinition::new(asset_definition_id, AssetValueType::Quantity), account_id, ), - )); - drop(domains.insert("wonderland".to_string(), domain)); + ); + domains.insert("wonderland".to_string(), domain); Ok(World::with(domains, PeersIds::new())) } @@ -231,11 +231,13 @@ mod tests { let asset_definition_id = AssetDefinitionId::new("rose", "wonderland"); let asset_id = AssetId::new(asset_definition_id, account_id); let mut store = Metadata::new(); - drop(store.insert_with_limits( - "Bytes".to_owned(), - Value::Vec(vec![Value::U32(1), Value::U32(2), Value::U32(3)]), - MetadataLimits::new(10, 100), - )); + store + .insert_with_limits( + "Bytes".to_owned(), + Value::Vec(vec![Value::U32(1), Value::U32(2), Value::U32(3)]), + MetadataLimits::new(10, 100), + ) + .unwrap(); wsv.add_asset(Asset::new(asset_id.clone(), AssetValue::Store(store)))?; let bytes = FindAssetKeyValueByIdAndKey::new(asset_id, "Bytes".to_owned()).execute(&wsv)?; assert_eq!( @@ -250,11 +252,11 @@ mod tests { let wsv = WorldStateView::new(world_with_test_domains()?); let account_id = AccountId::new("alice", "wonderland"); wsv.modify_account(&account_id, |account| { - drop(account.metadata.insert_with_limits( + account.metadata.insert_with_limits( "Bytes".to_string(), Value::Vec(vec![Value::U32(1), Value::U32(2), Value::U32(3)]), MetadataLimits::new(10, 100), - )?); + )?; Ok(()) })?; let bytes = diff --git a/iroha/src/smartcontracts/isi/world.rs b/iroha/src/smartcontracts/isi/world.rs index 5c49830e967..563e1a22ce9 100644 --- a/iroha/src/smartcontracts/isi/world.rs +++ b/iroha/src/smartcontracts/isi/world.rs @@ -36,7 +36,7 @@ pub mod isi { ) -> Result<(), Error> { let domain = self.object; domain.validate_len(wsv.config.length_limits)?; - drop(wsv.domains().insert(domain.name.clone(), domain)); + wsv.domains().insert(domain.name.clone(), domain); Ok(()) } } @@ -50,7 +50,7 @@ pub mod isi { wsv: &WorldStateView, ) -> Result<(), Error> { // TODO: Should we fail if no domain found? - drop(wsv.domains().remove(&self.object_id)); + wsv.domains().remove(&self.object_id); Ok(()) } } @@ -65,7 +65,7 @@ pub mod isi { wsv: &WorldStateView, ) -> Result<(), Error> { let role = self.object; - drop(wsv.world.roles.insert(role.id.clone(), role)); + wsv.world.roles.insert(role.id.clone(), role); Ok(()) } } @@ -79,7 +79,7 @@ pub mod isi { _authority: ::Id, wsv: &WorldStateView, ) -> Result<(), Error> { - drop(wsv.world.roles.remove(&self.object_id)); + wsv.world.roles.remove(&self.object_id); for mut domain in wsv.domains().iter_mut() { for account in domain.accounts.values_mut() { let _ = account.roles.remove(&self.object_id); diff --git a/iroha/src/sumeragi/mod.rs b/iroha/src/sumeragi/mod.rs index e594687ef69..4894df5da15 100644 --- a/iroha/src/sumeragi/mod.rs +++ b/iroha/src/sumeragi/mod.rs @@ -499,7 +499,7 @@ impl Sumeragi { let recipient_peers = self.topology.sorted_peers().to_vec(); let peer_id = self.peer_id.clone(); let tx_receipt_time = self.tx_receipt_time; - drop(task::spawn(async move { + task::spawn(async move { time::sleep(tx_receipt_time).await; if transactions_awaiting_receipts.contains_key(&transaction_hash) { iroha_logger::warn!( @@ -528,7 +528,7 @@ impl Sumeragi { ) }); } - }.in_current_span())); + }.in_current_span()); } future::join_all(send_futures) .await @@ -646,7 +646,7 @@ impl Sumeragi { let recipient_peers = self.topology.sorted_peers().to_vec(); let peer_id = self.peer_id.clone(); let commit_time = self.commit_time; - drop(task::spawn( + task::spawn( async move { time::sleep(commit_time).await; let voting_block = if let Some(voting_block) = voting_block.write().await.clone() { @@ -690,7 +690,7 @@ impl Sumeragi { }); } .in_current_span(), - )); + ); } /// Commits `ValidBlock` and changes the state of the `Sumeragi` and its `NetworkTopology`. @@ -985,11 +985,11 @@ pub mod message { let peers = sumeragi.peers(); let view_change_suggested_cloned = view_change_suggested.clone(); // Sending message in parallel as it can block peer and during consensus whole blockchain. - drop(task::spawn(async move { + task::spawn(async move { view_change_suggested_cloned .send_to_all(peers, peer_id) .await - })); + }); view_change_suggested } else { self.clone() @@ -1064,15 +1064,13 @@ pub mod message { async fn send_to_all(&self, peers: HashSet, this_peer: PeerId) { let view_change_suggested = VersionedMessage::from(Message::ViewChangeSuggested(self.clone())); - drop( - futures::future::join_all( - peers - .iter() - .filter(|peer_id| peer_id != &&this_peer) - .map(|peer| view_change_suggested.clone().send_to(peer)), - ) - .await, - ); + futures::future::join_all( + peers + .iter() + .filter(|peer_id| peer_id != &&this_peer) + .map(|peer| view_change_suggested.clone().send_to(peer)), + ) + .await; } } @@ -1480,7 +1478,7 @@ pub mod message { .wrap_err("Failed to put first signature.")?; let _ = transactions_awaiting_created_block.insert(tx_hash); let recipient_peers = sumeragi.topology.sorted_peers().to_vec(); - drop(task::spawn( + task::spawn( async move { time::sleep(block_time).await; // Suspect leader if the block was not yet created @@ -1489,16 +1487,16 @@ pub mod message { let block_creation_timeout_message = VersionedMessage::from( Message::ViewChangeSuggested(block_creation_timeout.into()), ); - drop( - futures::future::join_all(recipient_peers.iter().map(|peer| { + futures::future::join_all( + recipient_peers.iter().map(|peer| { block_creation_timeout_message.clone().send_to(peer) - })) - .await, - ); + }), + ) + .await; } } .in_current_span(), - )); + ); } Ok(()) } diff --git a/iroha/src/sumeragi/network_topology.rs b/iroha/src/sumeragi/network_topology.rs index f6add0d36f1..ae3415d927a 100644 --- a/iroha/src/sumeragi/network_topology.rs +++ b/iroha/src/sumeragi/network_topology.rs @@ -385,7 +385,7 @@ impl Topology { roles: &[Role], signatures: &[Signature], ) -> Vec { - let roles: HashSet = roles.iter().cloned().collect(); + let roles: HashSet = roles.iter().copied().collect(); let public_keys: Vec<_> = roles .iter() .flat_map(|role| role.peers(self)) diff --git a/iroha/src/torii.rs b/iroha/src/torii.rs index 487b07f44a7..ed11fc108b4 100644 --- a/iroha/src/torii.rs +++ b/iroha/src/torii.rs @@ -104,7 +104,7 @@ pub type Result = std::result::Result; impl Torii { /// Construct `Torii` from `ToriiConfiguration`. - #[allow(clippy::clippy::too_many_arguments)] + #[allow(clippy::too_many_arguments)] pub fn from_configuration( config: ToriiConfiguration, wsv: Arc>, @@ -602,7 +602,7 @@ mod tests { vec![], ))); let keys = KeyPair::generate().expect("Failed to generate keys"); - drop(wsv.world.domains.insert( + wsv.world.domains.insert( "wonderland".to_owned(), Domain::with_accounts( "wonderland", @@ -611,7 +611,7 @@ mod tests { keys.public_key.clone(), )), ), - )); + ); let queue = Queue::from_configuration( &config.queue_configuration, Arc::clone(&wsv), diff --git a/iroha/src/tx.rs b/iroha/src/tx.rs index f6e90687bbd..2c3de4079dc 100644 --- a/iroha/src/tx.rs +++ b/iroha/src/tx.rs @@ -205,21 +205,19 @@ impl AcceptedTransaction { if !is_genesis && account_id == ::Id::genesis_account() { return Err(TransactionRejectionReason::UnexpectedGenesisAccountSignature); } - drop( - self.signatures - .iter() - .map(|signature| { - signature.verify(self.hash().as_ref()).map_err(|reason| { - SignatureVerificationFail { - signature: signature.clone(), - // TODO: Should here also be iroha_error::Error? - reason: reason.to_string(), - } - }) + self.signatures + .iter() + .map(|signature| { + signature.verify(self.hash().as_ref()).map_err(|reason| { + SignatureVerificationFail { + signature: signature.clone(), + // TODO: Should here also be iroha_error::Error? + reason: reason.to_string(), + } }) - .collect::, _>>() - .map_err(TransactionRejectionReason::SignatureVerification)?, - ); + }) + .collect::, _>>() + .map_err(TransactionRejectionReason::SignatureVerification)?; let option_reason = match self.check_signature_condition(wsv) { Ok(true) => None, diff --git a/iroha/src/wsv.rs b/iroha/src/wsv.rs index 1e408ad1da7..42490c06eb2 100644 --- a/iroha/src/wsv.rs +++ b/iroha/src/wsv.rs @@ -190,7 +190,7 @@ impl WorldStateView { /// Add new `Domain` entity. pub fn add_domain(&mut self, domain: Domain) { - drop(self.world.domains.insert(domain.name.clone(), domain)); + self.world.domains.insert(domain.name.clone(), domain); } /// Returns reference for domains map @@ -311,7 +311,7 @@ impl WorldStateView { .ok_or_else(|| FindError::Asset(id.clone()))?; f(&mut asset)?; if asset.value.is_zero_value() { - drop(account.assets.remove(id)); + account.assets.remove(id); } Ok(()) }) @@ -342,7 +342,7 @@ impl WorldStateView { pub fn add_asset(&self, asset: Asset) -> Result<()> { let id = asset.id.account_id.clone(); self.modify_account(&id, move |account| { - drop(account.assets.insert(asset.id.clone(), asset)); + account.assets.insert(asset.id.clone(), asset); Ok(()) }) } diff --git a/iroha/test_network/tests/sumeragi_with_mock.rs b/iroha/test_network/tests/sumeragi_with_mock.rs index cf0c3d38306..01c53755208 100644 --- a/iroha/test_network/tests/sumeragi_with_mock.rs +++ b/iroha/test_network/tests/sumeragi_with_mock.rs @@ -505,7 +505,7 @@ pub mod utils { }); pub static GLOBAL: Lazy = Lazy::new(|| { let mut domain = Domain::new("global"); - drop(domain.accounts.insert(ROOT_ID.clone(), ROOT.clone())); + domain.accounts.insert(ROOT_ID.clone(), ROOT.clone()); domain }); diff --git a/iroha_actor/src/broker.rs b/iroha_actor/src/broker.rs index ebd619b0896..d6db9108494 100644 --- a/iroha_actor/src/broker.rs +++ b/iroha_actor/src/broker.rs @@ -104,7 +104,7 @@ impl Broker { .downcast_ref::>() .map(|recipient| recipient.send(m.clone())) }); - drop(future::join_all(send).await); + future::join_all(send).await; } fn subscribe_recipient(&self, recipient: Recipient) { @@ -148,7 +148,7 @@ impl Broker { .iter() .position(|(actor_id, _)| actor_id == &TypeId::of::()) { - drop(entry.get_mut().remove(pos)); + entry.get_mut().remove(pos); } } } diff --git a/iroha_actor/src/deadlock.rs b/iroha_actor/src/deadlock.rs index f886a2aaeb0..47c02a489d4 100644 --- a/iroha_actor/src/deadlock.rs +++ b/iroha_actor/src/deadlock.rs @@ -145,12 +145,12 @@ impl DeadlockActor { impl Actor for DeadlockActor { async fn on_start(&mut self, ctx: &mut Context) { let recipient = ctx.recipient::(); - drop(task::spawn(async move { + task::spawn(async move { loop { recipient.send(Reminder).await; time::sleep(Duration::from_millis(100)).await } - })); + }); } } diff --git a/iroha_actor/src/envelope.rs b/iroha_actor/src/envelope.rs index 75beaa6e3f2..87718fcebf1 100644 --- a/iroha_actor/src/envelope.rs +++ b/iroha_actor/src/envelope.rs @@ -48,7 +48,9 @@ where async fn handle(&mut self, actor: &mut A, ctx: &mut Context) { match (self.channel.take(), self.msg.take()) { (Some(channel), Some(msg)) => actor.handle(ctx, msg).await.handle(channel).await, - (None, Some(msg)) => drop(actor.handle(ctx, msg).await), + (None, Some(msg)) => { + actor.handle(ctx, msg).await; + } (_, None) => unreachable!(), } } diff --git a/iroha_actor/src/lib.rs b/iroha_actor/src/lib.rs index 895fd371913..f6340e8b43a 100644 --- a/iroha_actor/src/lib.rs +++ b/iroha_actor/src/lib.rs @@ -322,12 +322,9 @@ impl InitializedActor { } .in_current_span(); #[cfg(not(feature = "deadlock_detection"))] - drop(task::spawn(actor_future)); + task::spawn(actor_future); #[cfg(feature = "deadlock_detection")] - drop(deadlock::spawn_task_with_actor_id( - address.actor_id, - actor_future, - )); + deadlock::spawn_task_with_actor_id(address.actor_id, actor_future); address } } @@ -438,9 +435,7 @@ impl Context { A: ContextHandler, { let addr = self.addr(); - drop(task::spawn( - async move { addr.do_send(message).await }.in_current_span(), - )); + task::spawn(async move { addr.do_send(message).await }.in_current_span()); } /// Sends actor specified message in some time @@ -450,13 +445,13 @@ impl Context { A: Handler, { let addr = self.addr(); - drop(task::spawn( + task::spawn( async move { time::sleep(later).await; addr.do_send(message).await } .in_current_span(), - )); + ); } /// Sends actor specified message in a loop with specified duration @@ -466,7 +461,7 @@ impl Context { A: Handler, { let addr = self.addr(); - drop(task::spawn( + task::spawn( async move { loop { time::sleep(every).await; @@ -474,7 +469,7 @@ impl Context { } } .in_current_span(), - )); + ); } /// Notifies actor with items from stream @@ -485,7 +480,7 @@ impl Context { A: Handler, { let addr = self.addr(); - drop(task::spawn( + task::spawn( async move { futures::pin_mut!(stream); while let Some(item) = stream.next().await { @@ -493,7 +488,7 @@ impl Context { } } .in_current_span(), - )); + ); } /// Notifies actor with items from stream @@ -504,7 +499,7 @@ impl Context { A: ContextHandler, { let addr = self.addr(); - drop(task::spawn( + task::spawn( async move { futures::pin_mut!(stream); while let Some(item) = stream.next().await { @@ -512,7 +507,7 @@ impl Context { } } .in_current_span(), - )); + ); } } diff --git a/iroha_client/src/client.rs b/iroha_client/src/client.rs index 754c645cb2a..5209e25dc33 100644 --- a/iroha_client/src/client.rs +++ b/iroha_client/src/client.rs @@ -227,11 +227,9 @@ impl Client { } Ok(()) }); - drop( - init_receiver - .recv() - .wrap_err("Failed to receive init message.")?, - ); + init_receiver + .recv() + .wrap_err("Failed to receive init message.")?; let _ = self.submit_transaction(transaction)?; event_receiver .recv_timeout(self.transaction_status_timout) @@ -402,7 +400,7 @@ impl EventIterator { return Err(error!("Expected `SubscriptionAccepted`.")); } Ok(_) => continue, - Err(WebSocketError::ConnectionClosed) | Err(WebSocketError::AlreadyClosed) => { + Err(WebSocketError::ConnectionClosed | WebSocketError::AlreadyClosed) => { return Err(error!("WebSocket connection closed.")) } Err(err) => return Err(err.into()), @@ -444,7 +442,7 @@ impl Iterator for EventIterator { }; } Ok(_) => continue, - Err(WebSocketError::ConnectionClosed) | Err(WebSocketError::AlreadyClosed) => { + Err(WebSocketError::ConnectionClosed | WebSocketError::AlreadyClosed) => { return None } Err(err) => return Some(Err(err.into())), diff --git a/iroha_client/src/http_client.rs b/iroha_client/src/http_client.rs index f468bbbfbca..a29bd1b2f22 100644 --- a/iroha_client/src/http_client.rs +++ b/iroha_client/src/http_client.rs @@ -62,7 +62,7 @@ impl TryFrom for Response { .headers_mut() .ok_or_else(|| error!("Failed to get headers map reference."))?; for (key, value) in response.headers() { - drop(headers.insert(key, value.clone())); + headers.insert(key, value.clone()); } response .bytes() diff --git a/iroha_data_model/src/lib.rs b/iroha_data_model/src/lib.rs index 97e0138d32c..4b0f0500295 100644 --- a/iroha_data_model/src/lib.rs +++ b/iroha_data_model/src/lib.rs @@ -162,7 +162,7 @@ pub type ValueBox = Box; Ord, IntoSchema, )] -#[allow(clippy::pub_enum_variant_names)] +#[allow(clippy::enum_variant_names)] pub enum Value { /// `u32` integer. U32(u32), @@ -1400,7 +1400,7 @@ pub mod asset { limits: MetadataLimits, ) -> Result { let mut store = Metadata::new(); - drop(store.insert_with_limits(key, value, limits)?); + store.insert_with_limits(key, value, limits)?; Ok(Asset { id, value: store.into(), @@ -2351,10 +2351,10 @@ pub mod pagination { fn from(pagination: Pagination) -> Self { let mut query_params = Self::new(); if let Some(start) = pagination.start { - drop(query_params.insert(PAGINATION_START.to_owned(), start.to_string())); + query_params.insert(PAGINATION_START.to_owned(), start.to_string()); } if let Some(limit) = pagination.limit { - drop(query_params.insert(PAGINATION_LIMIT.to_owned(), limit.to_string())); + query_params.insert(PAGINATION_LIMIT.to_owned(), limit.to_string()); } query_params } diff --git a/iroha_data_model/src/query.rs b/iroha_data_model/src/query.rs index 8b138c6666a..dce57dfdf60 100644 --- a/iroha_data_model/src/query.rs +++ b/iroha_data_model/src/query.rs @@ -20,7 +20,7 @@ use self::{account::*, asset::*, domain::*, peer::*, permissions::*, transaction use crate::{account::Account, Identifiable, Value}; /// Sized container for all possible Queries. -#[allow(clippy::pub_enum_variant_names)] +#[allow(clippy::enum_variant_names)] #[derive( Debug, Clone, diff --git a/iroha_dsl/tests/dsl.rs b/iroha_dsl/tests/dsl.rs index 656e8798f35..1cb65610f71 100644 --- a/iroha_dsl/tests/dsl.rs +++ b/iroha_dsl/tests/dsl.rs @@ -219,13 +219,11 @@ fn find_rate_and_make_exchange_isi_should_succeed() { assert_eq!(expected_seller_eth, eth_quantity); // For the btc amount we expect an error, as zero assets are purged from accounts - drop( - iroha_client - .request(FindAssetQuantityById::new(AssetId::from_names( - "btc", "crypto", "seller", "company", - ))) - .expect_err("Failed to execute Iroha Query"), - ); + iroha_client + .request(FindAssetQuantityById::new(AssetId::from_names( + "btc", "crypto", "seller", "company", + ))) + .expect_err("Failed to execute Iroha Query"); let buyer_eth_quantity = iroha_client .request(FindAssetQuantityById::new(AssetId::from_names( diff --git a/iroha_http_server/src/lib.rs b/iroha_http_server/src/lib.rs index 59dc06cb5cc..1796283625b 100644 --- a/iroha_http_server/src/lib.rs +++ b/iroha_http_server/src/lib.rs @@ -848,6 +848,7 @@ pub struct RouteBuilder<'s, State> { server: &'s mut Server, } +#[allow(clippy::type_repetition_in_bounds)] async fn wrapper_handler( fut: F, state: State, @@ -886,6 +887,7 @@ where State: Clone + Send + Sync + 'static, { /// Add GET handler at the specified url. + #[allow(clippy::type_repetition_in_bounds)] pub fn get(&mut self, handler: F) where Path: TryFrom + Send + Sync + 'static, @@ -927,6 +929,7 @@ where } /// Add POST handler at the specified url. + #[allow(clippy::type_repetition_in_bounds)] pub fn post(&mut self, handler: F) where Path: TryFrom + Send + Sync + 'static, @@ -965,6 +968,7 @@ where } /// Add PUT handler at the specified url. + #[allow(clippy::type_repetition_in_bounds)] pub fn put(&mut self, handler: F) where Path: TryFrom + Send + Sync + 'static, diff --git a/iroha_logger/src/lib.rs b/iroha_logger/src/lib.rs index 1952bd63d41..5dff12b06ca 100644 --- a/iroha_logger/src/lib.rs +++ b/iroha_logger/src/lib.rs @@ -133,7 +133,7 @@ pub mod config { const DEFAULT_MAX_LOG_LEVEL: LevelEnv = LevelEnv::DEBUG; /// Log level for reading from environment and se/deserializing - #[allow(clippy::clippy::upper_case_acronyms)] + #[allow(clippy::upper_case_acronyms)] #[derive(Debug, Deserialize, Serialize, Clone, Copy)] pub enum LevelEnv { /// Error diff --git a/iroha_macro/iroha_derive/tests/from_variant/02-double-from.stderr b/iroha_macro/iroha_derive/tests/from_variant/02-double-from.stderr index e9fff75c41a..eacb87b5a07 100644 --- a/iroha_macro/iroha_derive/tests/from_variant/02-double-from.stderr +++ b/iroha_macro/iroha_derive/tests/from_variant/02-double-from.stderr @@ -1,4 +1,4 @@ -error[E0119]: conflicting implementations of trait `std::convert::From` for type `Enum`: +error[E0119]: conflicting implementations of trait `std::convert::From` for type `Enum` --> $DIR/01-big-enum.rs:11:10 | 11 | #[derive(iroha_derive::FromVariant)] @@ -9,4 +9,4 @@ error[E0119]: conflicting implementations of trait `std::convert::From | impl std::convert::From for Enum { | ------------------------------------------ first implementation here | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `iroha_derive::FromVariant` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/iroha_macro/iroha_derive/tests/from_variant/04-container-from.stderr b/iroha_macro/iroha_derive/tests/from_variant/04-container-from.stderr index 102d836b99c..aa15ef443de 100644 --- a/iroha_macro/iroha_derive/tests/from_variant/04-container-from.stderr +++ b/iroha_macro/iroha_derive/tests/from_variant/04-container-from.stderr @@ -1,4 +1,4 @@ -error[E0119]: conflicting implementations of trait `std::convert::From` for type `Enum`: +error[E0119]: conflicting implementations of trait `std::convert::From` for type `Enum` --> $DIR/03-container-enums.rs:14:10 | 14 | #[derive(iroha_derive::FromVariant)] @@ -9,4 +9,4 @@ error[E0119]: conflicting implementations of trait `std::convert::From | impl std::convert::From for Enum { | ------------------------------------------ first implementation here | - = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `iroha_derive::FromVariant` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/iroha_network/src/lib.rs b/iroha_network/src/lib.rs index a91a24f1479..503cb212054 100644 --- a/iroha_network/src/lib.rs +++ b/iroha_network/src/lib.rs @@ -272,7 +272,7 @@ pub mod prelude { #[cfg(test)] mod tests { - #![allow(clippy::panic, clippy::expect_used, clippy::clippy::unwrap_used)] + #![allow(clippy::panic, clippy::expect_used, clippy::unwrap_used)] use std::sync::Arc; @@ -297,6 +297,7 @@ mod tests { #[tokio::test(flavor = "multi_thread")] async fn single_threaded_async() { + #[allow(clippy::unused_async)] async fn handle_request(_state: State, _request: Request) -> Result where State: Send + Sync, @@ -328,7 +329,7 @@ mod tests { #[tokio::test(flavor = "multi_thread")] async fn single_threaded_async_stateful() { - #[allow(clippy::clippy::integer_arithmetic)] + #[allow(clippy::integer_arithmetic)] async fn handle_request(state: State, _request: Request) -> Result { *state.write().await += 1; Ok(Response::Ok(b"pong".to_vec())) diff --git a/iroha_p2p/src/network.rs b/iroha_p2p/src/network.rs index b86460439e7..8339a632df5 100644 --- a/iroha_p2p/src/network.rs +++ b/iroha_p2p/src/network.rs @@ -142,7 +142,7 @@ where match Peer::new_to(id.clone(), self.broker.clone()) { Ok(peer) => { let peer = peer.start().await; - drop(self.peers.insert(id, peer)); + self.peers.insert(id, peer); } Err(e) => warn!(%e, "Unable to create peer"), } @@ -187,7 +187,7 @@ where } } PeerMessage::Disconnected(id) => { - drop(self.peers.remove(&id)); + self.peers.remove(&id); let _ = self.connected_peers.remove(&id.public_key); } PeerMessage::Message(_id, msg) => { @@ -247,7 +247,7 @@ where match Peer::new_from(id.clone(), stream, self.broker.clone()) { Ok(peer) => { let peer = peer.start().await; - drop(self.peers.insert(id, peer)); + self.peers.insert(id, peer); } Err(e) => warn!(%e, "Unable to create peer"), } diff --git a/iroha_p2p/tests/mod.rs b/iroha_p2p/tests/mod.rs index 548dbc7bd42..c3bac809191 100644 --- a/iroha_p2p/tests/mod.rs +++ b/iroha_p2p/tests/mod.rs @@ -40,7 +40,7 @@ async fn network_create() { compact_mode: false, ..LoggerConfiguration::default() }; - drop(iroha_logger::init(log_config)); + iroha_logger::init(log_config); info!("Starting network tests..."); let address = gen_address(); let broker = Broker::new(); @@ -51,7 +51,7 @@ async fn network_create() { let network = Network::::new(broker.clone(), address.clone(), public_key.clone()) .await .unwrap(); - drop(network.start().await); + network.start().await; tokio::time::sleep(delay).await; info!("Connecting to peer..."); @@ -106,7 +106,7 @@ async fn two_networks() { compact_mode: false, ..LoggerConfiguration::default() }; - drop(iroha_logger::init(log_config)); + iroha_logger::init(log_config); let public_key = iroha_crypto::PublicKey::from_str( "ed01207233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0", ) @@ -137,7 +137,7 @@ async fn two_networks() { broker: broker2.clone(), messages: Arc::clone(&messages2), }; - drop(actor2.start().await); + actor2.start().await; tokio::time::sleep(delay).await; info!("Connecting to peer..."); diff --git a/iroha_permissions_validators/src/lib.rs b/iroha_permissions_validators/src/lib.rs index 842afa61011..e9cf8f93eca 100644 --- a/iroha_permissions_validators/src/lib.rs +++ b/iroha_permissions_validators/src/lib.rs @@ -773,7 +773,7 @@ pub mod public_blockchain { return Err("Source id is not an AssetId.".to_owned()); }; let mut params = BTreeMap::new(); - drop(params.insert(ASSET_ID_TOKEN_PARAM_NAME.to_owned(), source_id.into())); + params.insert(ASSET_ID_TOKEN_PARAM_NAME.to_owned(), source_id.into()); Ok(PermissionToken::new(CAN_TRANSFER_USER_ASSETS_TOKEN, params)) } } @@ -880,10 +880,10 @@ pub mod public_blockchain { return Err("Source id is not an AssetDefinitionId.".to_owned()); }; let mut params = BTreeMap::new(); - drop(params.insert( + params.insert( ASSET_DEFINITION_ID_TOKEN_PARAM_NAME.to_owned(), object_id.into(), - )); + ); Ok(PermissionToken::new( CAN_UNREGISTER_ASSET_WITH_DEFINITION, params, @@ -992,10 +992,10 @@ pub mod public_blockchain { return Err("Destination is not an Asset.".to_owned()); }; let mut params = BTreeMap::new(); - drop(params.insert( + params.insert( ASSET_DEFINITION_ID_TOKEN_PARAM_NAME.to_owned(), asset_id.definition_id.into(), - )); + ); Ok(PermissionToken::new( CAN_MINT_USER_ASSET_DEFINITIONS_TOKEN, params, @@ -1106,10 +1106,10 @@ pub mod public_blockchain { return Err("Destination is not an Asset.".to_owned()); }; let mut params = BTreeMap::new(); - drop(params.insert( + params.insert( ASSET_DEFINITION_ID_TOKEN_PARAM_NAME.to_owned(), asset_id.definition_id.into(), - )); + ); Ok(PermissionToken::new(CAN_BURN_ASSET_WITH_DEFINITION, params)) } } @@ -1200,7 +1200,7 @@ pub mod public_blockchain { return Err("Source id is not an AssetId.".to_owned()); }; let mut params = BTreeMap::new(); - drop(params.insert(ASSET_ID_TOKEN_PARAM_NAME.to_owned(), destination_id.into())); + params.insert(ASSET_ID_TOKEN_PARAM_NAME.to_owned(), destination_id.into()); Ok(PermissionToken::new(CAN_BURN_USER_ASSETS_TOKEN, params)) } } @@ -1311,7 +1311,7 @@ pub mod public_blockchain { return Err("Source id is not an AssetId.".to_owned()); }; let mut params = BTreeMap::new(); - drop(params.insert(ASSET_ID_TOKEN_PARAM_NAME.to_owned(), object_id.into())); + params.insert(ASSET_ID_TOKEN_PARAM_NAME.to_owned(), object_id.into()); Ok(PermissionToken::new( CAN_SET_KEY_VALUE_USER_ASSETS_TOKEN, params, @@ -1407,7 +1407,7 @@ pub mod public_blockchain { return Err("Source id is not an AccountId.".to_owned()); }; let mut params = BTreeMap::new(); - drop(params.insert(ACCOUNT_ID_TOKEN_PARAM_NAME.to_owned(), object_id.into())); + params.insert(ACCOUNT_ID_TOKEN_PARAM_NAME.to_owned(), object_id.into()); Ok(PermissionToken::new( CAN_SET_KEY_VALUE_IN_USER_METADATA, params, @@ -1502,7 +1502,7 @@ pub mod public_blockchain { return Err("Source id is not an AssetId.".to_owned()); }; let mut params = BTreeMap::new(); - drop(params.insert(ASSET_ID_TOKEN_PARAM_NAME.to_owned(), object_id.into())); + params.insert(ASSET_ID_TOKEN_PARAM_NAME.to_owned(), object_id.into()); Ok(PermissionToken::new( CAN_REMOVE_KEY_VALUE_IN_USER_ASSETS, params, @@ -1598,7 +1598,7 @@ pub mod public_blockchain { return Err("Source id is not an AccountId.".to_owned()); }; let mut params = BTreeMap::new(); - drop(params.insert(ACCOUNT_ID_TOKEN_PARAM_NAME.to_owned(), object_id.into())); + params.insert(ACCOUNT_ID_TOKEN_PARAM_NAME.to_owned(), object_id.into()); Ok(PermissionToken::new( CAN_REMOVE_KEY_VALUE_IN_USER_METADATA, params, @@ -1682,7 +1682,7 @@ pub mod public_blockchain { ASSET_ID_TOKEN_PARAM_NAME.to_string() => alice_xor_id.clone().into(), }, )); - drop(domain.accounts.insert(bob_id.clone(), bob_account)); + domain.accounts.insert(bob_id.clone(), bob_account); let domains = vec![("test".to_string(), domain)]; let wsv = WorldStateView::::new(World::with(domains, BTreeSet::new())); let transfer = Instruction::Transfer(TransferBox { @@ -1764,11 +1764,11 @@ pub mod public_blockchain { ASSET_DEFINITION_ID_TOKEN_PARAM_NAME.to_string() => xor_id.clone().into(), }, )); - drop(domain.accounts.insert(bob_id.clone(), bob_account)); - drop(domain.asset_definitions.insert( + domain.accounts.insert(bob_id.clone(), bob_account); + domain.asset_definitions.insert( xor_id.clone(), AssetDefinitionEntry::new(xor_definition, alice_id.clone()), - )); + ); let domains = btreemap! { "test".to_owned() => domain }; @@ -1795,10 +1795,10 @@ pub mod public_blockchain { }, ); let mut domain = Domain::new("test"); - drop(domain.asset_definitions.insert( + domain.asset_definitions.insert( xor_id, AssetDefinitionEntry::new(xor_definition, alice_id.clone()), - )); + ); let domains = btreemap! { "test".to_owned() => domain }; @@ -1866,11 +1866,11 @@ pub mod public_blockchain { ASSET_DEFINITION_ID_TOKEN_PARAM_NAME.to_string() => xor_id.clone().into(), }, )); - drop(domain.accounts.insert(bob_id.clone(), bob_account)); - drop(domain.asset_definitions.insert( + domain.accounts.insert(bob_id.clone(), bob_account); + domain.asset_definitions.insert( xor_id, AssetDefinitionEntry::new(xor_definition, alice_id.clone()), - )); + ); let domains = btreemap! { "test".to_owned() => domain }; @@ -1899,10 +1899,10 @@ pub mod public_blockchain { }, ); let mut domain = Domain::new("test"); - drop(domain.asset_definitions.insert( + domain.asset_definitions.insert( xor_id, AssetDefinitionEntry::new(xor_definition, alice_id.clone()), - )); + ); let domains = btreemap! { "test".to_owned() => domain }; @@ -1971,11 +1971,11 @@ pub mod public_blockchain { ASSET_DEFINITION_ID_TOKEN_PARAM_NAME.to_string() => xor_id.clone().into(), }, )); - drop(domain.accounts.insert(bob_id.clone(), bob_account)); - drop(domain.asset_definitions.insert( + domain.accounts.insert(bob_id.clone(), bob_account); + domain.asset_definitions.insert( xor_id, AssetDefinitionEntry::new(xor_definition, alice_id.clone()), - )); + ); let domains = btreemap! { "test".to_owned() => domain }; @@ -2004,10 +2004,10 @@ pub mod public_blockchain { }, ); let mut domain = Domain::new("test"); - drop(domain.asset_definitions.insert( + domain.asset_definitions.insert( xor_id, AssetDefinitionEntry::new(xor_definition, alice_id.clone()), - )); + ); let domains = btreemap! { "test".to_owned() => domain }; @@ -2051,7 +2051,7 @@ pub mod public_blockchain { ASSET_ID_TOKEN_PARAM_NAME.to_string() => alice_xor_id.clone().into(), }, )); - drop(domain.accounts.insert(bob_id.clone(), bob_account)); + domain.accounts.insert(bob_id.clone(), bob_account); let domains = vec![("test".to_string(), domain)]; let wsv = WorldStateView::::new(World::with(domains, vec![])); let transfer = Instruction::Burn(BurnBox { diff --git a/iroha_schema/iroha_schema_derive/src/lib.rs b/iroha_schema/iroha_schema_derive/src/lib.rs index 839b3286386..90dc3c2a402 100644 --- a/iroha_schema/iroha_schema_derive/src/lib.rs +++ b/iroha_schema/iroha_schema_derive/src/lib.rs @@ -4,7 +4,7 @@ clippy::unwrap_used, clippy::expect_used, clippy::panic, - clippy::clippy::unimplemented + clippy::unimplemented )] use proc_macro::TokenStream; diff --git a/iroha_telemetry/src/futures.rs b/iroha_telemetry/src/futures.rs index 54db582e4e2..5893dcdc364 100644 --- a/iroha_telemetry/src/futures.rs +++ b/iroha_telemetry/src/futures.rs @@ -11,7 +11,8 @@ use tokio_stream::{Stream, StreamExt}; pub mod post_process { //! Module with telemetry post processing - #![allow(clippy::clippy::unwrap_used, clippy::fallible_impl_from)] + #![allow(clippy::unwrap_used, clippy::fallible_impl_from)] + use super::*; /// Post processed info of function diff --git a/iroha_version/iroha_version_derive/tests/ui/fail_invalid_range_equal.stderr b/iroha_version/iroha_version_derive/tests/ui/fail_invalid_range_equal.stderr index 6e9464963e0..cc53b67f019 100644 --- a/iroha_version/iroha_version_derive/tests/ui/fail_invalid_range_equal.stderr +++ b/iroha_version/iroha_version_derive/tests/ui/fail_invalid_range_equal.stderr @@ -4,7 +4,7 @@ error: The end version should be higher then the start version. 5 | declare_versioned!(VersionedMessage 1..1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `declare_versioned` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0412]: cannot find type `VersionedMessage` in this scope --> $DIR/fail_invalid_range_equal.rs:7:1 @@ -12,4 +12,4 @@ error[E0412]: cannot find type `VersionedMessage` in this scope 7 | #[version(n = 1, versioned = "VersionedMessage")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the attribute macro `version` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/iroha_version/iroha_version_derive/tests/ui/fail_invalid_range_less.stderr b/iroha_version/iroha_version_derive/tests/ui/fail_invalid_range_less.stderr index 3039f35175d..9ff539c02f6 100644 --- a/iroha_version/iroha_version_derive/tests/ui/fail_invalid_range_less.stderr +++ b/iroha_version/iroha_version_derive/tests/ui/fail_invalid_range_less.stderr @@ -4,7 +4,7 @@ error: The end version should be higher then the start version. 5 | declare_versioned!(VersionedMessage 2..1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `declare_versioned` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0412]: cannot find type `VersionedMessage` in this scope --> $DIR/fail_invalid_range_less.rs:7:1 @@ -12,4 +12,4 @@ error[E0412]: cannot find type `VersionedMessage` in this scope 7 | #[version(n = 1, versioned = "VersionedMessage")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the attribute macro `version` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/lints.toml b/lints.toml index 88097f163f4..7b26fa0fd05 100644 --- a/lints.toml +++ b/lints.toml @@ -19,10 +19,10 @@ deny = [ 'unsafe_code', 'unused', 'unused_import_braces', - 'unused_results', 'variant_size_differences', ] allow = [ + 'unused_results', 'clippy::as_conversions', 'clippy::cognitive_complexity', 'clippy::default_numeric_fallback',