Skip to content

Commit

Permalink
[main] Upgrade Rust toolchain (#6206)
Browse files Browse the repository at this point in the history
This is our monthly toolchain upgrade to the latest stable version. Since iotedge/edgelet is a binary package, we want to be tracking Rust compiler releases closely in the event a stdlib vulnerability is found. We do not pin to "stable", however, since that has caused pipeline breakage when some code patterns are made illegal (like in the upgrade from 1.47 to 1.48 [^0]) or, more often, clippy lints are added.

- Add `#[must_use]` directives on methods returning `Self`
- Change `unwrap_or_else(...::new)` to `unwrap_or_default` where appropriate
- Box `CertIssuanceOptions` in `EdgeCa` enum due to large variant size difference otherwise

## Azure IoT Edge PR checklist:
  • Loading branch information
onalante-msft authored Apr 5, 2022
1 parent e185b74 commit bf3f444
Show file tree
Hide file tree
Showing 14 changed files with 99 additions and 62 deletions.
62 changes: 37 additions & 25 deletions edgelet/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions edgelet/edgelet-core/src/certificate_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ impl CertificateProperties {
&self.common_name
}

#[must_use]
pub fn with_common_name(mut self, common_name: String) -> Self {
self.common_name = common_name;
self
Expand All @@ -52,6 +53,7 @@ impl CertificateProperties {
&self.certificate_type
}

#[must_use]
pub fn with_certificate_type(mut self, certificate_type: CertificateType) -> Self {
self.certificate_type = certificate_type;
self
Expand All @@ -61,6 +63,7 @@ impl CertificateProperties {
&self.alias
}

#[must_use]
pub fn with_alias(mut self, alias: String) -> Self {
self.alias = alias;
self
Expand All @@ -70,6 +73,7 @@ impl CertificateProperties {
&self.issuer
}

#[must_use]
pub fn with_issuer(mut self, issuer: CertificateIssuer) -> Self {
self.issuer = issuer;
self
Expand All @@ -79,6 +83,7 @@ impl CertificateProperties {
self.dns_san_entries.as_ref().map(AsRef::as_ref)
}

#[must_use]
pub fn with_dns_san_entries(mut self, entries: Vec<String>) -> Self {
self.dns_san_entries = Some(entries);
self
Expand All @@ -88,6 +93,7 @@ impl CertificateProperties {
self.ip_entries.as_ref().map(AsRef::as_ref)
}

#[must_use]
pub fn with_ip_entries(mut self, entries: Vec<String>) -> Self {
self.ip_entries = Some(entries);
self
Expand Down
2 changes: 2 additions & 0 deletions edgelet/edgelet-core/src/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ impl IdentitySpec {
self.generation_id.as_ref().map(AsRef::as_ref)
}

#[must_use]
pub fn with_generation_id(mut self, generation_id: String) -> Self {
self.generation_id = Some(generation_id);
self
Expand All @@ -61,6 +62,7 @@ impl IdentitySpec {
self.managed_by.as_ref().map(AsRef::as_ref)
}

#[must_use]
pub fn with_managed_by(mut self, managed_by: String) -> Self {
self.managed_by = Some(managed_by);
self
Expand Down
Loading

0 comments on commit bf3f444

Please sign in to comment.