Skip to content

Commit

Permalink
Bump rust to 1.78.0 in actions runner
Browse files Browse the repository at this point in the history
Also addressed new clippy warnings.
  • Loading branch information
jpculp committed Jul 8, 2024
1 parent eb5e25e commit ac5d315
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 108 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [develop]

env:
# From-scratch builds with incremental compilation enabled adds unneeded performance and disk overhead.
# From-scratch builds with incremental compilation enabled adds unneeded performance and disk overhead.
CARGO_INCREMENTAL: "0"

jobs:
Expand All @@ -33,7 +33,7 @@ jobs:
key: ${{ hashFiles('.github/cache_bust') }}-${{ runner.os }}-${{ matrix.make_target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ hashFiles('.github/cache_bust') }}-${{ runner.os }}-${{ matrix.make_target }}
- run: rustup default 1.76.0
- run: rustup default 1.78.0
- run: rustup component add rustfmt
- run: rustup component add clippy
- run: make ${{ matrix.make_target }}
8 changes: 4 additions & 4 deletions tough-kms/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub struct KmsKeySource {
pub profile: Option<String>,
/// Identifies an asymmetric CMK in AWS KMS.
pub key_id: String,
/// KmsClient Object to query AWS KMS
/// `KmsClient` Object to query AWS KMS
pub client: Option<KmsClient>,
/// Signing Algorithm to be used for the message digest, only `KmsSigningAlgorithm::RsassaPssSha256` is supported at present.
pub signing_algorithm: KmsSigningAlgorithm,
Expand Down Expand Up @@ -146,7 +146,7 @@ pub struct KmsRsaKey {
key_id: String,
/// Aws account profile
profile: Option<String>,
/// KmsClient Object to query AWS KMS
/// `KmsClient` Object to query AWS KMS
client: Option<KmsClient>,
/// Public Key corresponding to Customer Managed Key
public_key: Decoded<RsaPem>,
Expand All @@ -173,10 +173,10 @@ impl Sign for KmsRsaKey {
Key::Rsa {
keyval: RsaKey {
public: self.public_key.clone(),
_extra: HashMap::new(),
extra: HashMap::new(),
},
scheme: RsaScheme::RsassaPssSha256,
_extra: HashMap::new(),
extra: HashMap::new(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion tough/src/datastore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use tokio::sync::{Mutex, RwLock, RwLockReadGuard, RwLockWriteGuard};
pub(crate) struct Datastore {
/// A lock around retrieving the datastore path.
path_lock: Arc<RwLock<DatastorePath>>,
/// A lock to treat the system_time function as a critical section.
/// A lock to treat the `system_time` function as a critical section.
time_lock: Arc<Mutex<()>>,
}

Expand Down
22 changes: 11 additions & 11 deletions tough/src/editor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl RepositoryEditor {

/// Given a `tough::Repository` and the path to a valid root.json, create a
/// `RepositoryEditor`. This `RepositoryEditor` will include all of the targets
/// and bits of _extra metadata from the roles included. It will not, however,
/// and bits of extra metadata from the roles included. It will not, however,
/// include the versions or expirations and the user is expected to set them.
pub async fn from_repo<P>(root_path: P, repo: Repository) -> Result<RepositoryEditor>
where
Expand Down Expand Up @@ -232,7 +232,7 @@ impl RepositoryEditor {
Ok(self)
}

/// Add an existing `Snapshot` to the repository. Only the `_extra` data
/// Add an existing `Snapshot` to the repository. Only the `extra` data
/// is preserved
pub fn snapshot(&mut self, snapshot: Snapshot) -> Result<&mut Self> {
ensure!(
Expand All @@ -242,11 +242,11 @@ impl RepositoryEditor {
supported: SPEC_VERSION
}
);
self.snapshot_extra = Some(snapshot._extra);
self.snapshot_extra = Some(snapshot.extra);
Ok(self)
}

/// Add an existing `Timestamp` to the repository. Only the `_extra` data
/// Add an existing `Timestamp` to the repository. Only the `extra` data
/// is preserved
pub fn timestamp(&mut self, timestamp: Timestamp) -> Result<&mut Self> {
ensure!(
Expand All @@ -256,7 +256,7 @@ impl RepositoryEditor {
supported: SPEC_VERSION
}
);
self.timestamp_extra = Some(timestamp._extra);
self.timestamp_extra = Some(timestamp.extra);
Ok(self)
}

Expand Down Expand Up @@ -709,11 +709,11 @@ impl RepositoryEditor {
SnapshotMeta {
hashes: Some(Hashes {
sha256: role.sha256.to_vec().into(),
_extra: HashMap::new(),
extra: HashMap::new(),
}),
length: Some(role.length),
version: role.signed.signed.version(),
_extra: HashMap::new(),
extra: HashMap::new(),
}
}

Expand All @@ -725,15 +725,15 @@ impl RepositoryEditor {
let expires = self.timestamp_expires.context(error::MissingSnafu {
field: "timestamp expiration",
})?;
let _extra = self.timestamp_extra.clone().unwrap_or_default();
let extra = self.timestamp_extra.clone().unwrap_or_default();
let mut timestamp = Timestamp::new(SPEC_VERSION.to_string(), version, expires);

// Timestamp stores metadata about snapshot
let snapshot_meta = Self::timestamp_meta(signed_snapshot);
timestamp
.meta
.insert("snapshot.json".to_owned(), snapshot_meta);
timestamp._extra = _extra;
timestamp.extra = extra;

Ok(timestamp)
}
Expand All @@ -747,11 +747,11 @@ impl RepositoryEditor {
TimestampMeta {
hashes: Hashes {
sha256: role.sha256.to_vec().into(),
_extra: HashMap::new(),
extra: HashMap::new(),
},
length: role.length,
version: role.signed.signed.version(),
_extra: HashMap::new(),
extra: HashMap::new(),
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions tough/src/editor/targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub struct TargetsEditor {
/// New roles that were created with the editor
new_roles: Option<Vec<DelegatedRole>>,

_extra: Option<HashMap<String, Value>>,
extra: Option<HashMap<String, Value>>,

limits: Option<Limits>,

Expand All @@ -96,7 +96,7 @@ impl TargetsEditor {
expires: None,
name: name.to_string(),
new_roles: None,
_extra: None,
extra: None,
limits: None,
transport: None,
}
Expand All @@ -114,7 +114,7 @@ impl TargetsEditor {
expires: None,
name: name.to_string(),
new_roles: None,
_extra: Some(targets._extra),
extra: Some(targets.extra),
limits: None,
transport: None,
}
Expand Down Expand Up @@ -160,7 +160,7 @@ impl TargetsEditor {
expires: None,
name: name.to_string(),
new_roles: None,
_extra: Some(targets._extra),
extra: Some(targets.extra),
limits: Some(repo.limits),
transport: Some(repo.transport),
})
Expand Down Expand Up @@ -480,15 +480,15 @@ impl TargetsEditor {
}
}

let _extra = self._extra.clone().unwrap_or_default();
let extra = self.extra.clone().unwrap_or_default();
Ok(DelegatedTargets {
name: self.name.clone(),
targets: Targets {
spec_version: SPEC_VERSION.to_string(),
version,
expires,
targets,
_extra,
extra,
delegations,
},
})
Expand Down
4 changes: 2 additions & 2 deletions tough/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,15 +612,15 @@ pub enum Error {
source: schema::Error,
},

/// SignedDelegatedTargets has more than 1 signed targets
/// `SignedDelegatedTargets` has more than 1 signed targets
#[snafu(display("Exactly 1 role was required, but {} were created", count))]
InvalidRoleCount { count: usize },

/// Could not create a targets map
#[snafu(display("Could not create a targets map: {}", source))]
TargetsMap { source: schema::Error },

/// A key_holder wasn't set
/// A `key_holder` wasn't set
#[snafu(display("A key holder must be set"))]
NoKeyHolder,

Expand Down
2 changes: 1 addition & 1 deletion tough/src/schema/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ where
deserializer.deserialize_map(Visitor)
}

/// Deserializes the `_extra` field on roles, skipping the `_type` tag.
/// Deserializes the `extra` field on roles, skipping the `_type` tag.
pub(super) fn extra_skip_type<'de, D>(
deserializer: D,
) -> Result<HashMap<String, serde_json::Value>, D::Error>
Expand Down
30 changes: 15 additions & 15 deletions tough/src/schema/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub enum Key {
scheme: RsaScheme,
/// Any additional fields read during deserialization; will not be used.
#[serde(flatten)]
_extra: HashMap<String, Value>,
extra: HashMap<String, Value>,
},
/// An Ed25519 key.
Ed25519 {
Expand All @@ -55,19 +55,19 @@ pub enum Key {
scheme: Ed25519Scheme,
/// Any additional fields read during deserialization; will not be used.
#[serde(flatten)]
_extra: HashMap<String, Value>,
extra: HashMap<String, Value>,
},
/// An EcdsaKey.
/// An Ecdsa key.
Ecdsa {
/// The Ecdsa key.
keyval: EcdsaKey,
/// Denotes the key's signature scheme.
scheme: EcdsaScheme,
/// Any additional fields read during deserialization; will not be used.
#[serde(flatten)]
_extra: HashMap<String, Value>,
extra: HashMap<String, Value>,
},
/// An EcdsaKey with the old key type.
/// An Ecdsa key with the old key type.
#[serde(rename = "ecdsa-sha2-nistp256")]
EcdsaOld {
/// The Ecdsa key.
Expand All @@ -76,7 +76,7 @@ pub enum Key {
scheme: EcdsaScheme,
/// Any additional fields read during deserialization; will not be used.
#[serde(flatten)]
_extra: HashMap<String, Value>,
extra: HashMap<String, Value>,
},
}

Expand All @@ -96,7 +96,7 @@ pub struct RsaKey {

/// Any additional fields read during deserialization; will not be used.
#[serde(flatten)]
pub _extra: HashMap<String, Value>,
pub extra: HashMap<String, Value>,
}

/// Used to identify the `EdDSA` signature scheme in use.
Expand All @@ -115,7 +115,7 @@ pub struct Ed25519Key {

/// Any additional fields read during deserialization; will not be used.
#[serde(flatten)]
pub _extra: HashMap<String, Value>,
pub extra: HashMap<String, Value>,
}

/// Used to identify the ECDSA signature scheme in use.
Expand All @@ -135,7 +135,7 @@ pub struct EcdsaKey {

/// Any additional fields read during deserialization; will not be used.
#[serde(flatten)]
pub _extra: HashMap<String, Value>,
pub extra: HashMap<String, Value>,
}

impl Key {
Expand Down Expand Up @@ -201,20 +201,20 @@ impl FromStr for Key {
Ok(Key::Rsa {
keyval: RsaKey {
public,
_extra: HashMap::new(),
extra: HashMap::new(),
},
scheme: RsaScheme::RsassaPssSha256,
_extra: HashMap::new(),
extra: HashMap::new(),
})
} else if let Ok(public) = serde_plain::from_str::<Decoded<Hex>>(s) {
if public.len() == ring::signature::ED25519_PUBLIC_KEY_LEN {
Ok(Key::Ed25519 {
keyval: Ed25519Key {
public,
_extra: HashMap::new(),
extra: HashMap::new(),
},
scheme: Ed25519Scheme::Ed25519,
_extra: HashMap::new(),
extra: HashMap::new(),
})
} else {
Err(KeyParseError(()))
Expand All @@ -223,10 +223,10 @@ impl FromStr for Key {
Ok(Key::Ecdsa {
keyval: EcdsaKey {
public,
_extra: HashMap::new(),
extra: HashMap::new(),
},
scheme: EcdsaScheme::EcdsaSha2Nistp256,
_extra: HashMap::new(),
extra: HashMap::new(),
})
} else {
Err(KeyParseError(()))
Expand Down
Loading

0 comments on commit ac5d315

Please sign in to comment.