From b6be4f73b447eafaaad1742c51f93fd0a0334ad8 Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 18 Apr 2024 19:45:13 +0300 Subject: [PATCH] chore: Clippy lints / github settings Remove legacy CI, made clippy happy with automatic fixes Signed-off-by: Ryan --- .github/settings.yml | 19 ++++++++----------- .../api/src/chronicle_graphql/cursor_query.rs | 2 +- crates/api/src/lib.rs | 2 +- crates/api/src/persistence/mod.rs | 2 -- crates/async-sawtooth-sdk/src/ledger.rs | 1 - crates/chronicle-protocol/src/protocol.rs | 3 +-- crates/common/src/prov/model/from_json_ld.rs | 2 +- crates/common/src/prov/model/mod.rs | 6 +++--- 8 files changed, 15 insertions(+), 22 deletions(-) diff --git a/.github/settings.yml b/.github/settings.yml index eb81fce99..eba353b6a 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -124,11 +124,8 @@ branches: # this branch contexts: - DCO - - pre-commit - Commit Message Lint - - License Compliance - cargo-checkmate - - continuous-integration/jenkins/pr-head # Required. Enforce all configured restrictions for administrators. Set # to true to enforce required status checks for repository administrators. # Set to null to disable. @@ -143,11 +140,11 @@ branches: restrictions: autolinks: - - key_prefix: 'SXT-' - url_template: 'https://blockchaintp.atlassian.net/browse/SXT-' - - key_prefix: 'BCP-' - url_template: 'https://blockchaintp.atlassian.net/browse/BCP-' - - key_prefix: 'CHRON-' - url_template: 'https://blockchaintp.atlassian.net/browse/CHRON-' - - key_prefix: 'DCP-' - url_template: 'https://blockchaintp.atlassian.net/browse/DCP-' + - key_prefix: "SXT-" + url_template: "https://blockchaintp.atlassian.net/browse/SXT-" + - key_prefix: "BCP-" + url_template: "https://blockchaintp.atlassian.net/browse/BCP-" + - key_prefix: "CHRON-" + url_template: "https://blockchaintp.atlassian.net/browse/CHRON-" + - key_prefix: "DCP-" + url_template: "https://blockchaintp.atlassian.net/browse/DCP-" diff --git a/crates/api/src/chronicle_graphql/cursor_query.rs b/crates/api/src/chronicle_graphql/cursor_query.rs index 9ecbbce68..0f68b64eb 100644 --- a/crates/api/src/chronicle_graphql/cursor_query.rs +++ b/crates/api/src/chronicle_graphql/cursor_query.rs @@ -34,7 +34,7 @@ where T: OutputType, I: IntoIterator, { - let rx = Vec::from_iter(rx.into_iter()); + let rx = Vec::from_iter(rx); let mut gql = async_graphql::connection::Connection::new( rx.first().map(|(_, _total)| start > 0).unwrap_or(false), rx.first() diff --git a/crates/api/src/lib.rs b/crates/api/src/lib.rs index 2be4ffcb0..86afbed18 100644 --- a/crates/api/src/lib.rs +++ b/crates/api/src/lib.rs @@ -264,7 +264,7 @@ where pool.get()? .build_transaction() .run(|connection| connection.run_pending_migrations(MIGRATIONS).map(|_| ())) - .map_err(|migration| StoreError::DbMigration(migration))?; + .map_err(StoreError::DbMigration)?; // Append namespace bindings and system namespace store.namespace_binding( diff --git a/crates/api/src/persistence/mod.rs b/crates/api/src/persistence/mod.rs index 7c7418cff..a183a3ec2 100644 --- a/crates/api/src/persistence/mod.rs +++ b/crates/api/src/persistence/mod.rs @@ -1176,7 +1176,6 @@ impl Store { .select(schema::entity::external_id) .load::(connection)? { - let used = used; model.used(namespaceid.clone(), &id, &EntityId::from_external_id(used)); } @@ -1189,7 +1188,6 @@ impl Store { .select(schema::activity::external_id) .load::(connection)? { - let wasinformedby = wasinformedby; model.was_informed_by( namespaceid.clone(), &id, diff --git a/crates/async-sawtooth-sdk/src/ledger.rs b/crates/async-sawtooth-sdk/src/ledger.rs index f8d805e40..6e20889ae 100644 --- a/crates/async-sawtooth-sdk/src/ledger.rs +++ b/crates/async-sawtooth-sdk/src/ledger.rs @@ -493,7 +493,6 @@ impl< } let channel = self.channel.clone(); - let from_block = from_block; let event_stream = channel.recv_stream::().await?; let event_stream = event_stream.then(move |events| { let event_type = event_type.clone(); diff --git a/crates/chronicle-protocol/src/protocol.rs b/crates/chronicle-protocol/src/protocol.rs index 5ada873a2..ddc0e6072 100644 --- a/crates/chronicle-protocol/src/protocol.rs +++ b/crates/chronicle-protocol/src/protocol.rs @@ -159,8 +159,7 @@ impl messages::Event { /// `Submission` protocol buffer serializer pub fn serialize_submission(submission: &messages::Submission) -> Vec { - let mut buf = Vec::new(); - buf.reserve(submission.encoded_len()); + let mut buf = Vec::with_capacity(submission.encoded_len()); submission.encode(&mut buf).unwrap(); buf } diff --git a/crates/common/src/prov/model/from_json_ld.rs b/crates/common/src/prov/model/from_json_ld.rs index 23be0b795..4697dd324 100644 --- a/crates/common/src/prov/model/from_json_ld.rs +++ b/crates/common/src/prov/model/from_json_ld.rs @@ -214,7 +214,7 @@ impl ProvModel { map.get(Chronicle::Value.as_iri().as_str()) { if array.len() == 1 { - let o = array.get(0).unwrap(); + let o = array.first().unwrap(); let serde_object = &o["@value"]; if let serde_json::Value::Object(object) = serde_object { diff --git a/crates/common/src/prov/model/mod.rs b/crates/common/src/prov/model/mod.rs index 0da8a3742..0be0b5871 100644 --- a/crates/common/src/prov/model/mod.rs +++ b/crates/common/src/prov/model/mod.rs @@ -484,7 +484,7 @@ impl ProvModel { ) { self.derivation .entry((namespace_id, id.clone())) - .or_insert_with(BTreeSet::new) + .or_default() .insert(Derivation { typ, generated_id: id, @@ -517,11 +517,11 @@ impl ProvModel { }; self.delegation .entry((namespace_id.clone(), responsible_id.clone())) - .or_insert_with(BTreeSet::new) + .or_default() .insert(delegation.clone()); self.acted_on_behalf_of .entry((namespace_id.clone(), delegate_id.clone())) - .or_insert_with(BTreeSet::new) + .or_default() .insert(delegation); }