From aa5f861a26f07d8f77fd59721082ce9952ccf1bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=91=BD=20mgsharm?= Date: Fri, 20 Dec 2024 11:08:15 -0800 Subject: [PATCH] clippy fixes --- tough/src/editor/mod.rs | 7 ++++--- tough/src/sign.rs | 2 +- tough/tests/test_utils.rs | 1 - tuftool/tests/test_utils.rs | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tough/src/editor/mod.rs b/tough/src/editor/mod.rs index 2e3f80ab..4a6c8de6 100644 --- a/tough/src/editor/mod.rs +++ b/tough/src/editor/mod.rs @@ -190,7 +190,8 @@ impl RepositoryEditor { }) }; - let signed_snapshot = self.build_snapshot(&signed_targets, &signed_delegated_targets)?; + let signed_snapshot = + self.build_snapshot(&signed_targets, signed_delegated_targets.as_ref())?; let signed_snapshot = SignedRole::new(signed_snapshot, &root, keys, &rng).await?; let signed_timestamp = self.build_timestamp(&signed_snapshot)?; let signed_timestamp = SignedRole::new(signed_timestamp, &root, keys, &rng).await?; @@ -669,7 +670,7 @@ impl RepositoryEditor { fn build_snapshot( &self, signed_targets: &SignedRole, - signed_delegated_targets: &Option, + signed_delegated_targets: Option<&SignedDelegatedTargets>, ) -> Result { let version = self.snapshot_version.context(error::MissingSnafu { field: "snapshot version", @@ -687,7 +688,7 @@ impl RepositoryEditor { .meta .insert("targets.json".to_owned(), targets_meta); - if let Some(signed_delegated_targets) = signed_delegated_targets.as_ref() { + if let Some(signed_delegated_targets) = signed_delegated_targets { for delegated_targets in &signed_delegated_targets.roles { let meta = Self::snapshot_meta(delegated_targets); snapshot.meta.insert( diff --git a/tough/src/sign.rs b/tough/src/sign.rs index 47810095..bb4222e8 100644 --- a/tough/src/sign.rs +++ b/tough/src/sign.rs @@ -32,7 +32,7 @@ pub trait Sign: Sync + Send { /// Implements `Sign` for a reference to any type that implements `Sign`. #[async_trait] -impl<'a, T: Sign> Sign for &'a T { +impl Sign for &T { fn tuf_key(&self) -> Key { (*self).tuf_key() } diff --git a/tough/tests/test_utils.rs b/tough/tests/test_utils.rs index 4cf17f4e..249308d2 100644 --- a/tough/tests/test_utils.rs +++ b/tough/tests/test_utils.rs @@ -14,7 +14,6 @@ use tough::IntoVec; use url::Url; /// Utilities for tests. Not every test module uses every function, so we suppress unused warnings. - pub const DATA_1: &str = "123\n456\n789\n0\n"; pub const DATA_2: &str = "abc\ndef\nhij\nk\n"; pub const DATA_3: &str = "!@#\n$%^\n&*(\n)\n"; diff --git a/tuftool/tests/test_utils.rs b/tuftool/tests/test_utils.rs index 4e3f31e1..384654d8 100644 --- a/tuftool/tests/test_utils.rs +++ b/tuftool/tests/test_utils.rs @@ -8,7 +8,6 @@ use tough::IntoVec; use url::Url; /// Utilities for tests. Not every test module uses every function, so we suppress unused warnings. - /// Returns the path to our test data directory #[allow(unused)] pub fn test_data() -> PathBuf {