aws-samples / aws-kms-xks-proxy

AWS KMS External Keystore (XKS) Proxy reference implementation
Apache License 2.0
35 stars 11 forks source link

Fix clippy warnings and upgrade toml crate from 0.6.x to 0.7.x #43

Closed hansonchar closed 1 year ago

hansonchar commented 1 year ago

Issue #, if available:

Description of changes:

  1. Apparently the latest cargo 1.67.0 is stricter on some formatting styles, emitting warnings upon cargo clippy. This PR fixes that.
  2. The toml crate has just upgraded to 0.7.x so including it as well.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Warnings on cargo clippy prior to this change:

warning: variables can be used directly in the `format!` string
   --> src/tls.rs:105:52
    |
105 |         e => rustls::Error::InvalidCertificateData(format!("invalid peer certificate: {}", e)),
    |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
    = note: `#[warn(clippy::uninlined_format_args)]` on by default
help: change this to
    |
105 -         e => rustls::Error::InvalidCertificateData(format!("invalid peer certificate: {}", e)),
105 +         e => rustls::Error::InvalidCertificateData(format!("invalid peer certificate: {e}")),
    |

warning: variables can be used directly in the `format!` string
   --> src/xks_proxy/handlers/get_health_status.rs:155:20
    |
155 |         ekmVendor: format!("{} (serial number: {})", manufacturer_id, serial_number),
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
    |
155 -         ekmVendor: format!("{} (serial number: {})", manufacturer_id, serial_number),
155 +         ekmVendor: format!("{manufacturer_id} (serial number: {serial_number})"),
    |

warning: `xks-proxy` (bin "xks-proxy") generated 2 warnings

Check any applicable: