From 1cc7931032f0d237eba58768f662a540abe726de Mon Sep 17 00:00:00 2001 From: Nugine Date: Wed, 18 Jan 2023 16:09:35 +0800 Subject: [PATCH 01/10] Bump Rust MSRV to 1.63.0 --- .github/workflows/ci.yml | 2 +- .github/workflows/claim-crate-names.yml | 2 +- .github/workflows/pull-request-bot.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/update-sdk-next.yml | 2 +- CHANGELOG.next.toml | 6 ++++++ .../amazon/smithy/rust/codegen/core/testutil/Rust.kt | 2 +- gradle.properties | 2 +- rust-toolchain.toml | 2 +- tools/Dockerfile | 2 +- 10 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39e1d7b17d..71d3987794 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ on: type: boolean env: - rust_version: 1.62.1 + rust_version: 1.63.0 rust_toolchain_components: clippy,rustfmt jobs: diff --git a/.github/workflows/claim-crate-names.yml b/.github/workflows/claim-crate-names.yml index 5b0b36677a..402c83bc7e 100644 --- a/.github/workflows/claim-crate-names.yml +++ b/.github/workflows/claim-crate-names.yml @@ -10,7 +10,7 @@ concurrency: cancel-in-progress: true env: - rust_version: 1.62.1 + rust_version: 1.63.0 name: Claim unpublished crate names on crates.io run-name: ${{ github.workflow }} diff --git a/.github/workflows/pull-request-bot.yml b/.github/workflows/pull-request-bot.yml index 98440e04ae..ddb1be4a36 100644 --- a/.github/workflows/pull-request-bot.yml +++ b/.github/workflows/pull-request-bot.yml @@ -28,7 +28,7 @@ concurrency: env: java_version: 11 - rust_version: 1.62.1 + rust_version: 1.63.0 rust_toolchain_components: clippy,rustfmt apt_dependencies: libssl-dev gnuplot jq diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b4ac6c289c..1a49acd209 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ concurrency: cancel-in-progress: true env: - rust_version: 1.62.1 + rust_version: 1.63.0 name: Release smithy-rs run-name: ${{ github.workflow }} - ${{ inputs.dry_run && 'Dry run' || 'Production run' }} diff --git a/.github/workflows/update-sdk-next.yml b/.github/workflows/update-sdk-next.yml index 8fca2bbc62..fd6082351e 100644 --- a/.github/workflows/update-sdk-next.yml +++ b/.github/workflows/update-sdk-next.yml @@ -32,7 +32,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: 1.62.1 + toolchain: 1.63.0 - name: Delete old SDK run: | - name: Generate a fresh SDK diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index 46ae826dff..304e2a41e7 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -11,6 +11,12 @@ # meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client | server | all"} # author = "rcoh" +[[smithy-rs]] +message = "Upgrade Rust MSRV to 1.63.0" +references = ["smithy-rs#2222"] +meta = { "breaking" = true, "tada" = true, "bug" = false, "target" = "all" } +author = "Nugine" + [[smithy-rs]] message = "`@sparse` list shapes and map shapes with constraint traits and with constrained members are now supported" references = ["smithy-rs#2213"] diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt index a8567c4db4..9a9e3c3be0 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt @@ -101,7 +101,7 @@ object TestWorkspace { // help rust select the right version when we run cargo test // TODO(https://github.com/awslabs/smithy-rs/issues/2048): load this from the msrv property using a // method as we do for runtime crate versions - "[toolchain]\nchannel = \"1.62.1\"\n", + "[toolchain]\nchannel = \"1.63.0\"\n", ) // ensure there at least an empty lib.rs file to avoid broken crates newProject.resolve("src").mkdirs() diff --git a/gradle.properties b/gradle.properties index 3f8bd83df3..3e4a3bec1e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ # # Rust MSRV (entered into the generated README) -rust.msrv=1.62.1 +rust.msrv=1.63.0 org.gradle.jvmargs=-Xmx1024M diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 77c704ff6b..6a423bf434 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.62.1" +channel = "1.63.0" diff --git a/tools/Dockerfile b/tools/Dockerfile index 9a45c5b0f5..0f73846633 100644 --- a/tools/Dockerfile +++ b/tools/Dockerfile @@ -6,7 +6,7 @@ # This is the base Docker build image used by CI ARG base_image=public.ecr.aws/amazonlinux/amazonlinux:2 -ARG rust_stable_version=1.62.1 +ARG rust_stable_version=1.63.0 ARG rust_nightly_version=nightly-2022-11-16 FROM ${base_image} AS bare_base_image From 7a1ca2e0e9e8611faca486524cb9a4ab714824e0 Mon Sep 17 00:00:00 2001 From: Nugine Date: Wed, 18 Jan 2023 22:06:00 +0800 Subject: [PATCH 02/10] Fix clippy lints for rust-runtime Fix clippy::field_reassign_with_default Fix clippy::useless_vec Fix clippy::needless_question_mark Fix clippy::zero_prefixed_literal Fix clippy::single_component_path_imports Fix clippy::err_expect Allow clippy::type_complexity Allow clippy::enum_variant_names Allow clippy::bool_assert_comparison Allow clippy::derive_partial_eq_without_eq --- rust-runtime/aws-smithy-checksums/src/lib.rs | 3 +-- .../src/middleware/pytests/layer.rs | 3 ++- .../aws-smithy-http-server-python/src/tls/listener.rs | 4 ++-- rust-runtime/aws-smithy-http-server-python/src/util.rs | 2 ++ .../aws-smithy-http-server/src/proto/rest/router.rs | 1 + rust-runtime/aws-smithy-http/src/body.rs | 1 + rust-runtime/aws-smithy-http/src/event_stream/sender.rs | 4 +--- rust-runtime/aws-smithy-types/benches/base64.rs | 2 +- rust-runtime/aws-smithy-types/src/retry.rs | 2 ++ rust-runtime/aws-smithy-types/src/timeout.rs | 2 ++ rust-runtime/aws-smithy-xml/src/decode.rs | 1 + rust-runtime/inlineable/src/endpoint_lib/host.rs | 2 ++ rust-runtime/inlineable/src/endpoint_lib/parse_url.rs | 2 ++ rust-runtime/inlineable/src/endpoint_lib/partition.rs | 6 ++++-- 14 files changed, 24 insertions(+), 11 deletions(-) diff --git a/rust-runtime/aws-smithy-checksums/src/lib.rs b/rust-runtime/aws-smithy-checksums/src/lib.rs index ce422fe5ee..0361fa9a94 100644 --- a/rust-runtime/aws-smithy-checksums/src/lib.rs +++ b/rust-runtime/aws-smithy-checksums/src/lib.rs @@ -379,8 +379,7 @@ mod tests { fn test_checksum_algorithm_returns_error_for_unknown() { let error = "some invalid checksum algorithm" .parse::() - .err() - .expect("it should error"); + .expect_err("it should error"); assert_eq!( "some invalid checksum algorithm", error.checksum_algorithm() diff --git a/rust-runtime/aws-smithy-http-server-python/src/middleware/pytests/layer.rs b/rust-runtime/aws-smithy-http-server-python/src/middleware/pytests/layer.rs index 118b4e7cf8..506e5a6c20 100644 --- a/rust-runtime/aws-smithy-http-server-python/src/middleware/pytests/layer.rs +++ b/rust-runtime/aws-smithy-http-server-python/src/middleware/pytests/layer.rs @@ -253,6 +253,7 @@ fn simple_request(body: &'static str) -> Request { .expect("could not create request") } +#[allow(clippy::type_complexity)] fn spawn_service( layer: L, ) -> ( @@ -306,7 +307,7 @@ fn py_handler(code: &str) -> PyMiddlewareHandler { .get_item("middleware") .expect("your handler must be named `middleware`") .into(); - Ok::<_, PyErr>(PyMiddlewareHandler::new(py, handler)?) + PyMiddlewareHandler::new(py, handler) }) .unwrap() } diff --git a/rust-runtime/aws-smithy-http-server-python/src/tls/listener.rs b/rust-runtime/aws-smithy-http-server-python/src/tls/listener.rs index 345e0e24ab..fb4f759f89 100644 --- a/rust-runtime/aws-smithy-http-server-python/src/tls/listener.rs +++ b/rust-runtime/aws-smithy-http-server-python/src/tls/listener.rs @@ -214,7 +214,7 @@ mod tests { fn client_config_with_cert(cert: &rcgen::Certificate) -> ClientConfig { let mut roots = RootCertStore::empty(); - roots.add_parsable_certificates(&vec![cert.serialize_der().unwrap()]); + roots.add_parsable_certificates(&[cert.serialize_der().unwrap()]); ClientConfig::builder() .with_safe_defaults() .with_root_certificates(roots) @@ -223,7 +223,7 @@ mod tests { fn cert_with_invalid_date() -> rcgen::Certificate { let mut params = rcgen::CertificateParams::new(vec!["localhost".to_string()]); - params.not_after = rcgen::date_time_ymd(1970, 01, 01); + params.not_after = rcgen::date_time_ymd(1970, 1, 1); rcgen::Certificate::from_params(params).unwrap() } diff --git a/rust-runtime/aws-smithy-http-server-python/src/util.rs b/rust-runtime/aws-smithy-http-server-python/src/util.rs index b420c26fd4..a3227f0441 100644 --- a/rust-runtime/aws-smithy-http-server-python/src/util.rs +++ b/rust-runtime/aws-smithy-http-server-python/src/util.rs @@ -9,6 +9,7 @@ pub mod error; use pyo3::{PyAny, PyObject, PyResult, PyTypeInfo, Python}; // Captures some information about a Python function. +#[allow(clippy::derive_partial_eq_without_eq)] // TODO: derive Eq? #[derive(Debug, PartialEq)] pub struct FuncMetadata { pub name: String, @@ -131,6 +132,7 @@ async def async_func(): }) } + #[allow(clippy::bool_assert_comparison)] #[test] fn check_if_is_optional_of() -> PyResult<()> { pyo3::prepare_freethreaded_python(); diff --git a/rust-runtime/aws-smithy-http-server/src/proto/rest/router.rs b/rust-runtime/aws-smithy-http-server/src/proto/rest/router.rs index 1d55f676d6..bcf5f10c43 100644 --- a/rust-runtime/aws-smithy-http-server/src/proto/rest/router.rs +++ b/rust-runtime/aws-smithy-http-server/src/proto/rest/router.rs @@ -16,6 +16,7 @@ use tower::Service; use thiserror::Error; /// An AWS REST routing error. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Debug, Error, PartialEq)] pub enum Error { /// Operation not found. diff --git a/rust-runtime/aws-smithy-http/src/body.rs b/rust-runtime/aws-smithy-http/src/body.rs index 5e9b4fbf2d..8fea913b2b 100644 --- a/rust-runtime/aws-smithy-http/src/body.rs +++ b/rust-runtime/aws-smithy-http/src/body.rs @@ -277,6 +277,7 @@ mod test { assert_eq!(SdkBody::from("").size_hint().exact(), Some(0)); } + #[allow(clippy::bool_assert_comparison)] #[test] fn valid_eos() { assert_eq!(SdkBody::from("hello").is_end_stream(), false); diff --git a/rust-runtime/aws-smithy-http/src/event_stream/sender.rs b/rust-runtime/aws-smithy-http/src/event_stream/sender.rs index 8ecc1b7fd4..fb7af53714 100644 --- a/rust-runtime/aws-smithy-http/src/event_stream/sender.rs +++ b/rust-runtime/aws-smithy-http/src/event_stream/sender.rs @@ -228,9 +228,7 @@ mod tests { type Input = TestServiceError; fn marshall(&self, _input: Self::Input) -> Result { - Err(Message::read_from(&b""[..]) - .err() - .expect("this should always fail")) + Err(Message::read_from(&b""[..]).expect_err("this should always fail")) } } diff --git a/rust-runtime/aws-smithy-types/benches/base64.rs b/rust-runtime/aws-smithy-types/benches/base64.rs index d29654b059..0539c190ff 100644 --- a/rust-runtime/aws-smithy-types/benches/base64.rs +++ b/rust-runtime/aws-smithy-types/benches/base64.rs @@ -4,7 +4,6 @@ */ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; -use rand; use rand::distributions::{Alphanumeric, DistString}; /// Generates a random string of a given length @@ -155,6 +154,7 @@ mod handrolled_base64 { } /// Failure to decode a base64 value. + #[allow(clippy::enum_variant_names)] #[derive(Debug, Clone, Eq, PartialEq)] #[non_exhaustive] pub enum DecodeError { diff --git a/rust-runtime/aws-smithy-types/src/retry.rs b/rust-runtime/aws-smithy-types/src/retry.rs index 43be79cae4..bcde923c69 100644 --- a/rust-runtime/aws-smithy-types/src/retry.rs +++ b/rust-runtime/aws-smithy-types/src/retry.rs @@ -137,6 +137,7 @@ impl fmt::Display for RetryModeParseError { impl std::error::Error for RetryModeParseError {} /// Builder for [`RetryConfig`]. +#[allow(clippy::derive_partial_eq_without_eq)] // TODO: derive Eq? #[non_exhaustive] #[derive(Debug, Default, Clone, PartialEq)] pub struct RetryConfigBuilder { @@ -224,6 +225,7 @@ impl RetryConfigBuilder { } /// Retry configuration for requests. +#[allow(clippy::derive_partial_eq_without_eq)] // TODO: derive Eq? #[non_exhaustive] #[derive(Debug, Clone, PartialEq)] pub struct RetryConfig { diff --git a/rust-runtime/aws-smithy-types/src/timeout.rs b/rust-runtime/aws-smithy-types/src/timeout.rs index 04e92650a9..dc9f81399c 100644 --- a/rust-runtime/aws-smithy-types/src/timeout.rs +++ b/rust-runtime/aws-smithy-types/src/timeout.rs @@ -199,6 +199,7 @@ impl From for TimeoutConfigBuilder { /// ); /// # } /// ``` +#[allow(clippy::derive_partial_eq_without_eq)] // TODO: derive Eq? #[non_exhaustive] #[derive(Clone, PartialEq, Debug)] pub struct TimeoutConfig { @@ -276,6 +277,7 @@ impl TimeoutConfig { } /// Configuration subset of [`TimeoutConfig`] for operation timeouts +#[allow(clippy::derive_partial_eq_without_eq)] // TODO: derive Eq? #[non_exhaustive] #[derive(Clone, PartialEq, Debug)] pub struct OperationTimeoutConfig { diff --git a/rust-runtime/aws-smithy-xml/src/decode.rs b/rust-runtime/aws-smithy-xml/src/decode.rs index c567fbd9d9..739619a759 100644 --- a/rust-runtime/aws-smithy-xml/src/decode.rs +++ b/rust-runtime/aws-smithy-xml/src/decode.rs @@ -77,6 +77,7 @@ impl XmlDecodeError { } } +#[allow(clippy::derive_partial_eq_without_eq)] // TODO: derive Eq? #[derive(PartialEq, Debug)] pub struct Name<'a> { pub prefix: &'a str, diff --git a/rust-runtime/inlineable/src/endpoint_lib/host.rs b/rust-runtime/inlineable/src/endpoint_lib/host.rs index 41dc029122..4c4168437b 100644 --- a/rust-runtime/inlineable/src/endpoint_lib/host.rs +++ b/rust-runtime/inlineable/src/endpoint_lib/host.rs @@ -40,6 +40,7 @@ mod test { super::is_valid_host_label(label, allow_dots, &mut DiagnosticCollector::new()) } + #[allow(clippy::bool_assert_comparison)] #[test] fn basic_cases() { assert_eq!(is_valid_host_label("", false), false); @@ -57,6 +58,7 @@ mod test { ); } + #[allow(clippy::bool_assert_comparison)] #[test] fn start_bounds() { assert_eq!(is_valid_host_label("-foo", false), false); diff --git a/rust-runtime/inlineable/src/endpoint_lib/parse_url.rs b/rust-runtime/inlineable/src/endpoint_lib/parse_url.rs index bd7862aa94..5e437c9bfe 100644 --- a/rust-runtime/inlineable/src/endpoint_lib/parse_url.rs +++ b/rust-runtime/inlineable/src/endpoint_lib/parse_url.rs @@ -71,6 +71,7 @@ mod test { use super::*; use crate::endpoint_lib::diagnostic::DiagnosticCollector; + #[allow(clippy::bool_assert_comparison)] #[test] fn parse_simple_url() { let url = "https://control.vpce-1a2b3c4d-5e6f.s3.us-west-2.vpce.amazonaws.com"; @@ -92,6 +93,7 @@ mod test { assert_eq!(url.scheme(), "https"); } + #[allow(clippy::bool_assert_comparison)] #[test] fn parse_url_with_port() { let url = "http://localhost:8000/path"; diff --git a/rust-runtime/inlineable/src/endpoint_lib/partition.rs b/rust-runtime/inlineable/src/endpoint_lib/partition.rs index 25bec52d95..90c16215ac 100644 --- a/rust-runtime/inlineable/src/endpoint_lib/partition.rs +++ b/rust-runtime/inlineable/src/endpoint_lib/partition.rs @@ -574,8 +574,10 @@ mod test { #[test] fn resolve_partitions() { let mut resolver = PartitionResolver::empty(); - let mut new_suffix = PartitionOutputOverride::default(); - new_suffix.dns_suffix = Some("mars.aws".into()); + let mut new_suffix = PartitionOutputOverride { + dns_suffix: Some("mars.aws".into()), + ..Default::default() + }; resolver.add_partition(PartitionMetadata { id: "aws".into(), region_regex: Regex::new("^(us|eu|ap|sa|ca|me|af)-\\w+-\\d+$").unwrap(), From 66c0967b442bc7f5f25c38b0944b610c047b2293 Mon Sep 17 00:00:00 2001 From: Zelda Hessler Date: Thu, 19 Jan 2023 13:59:39 -0600 Subject: [PATCH 03/10] fix: codegen of types that derive PartialEq fix: codegen issues caused by MSRV upgrade --- .../aws-sigv4/src/http_request/settings.rs | 2 +- .../generators/EndpointParamsGenerator.kt | 4 ++++ .../endpoint/rulesgen/ExpressionGenerator.kt | 9 +++++++- .../rust/codegen/core/rustlang/RustType.kt | 18 +++++++++++++++ .../core/smithy/SymbolMetadataProvider.kt | 23 ++++++++++++------- .../smithy/generators/BuilderGenerator.kt | 7 +++--- .../generators/http/HttpBindingGenerator.kt | 6 +++-- .../aws-smithy-eventstream/src/frame.rs | 1 + 8 files changed, 55 insertions(+), 15 deletions(-) diff --git a/aws/rust-runtime/aws-sigv4/src/http_request/settings.rs b/aws/rust-runtime/aws-sigv4/src/http_request/settings.rs index 02ec12975a..f029cc28d8 100644 --- a/aws/rust-runtime/aws-sigv4/src/http_request/settings.rs +++ b/aws/rust-runtime/aws-sigv4/src/http_request/settings.rs @@ -10,7 +10,7 @@ use std::time::Duration; pub type SigningParams<'a> = crate::SigningParams<'a, SigningSettings>; /// HTTP-specific signing settings -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] #[non_exhaustive] pub struct SigningSettings { /// Specifies how to encode the request URL when signing. Some services do not decode diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/generators/EndpointParamsGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/generators/EndpointParamsGenerator.kt index 1e5059830d..d273c71256 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/generators/EndpointParamsGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/generators/EndpointParamsGenerator.kt @@ -171,6 +171,8 @@ internal class EndpointParamsGenerator(private val parameters: Parameters) { private fun generateEndpointsStruct(writer: RustWriter) { // Ensure that fields can be added in the future Attribute.NonExhaustive.render(writer) + // Required in case we ever need to add a field that's not Eq + Attribute.AllowClippyDerivePartialEqWithoutEq.render(writer) // Automatically implement standard Rust functionality Attribute(derive(RuntimeType.Debug, RuntimeType.PartialEq, RuntimeType.Clone)).render(writer) // Generate the struct block: @@ -235,6 +237,8 @@ internal class EndpointParamsGenerator(private val parameters: Parameters) { private fun generateEndpointParamsBuilder(rustWriter: RustWriter) { rustWriter.docs("Builder for [`Params`]") + // Required in case we ever need to add a param that's not Eq + Attribute.AllowClippyDerivePartialEqWithoutEq.render(rustWriter) Attribute(derive(RuntimeType.Debug, RuntimeType.Default, RuntimeType.PartialEq, RuntimeType.Clone)).render(rustWriter) rustWriter.rustBlock("pub struct ParamsBuilder") { parameters.toList().forEach { parameter -> diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/rulesgen/ExpressionGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/rulesgen/ExpressionGenerator.kt index f0bad1aac2..b0d45366ed 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/rulesgen/ExpressionGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/rulesgen/ExpressionGenerator.kt @@ -65,7 +65,14 @@ class ExpressionGenerator( getAttr.path.toList().forEach { part -> when (part) { is GetAttr.Part.Key -> rust(".${part.key().rustName()}()") - is GetAttr.Part.Index -> rust(".get(${part.index()}).cloned()") // we end up with Option<&&T>, we need to get to Option<&T> + is GetAttr.Part.Index -> { + if (part.index() == 0) { + // In this case, `.first()` is more idiomatic and `.get(0)` triggers lint warnings + rust(".first().cloned()") + } else { + rust(".get(${part.index()}).cloned()") // we end up with Option<&&T>, we need to get to Option<&T> + } + } } } if (ownership == Ownership.Owned && getAttr.type() != Type.bool()) { diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/RustType.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/RustType.kt index f4fbfd5b70..c0bf8df9ab 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/RustType.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/RustType.kt @@ -325,6 +325,16 @@ fun RustType.isCopy(): Boolean = when (this) { else -> false } +/** Returns true if the type implements Eq */ +fun RustType.isEq(): Boolean = when (this) { + is RustType.Integer -> true + is RustType.Bool -> true + is RustType.String -> true + is RustType.Unit -> true + is RustType.Container -> this.member.isEq() + else -> false +} + enum class Visibility { PRIVATE, PUBCRATE, PUBLIC; @@ -454,6 +464,7 @@ class Attribute(val inner: Writable) { val AllowClippyUnnecessaryWraps = Attribute(allow("clippy::unnecessary_wraps")) val AllowClippyUselessConversion = Attribute(allow("clippy::useless_conversion")) val AllowClippyUnnecessaryLazyEvaluations = Attribute(allow("clippy::unnecessary_lazy_evaluations")) + val AllowClippyDerivePartialEqWithoutEq = Attribute(allow("clippy::derive_partial_eq_without_eq")) val AllowDeadCode = Attribute(allow("dead_code")) val AllowDeprecated = Attribute(allow("deprecated")) val AllowIrrefutableLetPatterns = Attribute(allow("irrefutable_let_patterns")) @@ -546,3 +557,10 @@ class Attribute(val inner: Writable) { } } } + +/** Render all attributes in this list, one after another */ +fun Collection.render(writer: RustWriter) { + for (attr in this) { + attr.render(writer) + } +} diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolMetadataProvider.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolMetadataProvider.kt index a7017b504e..04f73ea972 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolMetadataProvider.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolMetadataProvider.kt @@ -92,7 +92,15 @@ fun containerDefaultMetadata( model: Model, additionalAttributes: List = emptyList(), ): RustMetadata { - val defaultDerives = setOf(RuntimeType.Debug, RuntimeType.PartialEq, RuntimeType.Clone) + // A list of `allow` attributes to ignore linter warnings. Each entry in the list must be + // accompanied by a reason. + val allowLints = setOf( + // Required because service team could add non-Eq types at a later date. This + // means we can only ever derive PartialEq. + Attribute.AllowClippyDerivePartialEqWithoutEq, + ) + + val derives = mutableSetOf(RuntimeType.Debug, RuntimeType.PartialEq, RuntimeType.Clone) val isSensitive = shape.hasTrait() || // Checking the shape's direct members for the sensitive trait should suffice. @@ -101,14 +109,13 @@ fun containerDefaultMetadata( // shape; any sensitive descendant should still be printed as redacted. shape.members().any { it.getMemberTrait(model, SensitiveTrait::class.java).isPresent } - val setOfDerives = if (isSensitive) { - defaultDerives - RuntimeType.Debug - } else { - defaultDerives + if (isSensitive) { + derives.remove(RuntimeType.Debug) } + return RustMetadata( - setOfDerives, - additionalAttributes, + derives, + additionalAttributes + allowLints, Visibility.PUBLIC, ) } @@ -116,7 +123,7 @@ fun containerDefaultMetadata( /** * The base metadata supports a set of attributes that are used by generators to decorate code. * - * By default we apply `#[non_exhaustive]` in [additionalAttributes] only to client structures since breaking model + * By default, we apply `#[non_exhaustive]` in [additionalAttributes] only to client structures since breaking model * changes are fine when generating server code. */ class BaseSymbolMetadataProvider( diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt index 69aca45630..7d5673a012 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt @@ -114,10 +114,10 @@ class BuilderGenerator( private val members: List = shape.allMembers.values.toList() private val structureSymbol = symbolProvider.toSymbol(shape) private val builderSymbol = shape.builderSymbol(symbolProvider) - private val baseDerives = structureSymbol.expectRustMetadata().derives + private val metadata = structureSymbol.expectRustMetadata() - // Filter out any derive that isn't Debug, PartialEq, or Clone. Then add a Default derive - private val builderDerives = baseDerives.filter { it == RuntimeType.Debug || it == RuntimeType.PartialEq || it == RuntimeType.Clone } + RuntimeType.Default + // Filter out any derive that isn't Debug, PartialEq, Eq, or Clone. Then add a Default derive + private val builderDerives = metadata.derives.filter { it == RuntimeType.Debug || it == RuntimeType.PartialEq || it == RuntimeType.Eq || it == RuntimeType.Clone } + RuntimeType.Default private val builderName = "Builder" fun render(writer: RustWriter) { @@ -207,6 +207,7 @@ class BuilderGenerator( private fun renderBuilder(writer: RustWriter) { writer.docs("A builder for #D.", structureSymbol) + metadata.additionalAttributes.render(writer) Attribute(derive(builderDerives)).render(writer) writer.rustBlock("pub struct $builderName") { for (member in members) { diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/http/HttpBindingGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/http/HttpBindingGenerator.kt index 597ff267e2..4270d6424e 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/http/HttpBindingGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/http/HttpBindingGenerator.kt @@ -650,12 +650,13 @@ class HttpBindingGenerator( let $safeName = $formatted; if !$safeName.is_empty() { let header_value = $safeName; - let header_value = http::header::HeaderValue::try_from(&*header_value).map_err(|err| { + let header_value: #{HeaderValue} = header_value.parse().map_err(|err| { #{invalid_field_error:W} })?; builder = builder.header("$headerName", header_value); } """, + "HeaderValue" to RuntimeType.Http.resolve("HeaderValue"), "invalid_field_error" to renderErrorMessage("header_value"), ) } @@ -698,13 +699,14 @@ class HttpBindingGenerator( isMultiValuedHeader = false, ) }; - let header_value = http::header::HeaderValue::try_from(&*header_value).map_err(|err| { + let header_value: #{HeaderValue} = header_value.parse().map_err(|err| { #{invalid_header_value:W} })?; builder = builder.header(header_name, header_value); } """, + "HeaderValue" to RuntimeType.Http.resolve("HeaderValue"), "invalid_header_name" to OperationBuildError(runtimeConfig).invalidField(memberName) { rust("""format!("`{k}` cannot be used as a header name: {err}")""") }, diff --git a/rust-runtime/aws-smithy-eventstream/src/frame.rs b/rust-runtime/aws-smithy-eventstream/src/frame.rs index a3d9c29a00..91198b04ef 100644 --- a/rust-runtime/aws-smithy-eventstream/src/frame.rs +++ b/rust-runtime/aws-smithy-eventstream/src/frame.rs @@ -95,6 +95,7 @@ mod value { const TYPE_UUID: u8 = 9; /// Event Stream frame header value. + #[allow(clippy::derive_partial_eq_without_eq)] #[non_exhaustive] #[derive(Clone, Debug, PartialEq)] pub enum HeaderValue { From 0b64d340a2ad18796facdbff34a2aee6735c5459 Mon Sep 17 00:00:00 2001 From: Zelda Hessler Date: Fri, 20 Jan 2023 11:48:26 -0600 Subject: [PATCH 04/10] Apply suggestions from code review --- rust-runtime/aws-smithy-http-server-python/src/util.rs | 2 +- rust-runtime/aws-smithy-types/src/retry.rs | 4 ++-- rust-runtime/aws-smithy-types/src/timeout.rs | 4 ++-- rust-runtime/aws-smithy-xml/src/decode.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rust-runtime/aws-smithy-http-server-python/src/util.rs b/rust-runtime/aws-smithy-http-server-python/src/util.rs index a3227f0441..f2e0e0f8b0 100644 --- a/rust-runtime/aws-smithy-http-server-python/src/util.rs +++ b/rust-runtime/aws-smithy-http-server-python/src/util.rs @@ -9,7 +9,7 @@ pub mod error; use pyo3::{PyAny, PyObject, PyResult, PyTypeInfo, Python}; // Captures some information about a Python function. -#[allow(clippy::derive_partial_eq_without_eq)] // TODO: derive Eq? +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Debug, PartialEq)] pub struct FuncMetadata { pub name: String, diff --git a/rust-runtime/aws-smithy-types/src/retry.rs b/rust-runtime/aws-smithy-types/src/retry.rs index bcde923c69..bbaf127923 100644 --- a/rust-runtime/aws-smithy-types/src/retry.rs +++ b/rust-runtime/aws-smithy-types/src/retry.rs @@ -137,7 +137,7 @@ impl fmt::Display for RetryModeParseError { impl std::error::Error for RetryModeParseError {} /// Builder for [`RetryConfig`]. -#[allow(clippy::derive_partial_eq_without_eq)] // TODO: derive Eq? +#[allow(clippy::derive_partial_eq_without_eq)] #[non_exhaustive] #[derive(Debug, Default, Clone, PartialEq)] pub struct RetryConfigBuilder { @@ -225,7 +225,7 @@ impl RetryConfigBuilder { } /// Retry configuration for requests. -#[allow(clippy::derive_partial_eq_without_eq)] // TODO: derive Eq? +#[allow(clippy::derive_partial_eq_without_eq)] #[non_exhaustive] #[derive(Debug, Clone, PartialEq)] pub struct RetryConfig { diff --git a/rust-runtime/aws-smithy-types/src/timeout.rs b/rust-runtime/aws-smithy-types/src/timeout.rs index dc9f81399c..1212d1ff10 100644 --- a/rust-runtime/aws-smithy-types/src/timeout.rs +++ b/rust-runtime/aws-smithy-types/src/timeout.rs @@ -199,7 +199,7 @@ impl From for TimeoutConfigBuilder { /// ); /// # } /// ``` -#[allow(clippy::derive_partial_eq_without_eq)] // TODO: derive Eq? +#[allow(clippy::derive_partial_eq_without_eq)] #[non_exhaustive] #[derive(Clone, PartialEq, Debug)] pub struct TimeoutConfig { @@ -277,7 +277,7 @@ impl TimeoutConfig { } /// Configuration subset of [`TimeoutConfig`] for operation timeouts -#[allow(clippy::derive_partial_eq_without_eq)] // TODO: derive Eq? +#[allow(clippy::derive_partial_eq_without_eq)] #[non_exhaustive] #[derive(Clone, PartialEq, Debug)] pub struct OperationTimeoutConfig { diff --git a/rust-runtime/aws-smithy-xml/src/decode.rs b/rust-runtime/aws-smithy-xml/src/decode.rs index 739619a759..1c7d3125eb 100644 --- a/rust-runtime/aws-smithy-xml/src/decode.rs +++ b/rust-runtime/aws-smithy-xml/src/decode.rs @@ -77,7 +77,7 @@ impl XmlDecodeError { } } -#[allow(clippy::derive_partial_eq_without_eq)] // TODO: derive Eq? +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(PartialEq, Debug)] pub struct Name<'a> { pub prefix: &'a str, From 63480c21bcbbdfe7f05c3719d7ad10bc3f961b38 Mon Sep 17 00:00:00 2001 From: Nugine Date: Sat, 21 Jan 2023 19:38:32 +0800 Subject: [PATCH 05/10] Fix clippy lints for aws/rust-runtime Fix clippy::unused_mut Fix clippy::unused_io_amount Fix clippy::field_reassign_with_default Fix clippy::redundant_clone Fix clippy::useless_conversion Fix clippy::redundant_pattern_matching --- aws/rust-runtime/aws-config/src/imds/client.rs | 2 +- aws/rust-runtime/aws-endpoint/src/lib.rs | 2 +- aws/rust-runtime/aws-http/src/auth.rs | 5 +---- aws/rust-runtime/aws-inlineable/src/http_body_checksum.rs | 2 +- .../aws-sigv4/src/http_request/query_writer.rs | 2 +- aws/rust-runtime/aws-sigv4/src/http_request/sign.rs | 8 +++++--- rust-runtime/inlineable/src/endpoint_lib/partition.rs | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/aws/rust-runtime/aws-config/src/imds/client.rs b/aws/rust-runtime/aws-config/src/imds/client.rs index ba5cea046c..e791ec929a 100644 --- a/aws/rust-runtime/aws-config/src/imds/client.rs +++ b/aws/rust-runtime/aws-config/src/imds/client.rs @@ -917,7 +917,7 @@ pub(crate) mod test { imds_request("http://169.254.169.254/latest/metadata", TOKEN_A), http::Response::builder() .status(200) - .body(SdkBody::from(vec![0xA0 as u8, 0xA1 as u8])) + .body(SdkBody::from(vec![0xA0, 0xA1])) .unwrap(), ), ]); diff --git a/aws/rust-runtime/aws-endpoint/src/lib.rs b/aws/rust-runtime/aws-endpoint/src/lib.rs index c895143184..641774f346 100644 --- a/aws/rust-runtime/aws-endpoint/src/lib.rs +++ b/aws/rust-runtime/aws-endpoint/src/lib.rs @@ -270,7 +270,7 @@ mod test { let mut req = operation::Request::new(req); { let mut props = req.properties_mut(); - props.insert(region.clone()); + props.insert(region); props.insert(SigningService::from_static("qldb")); props.insert(endpoint); }; diff --git a/aws/rust-runtime/aws-http/src/auth.rs b/aws/rust-runtime/aws-http/src/auth.rs index c91b4c5bb5..98e0e219bb 100644 --- a/aws/rust-runtime/aws-http/src/auth.rs +++ b/aws/rust-runtime/aws-http/src/auth.rs @@ -188,10 +188,7 @@ mod tests { .create_cache(SharedCredentialsProvider::new(provide_credentials_fn( || async { Ok(Credentials::for_tests()) }, ))); - set_credentials_cache( - &mut req.properties_mut(), - SharedCredentialsCache::from(credentials_cache), - ); + set_credentials_cache(&mut req.properties_mut(), credentials_cache); let req = CredentialsStage::new() .apply(req) .await diff --git a/aws/rust-runtime/aws-inlineable/src/http_body_checksum.rs b/aws/rust-runtime/aws-inlineable/src/http_body_checksum.rs index 59dea2ca41..d99e1b1123 100644 --- a/aws/rust-runtime/aws-inlineable/src/http_body_checksum.rs +++ b/aws/rust-runtime/aws-inlineable/src/http_body_checksum.rs @@ -269,7 +269,7 @@ mod tests { for i in 0..10000 { let line = format!("This is a large file created for testing purposes {}", i); - file.as_file_mut().write(line.as_bytes()).unwrap(); + file.as_file_mut().write_all(line.as_bytes()).unwrap(); crc32c_checksum.update(line.as_bytes()); } diff --git a/aws/rust-runtime/aws-sigv4/src/http_request/query_writer.rs b/aws/rust-runtime/aws-sigv4/src/http_request/query_writer.rs index 40a98d9aba..8ee4cdc55e 100644 --- a/aws/rust-runtime/aws-sigv4/src/http_request/query_writer.rs +++ b/aws/rust-runtime/aws-sigv4/src/http_request/query_writer.rs @@ -142,7 +142,7 @@ mod test { let mut query_writer = QueryWriter::new(&uri); query_writer.insert("key", value); - if let Err(_) = std::panic::catch_unwind(|| query_writer.build_uri()) { + if std::panic::catch_unwind(|| query_writer.build_uri()).is_err() { problematic_chars.push(char::from(byte)); }; } diff --git a/aws/rust-runtime/aws-sigv4/src/http_request/sign.rs b/aws/rust-runtime/aws-sigv4/src/http_request/sign.rs index 69f5c00819..d120a401e7 100644 --- a/aws/rust-runtime/aws-sigv4/src/http_request/sign.rs +++ b/aws/rust-runtime/aws-sigv4/src/http_request/sign.rs @@ -380,9 +380,11 @@ mod tests { #[test] fn test_sign_vanilla_with_query_params() { - let mut settings = SigningSettings::default(); - settings.signature_location = SignatureLocation::QueryParams; - settings.expires_in = Some(Duration::from_secs(35)); + let settings = SigningSettings { + signature_location: SignatureLocation::QueryParams, + expires_in: Some(Duration::from_secs(35)), + ..Default::default() + }; let params = SigningParams { access_key: "AKIDEXAMPLE", secret_key: "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY", diff --git a/rust-runtime/inlineable/src/endpoint_lib/partition.rs b/rust-runtime/inlineable/src/endpoint_lib/partition.rs index 90c16215ac..55b97a21d2 100644 --- a/rust-runtime/inlineable/src/endpoint_lib/partition.rs +++ b/rust-runtime/inlineable/src/endpoint_lib/partition.rs @@ -574,7 +574,7 @@ mod test { #[test] fn resolve_partitions() { let mut resolver = PartitionResolver::empty(); - let mut new_suffix = PartitionOutputOverride { + let new_suffix = PartitionOutputOverride { dns_suffix: Some("mars.aws".into()), ..Default::default() }; From f8bbe8b98d5cce8108c4505ba61a8467419c92cf Mon Sep 17 00:00:00 2001 From: Nugine Date: Sat, 21 Jan 2023 20:10:11 +0800 Subject: [PATCH 06/10] Fix clippy lints for codegen-client Fix clippy::needless_borrow --- .../smithy/generators/protocol/ProtocolTestGenerator.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGenerator.kt index 476e67ef5a..84105662e2 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/protocol/ProtocolTestGenerator.kt @@ -217,9 +217,9 @@ class ProtocolTestGenerator( checkQueryParams(this, httpRequestTestCase.queryParams) checkForbidQueryParams(this, httpRequestTestCase.forbidQueryParams) checkRequiredQueryParams(this, httpRequestTestCase.requireQueryParams) - checkHeaders(this, "&http_request.headers()", httpRequestTestCase.headers) - checkForbidHeaders(this, "&http_request.headers()", httpRequestTestCase.forbidHeaders) - checkRequiredHeaders(this, "&http_request.headers()", httpRequestTestCase.requireHeaders) + checkHeaders(this, "http_request.headers()", httpRequestTestCase.headers) + checkForbidHeaders(this, "http_request.headers()", httpRequestTestCase.forbidHeaders) + checkRequiredHeaders(this, "http_request.headers()", httpRequestTestCase.requireHeaders) if (protocolSupport.requestBodySerialization) { // "If no request body is defined, then no assertions are made about the body of the message." httpRequestTestCase.body.orNull()?.also { body -> From f1fffe7320e04975e6167f1aa3f00c9e9cd67e65 Mon Sep 17 00:00:00 2001 From: Nugine Date: Sat, 21 Jan 2023 22:07:08 +0800 Subject: [PATCH 07/10] Fix clippy lints for aws/sdk/integration-tests Fix clippy::redundant_clone --- aws/sdk/integration-tests/s3/tests/endpoints.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/sdk/integration-tests/s3/tests/endpoints.rs b/aws/sdk/integration-tests/s3/tests/endpoints.rs index 93c37f5c87..02b1718569 100644 --- a/aws/sdk/integration-tests/s3/tests/endpoints.rs +++ b/aws/sdk/integration-tests/s3/tests/endpoints.rs @@ -16,7 +16,7 @@ fn test_client(update_builder: fn(Builder) -> Builder) -> (CaptureRequestReceive let sdk_config = SdkConfig::builder() .credentials_provider(SharedCredentialsProvider::new(Credentials::for_tests())) .region(Region::new("us-west-4")) - .http_connector(conn.clone()) + .http_connector(conn) .build(); let client = Client::from_conf(update_builder(Builder::from(&sdk_config)).build()); (captured_request, client) From d85b5d4f795b46e40948a398c2d79bbec796704a Mon Sep 17 00:00:00 2001 From: John DiSanti Date: Thu, 9 Feb 2023 18:06:39 -0800 Subject: [PATCH 08/10] Opt out of `clippy::derive_partial_eq_without_eq` entirely --- aws/rust-runtime/aws-config/src/lib.rs | 1 + aws/rust-runtime/aws-credential-types/src/lib.rs | 1 + aws/rust-runtime/aws-endpoint/src/lib.rs | 2 ++ aws/rust-runtime/aws-http/src/lib.rs | 1 + aws/rust-runtime/aws-inlineable/src/lib.rs | 1 + aws/rust-runtime/aws-sig-auth/src/lib.rs | 2 ++ .../aws-sigv4/src/http_request/settings.rs | 2 +- aws/rust-runtime/aws-sigv4/src/lib.rs | 1 + aws/rust-runtime/aws-types/src/lib.rs | 1 + .../endpoint/generators/EndpointParamsGenerator.kt | 4 ---- .../smithy/rust/codegen/core/rustlang/RustType.kt | 1 - .../codegen/core/smithy/SymbolMetadataProvider.kt | 14 +------------- .../customizations/AllowLintsCustomization.kt | 7 +++---- .../core/smithy/generators/BuilderGenerator.kt | 4 ++-- rust-runtime/aws-smithy-async/src/lib.rs | 1 + rust-runtime/aws-smithy-checksums/src/lib.rs | 2 ++ rust-runtime/aws-smithy-client/src/lib.rs | 1 + rust-runtime/aws-smithy-eventstream/src/frame.rs | 1 - rust-runtime/aws-smithy-eventstream/src/lib.rs | 1 + .../aws-smithy-http-server-python/src/lib.rs | 2 ++ .../aws-smithy-http-server-python/src/util.rs | 1 - rust-runtime/aws-smithy-http-server/src/lib.rs | 1 + .../src/proto/rest/router.rs | 1 - rust-runtime/aws-smithy-http-tower/src/lib.rs | 2 ++ rust-runtime/aws-smithy-http/src/lib.rs | 1 + rust-runtime/aws-smithy-json/src/lib.rs | 2 ++ rust-runtime/aws-smithy-query/src/lib.rs | 3 +++ rust-runtime/aws-smithy-types-convert/src/lib.rs | 1 + rust-runtime/aws-smithy-types/src/lib.rs | 1 + rust-runtime/aws-smithy-types/src/retry.rs | 2 -- rust-runtime/aws-smithy-types/src/timeout.rs | 2 -- rust-runtime/aws-smithy-xml/src/decode.rs | 1 - rust-runtime/aws-smithy-xml/src/lib.rs | 2 ++ 33 files changed, 37 insertions(+), 33 deletions(-) diff --git a/aws/rust-runtime/aws-config/src/lib.rs b/aws/rust-runtime/aws-config/src/lib.rs index 8ca695a770..fc82e6d1fe 100644 --- a/aws/rust-runtime/aws-config/src/lib.rs +++ b/aws/rust-runtime/aws-config/src/lib.rs @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#![allow(clippy::derive_partial_eq_without_eq)] #![warn( missing_debug_implementations, missing_docs, diff --git a/aws/rust-runtime/aws-credential-types/src/lib.rs b/aws/rust-runtime/aws-credential-types/src/lib.rs index 1f790c3fca..b2f8330b58 100644 --- a/aws/rust-runtime/aws-credential-types/src/lib.rs +++ b/aws/rust-runtime/aws-credential-types/src/lib.rs @@ -8,6 +8,7 @@ //! * An opaque struct representing credentials //! * Concrete implementations of credentials caching +#![allow(clippy::derive_partial_eq_without_eq)] #![warn( missing_debug_implementations, missing_docs, diff --git a/aws/rust-runtime/aws-endpoint/src/lib.rs b/aws/rust-runtime/aws-endpoint/src/lib.rs index 641774f346..deb4b6b670 100644 --- a/aws/rust-runtime/aws-endpoint/src/lib.rs +++ b/aws/rust-runtime/aws-endpoint/src/lib.rs @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#![allow(clippy::derive_partial_eq_without_eq)] + use std::collections::HashMap; use std::error::Error; use std::fmt; diff --git a/aws/rust-runtime/aws-http/src/lib.rs b/aws/rust-runtime/aws-http/src/lib.rs index b000c3d6ae..1ec861b954 100644 --- a/aws/rust-runtime/aws-http/src/lib.rs +++ b/aws/rust-runtime/aws-http/src/lib.rs @@ -5,6 +5,7 @@ //! Provides user agent and credentials middleware for the AWS SDK. +#![allow(clippy::derive_partial_eq_without_eq)] #![warn( missing_docs, rustdoc::missing_crate_level_docs, diff --git a/aws/rust-runtime/aws-inlineable/src/lib.rs b/aws/rust-runtime/aws-inlineable/src/lib.rs index b4e00994d4..97acb89983 100644 --- a/aws/rust-runtime/aws-inlineable/src/lib.rs +++ b/aws/rust-runtime/aws-inlineable/src/lib.rs @@ -10,6 +10,7 @@ //! This is _NOT_ intended to be an actual crate. It is a cargo project to solely to aid //! with local development of the SDK. +#![allow(clippy::derive_partial_eq_without_eq)] #![warn( missing_docs, rustdoc::missing_crate_level_docs, diff --git a/aws/rust-runtime/aws-sig-auth/src/lib.rs b/aws/rust-runtime/aws-sig-auth/src/lib.rs index 61ae88e81c..643b3ff216 100644 --- a/aws/rust-runtime/aws-sig-auth/src/lib.rs +++ b/aws/rust-runtime/aws-sig-auth/src/lib.rs @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#![allow(clippy::derive_partial_eq_without_eq)] + //! AWS Signature Authentication Package //! //! This crate may be used to generate presigned URLs for unmodeled behavior such as `rds-iam-token` diff --git a/aws/rust-runtime/aws-sigv4/src/http_request/settings.rs b/aws/rust-runtime/aws-sigv4/src/http_request/settings.rs index f029cc28d8..02ec12975a 100644 --- a/aws/rust-runtime/aws-sigv4/src/http_request/settings.rs +++ b/aws/rust-runtime/aws-sigv4/src/http_request/settings.rs @@ -10,7 +10,7 @@ use std::time::Duration; pub type SigningParams<'a> = crate::SigningParams<'a, SigningSettings>; /// HTTP-specific signing settings -#[derive(Debug, PartialEq, Eq)] +#[derive(Debug, PartialEq)] #[non_exhaustive] pub struct SigningSettings { /// Specifies how to encode the request URL when signing. Some services do not decode diff --git a/aws/rust-runtime/aws-sigv4/src/lib.rs b/aws/rust-runtime/aws-sigv4/src/lib.rs index be2552f578..14d7a7b5fd 100644 --- a/aws/rust-runtime/aws-sigv4/src/lib.rs +++ b/aws/rust-runtime/aws-sigv4/src/lib.rs @@ -6,6 +6,7 @@ //! Provides functions for calculating Sigv4 signing keys, signatures, and //! optional utilities for signing HTTP requests and Event Stream messages. +#![allow(clippy::derive_partial_eq_without_eq)] #![warn( missing_docs, rustdoc::missing_crate_level_docs, diff --git a/aws/rust-runtime/aws-types/src/lib.rs b/aws/rust-runtime/aws-types/src/lib.rs index 795ff08849..600adc83cc 100644 --- a/aws/rust-runtime/aws-types/src/lib.rs +++ b/aws/rust-runtime/aws-types/src/lib.rs @@ -5,6 +5,7 @@ //! Cross-service types for the AWS SDK. +#![allow(clippy::derive_partial_eq_without_eq)] #![warn( missing_docs, rustdoc::missing_crate_level_docs, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/generators/EndpointParamsGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/generators/EndpointParamsGenerator.kt index 1682cf797b..b2a7bde292 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/generators/EndpointParamsGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/generators/EndpointParamsGenerator.kt @@ -170,8 +170,6 @@ internal class EndpointParamsGenerator(private val parameters: Parameters) { private fun generateEndpointsStruct(writer: RustWriter) { // Ensure that fields can be added in the future Attribute.NonExhaustive.render(writer) - // Required in case we ever need to add a field that's not Eq - Attribute.AllowClippyDerivePartialEqWithoutEq.render(writer) // Automatically implement standard Rust functionality Attribute(derive(RuntimeType.Debug, RuntimeType.PartialEq, RuntimeType.Clone)).render(writer) // Generate the struct block: @@ -236,8 +234,6 @@ internal class EndpointParamsGenerator(private val parameters: Parameters) { private fun generateEndpointParamsBuilder(rustWriter: RustWriter) { rustWriter.docs("Builder for [`Params`]") - // Required in case we ever need to add a param that's not Eq - Attribute.AllowClippyDerivePartialEqWithoutEq.render(rustWriter) Attribute(derive(RuntimeType.Debug, RuntimeType.Default, RuntimeType.PartialEq, RuntimeType.Clone)).render(rustWriter) rustWriter.rustBlock("pub struct ParamsBuilder") { parameters.toList().forEach { parameter -> diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/RustType.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/RustType.kt index c0bf8df9ab..59953d5418 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/RustType.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/RustType.kt @@ -464,7 +464,6 @@ class Attribute(val inner: Writable) { val AllowClippyUnnecessaryWraps = Attribute(allow("clippy::unnecessary_wraps")) val AllowClippyUselessConversion = Attribute(allow("clippy::useless_conversion")) val AllowClippyUnnecessaryLazyEvaluations = Attribute(allow("clippy::unnecessary_lazy_evaluations")) - val AllowClippyDerivePartialEqWithoutEq = Attribute(allow("clippy::derive_partial_eq_without_eq")) val AllowDeadCode = Attribute(allow("dead_code")) val AllowDeprecated = Attribute(allow("deprecated")) val AllowIrrefutableLetPatterns = Attribute(allow("irrefutable_let_patterns")) diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolMetadataProvider.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolMetadataProvider.kt index 04f73ea972..51df865479 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolMetadataProvider.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolMetadataProvider.kt @@ -92,14 +92,6 @@ fun containerDefaultMetadata( model: Model, additionalAttributes: List = emptyList(), ): RustMetadata { - // A list of `allow` attributes to ignore linter warnings. Each entry in the list must be - // accompanied by a reason. - val allowLints = setOf( - // Required because service team could add non-Eq types at a later date. This - // means we can only ever derive PartialEq. - Attribute.AllowClippyDerivePartialEqWithoutEq, - ) - val derives = mutableSetOf(RuntimeType.Debug, RuntimeType.PartialEq, RuntimeType.Clone) val isSensitive = shape.hasTrait() || @@ -113,11 +105,7 @@ fun containerDefaultMetadata( derives.remove(RuntimeType.Debug) } - return RustMetadata( - derives, - additionalAttributes + allowLints, - Visibility.PUBLIC, - ) + return RustMetadata(derives, additionalAttributes, Visibility.PUBLIC) } /** diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/AllowLintsCustomization.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/AllowLintsCustomization.kt index a06ff50a28..27e4598246 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/AllowLintsCustomization.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/AllowLintsCustomization.kt @@ -34,7 +34,7 @@ private val allowedClippyLints = listOf( "should_implement_trait", // Protocol tests use silly names like `baz`, don't flag that. - // TODO(msrv_upgrade): switch + // TODO(msrv_upgrade): switch upon MSRV upgrade to Rust 1.65 "blacklisted_name", // "disallowed_names", @@ -48,11 +48,10 @@ private val allowedClippyLints = listOf( "needless_return", // For backwards compatibility, we often don't derive Eq - // TODO(msrv_upgrade): enable - // "derive_partial_eq_without_eq", + "derive_partial_eq_without_eq", // Keeping errors small in a backwards compatible way is challenging - // TODO(msrv_upgrade): enable + // TODO(msrv_upgrade): uncomment upon MSRV upgrade to Rust 1.65 // "result_large_err", ) diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt index 7d5673a012..e6289d8984 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt @@ -116,8 +116,8 @@ class BuilderGenerator( private val builderSymbol = shape.builderSymbol(symbolProvider) private val metadata = structureSymbol.expectRustMetadata() - // Filter out any derive that isn't Debug, PartialEq, Eq, or Clone. Then add a Default derive - private val builderDerives = metadata.derives.filter { it == RuntimeType.Debug || it == RuntimeType.PartialEq || it == RuntimeType.Eq || it == RuntimeType.Clone } + RuntimeType.Default + // Filter out any derive that isn't Debug, PartialEq, or Clone. Then add a Default derive + private val builderDerives = metadata.derives.filter { it == RuntimeType.Debug || it == RuntimeType.PartialEq || it == RuntimeType.Clone } + RuntimeType.Default private val builderName = "Builder" fun render(writer: RustWriter) { diff --git a/rust-runtime/aws-smithy-async/src/lib.rs b/rust-runtime/aws-smithy-async/src/lib.rs index 6cd95109e2..b6b4951afc 100644 --- a/rust-runtime/aws-smithy-async/src/lib.rs +++ b/rust-runtime/aws-smithy-async/src/lib.rs @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#![allow(clippy::derive_partial_eq_without_eq)] #![warn( missing_debug_implementations, missing_docs, diff --git a/rust-runtime/aws-smithy-checksums/src/lib.rs b/rust-runtime/aws-smithy-checksums/src/lib.rs index 0361fa9a94..95789ad7c1 100644 --- a/rust-runtime/aws-smithy-checksums/src/lib.rs +++ b/rust-runtime/aws-smithy-checksums/src/lib.rs @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#![allow(clippy::derive_partial_eq_without_eq)] + //! Checksum calculation and verification callbacks. use crate::error::UnknownChecksumAlgorithmError; diff --git a/rust-runtime/aws-smithy-client/src/lib.rs b/rust-runtime/aws-smithy-client/src/lib.rs index 48126cef0e..f83c9d895e 100644 --- a/rust-runtime/aws-smithy-client/src/lib.rs +++ b/rust-runtime/aws-smithy-client/src/lib.rs @@ -14,6 +14,7 @@ //! | `rustls` | Use `rustls` as the HTTP client's TLS implementation | //! | `client-hyper` | Use `hyper` to handle HTTP requests | +#![allow(clippy::derive_partial_eq_without_eq)] #![warn( missing_debug_implementations, missing_docs, diff --git a/rust-runtime/aws-smithy-eventstream/src/frame.rs b/rust-runtime/aws-smithy-eventstream/src/frame.rs index 91198b04ef..a3d9c29a00 100644 --- a/rust-runtime/aws-smithy-eventstream/src/frame.rs +++ b/rust-runtime/aws-smithy-eventstream/src/frame.rs @@ -95,7 +95,6 @@ mod value { const TYPE_UUID: u8 = 9; /// Event Stream frame header value. - #[allow(clippy::derive_partial_eq_without_eq)] #[non_exhaustive] #[derive(Clone, Debug, PartialEq)] pub enum HeaderValue { diff --git a/rust-runtime/aws-smithy-eventstream/src/lib.rs b/rust-runtime/aws-smithy-eventstream/src/lib.rs index 07cb538857..594be5d3c9 100644 --- a/rust-runtime/aws-smithy-eventstream/src/lib.rs +++ b/rust-runtime/aws-smithy-eventstream/src/lib.rs @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#![allow(clippy::derive_partial_eq_without_eq)] #![warn( missing_debug_implementations, /*missing_docs, diff --git a/rust-runtime/aws-smithy-http-server-python/src/lib.rs b/rust-runtime/aws-smithy-http-server-python/src/lib.rs index b8efefe03f..3895b65a45 100644 --- a/rust-runtime/aws-smithy-http-server-python/src/lib.rs +++ b/rust-runtime/aws-smithy-http-server-python/src/lib.rs @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#![allow(clippy::derive_partial_eq_without_eq)] #![cfg_attr(docsrs, feature(doc_cfg))] //! Rust/Python bindings, runtime and utilities. @@ -39,6 +40,7 @@ pub use util::error::{rich_py_err, RichPyErr}; #[cfg(test)] mod tests { + use parking_lot::Once; use std::sync::Once; use pyo3::{PyErr, Python}; diff --git a/rust-runtime/aws-smithy-http-server-python/src/util.rs b/rust-runtime/aws-smithy-http-server-python/src/util.rs index f2e0e0f8b0..a971e26343 100644 --- a/rust-runtime/aws-smithy-http-server-python/src/util.rs +++ b/rust-runtime/aws-smithy-http-server-python/src/util.rs @@ -9,7 +9,6 @@ pub mod error; use pyo3::{PyAny, PyObject, PyResult, PyTypeInfo, Python}; // Captures some information about a Python function. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Debug, PartialEq)] pub struct FuncMetadata { pub name: String, diff --git a/rust-runtime/aws-smithy-http-server/src/lib.rs b/rust-runtime/aws-smithy-http-server/src/lib.rs index 804b00d8a3..6031c53e2a 100644 --- a/rust-runtime/aws-smithy-http-server/src/lib.rs +++ b/rust-runtime/aws-smithy-http-server/src/lib.rs @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#![allow(clippy::derive_partial_eq_without_eq)] #![cfg_attr(docsrs, feature(doc_cfg))] //! HTTP server runtime and utilities, loosely based on [axum]. diff --git a/rust-runtime/aws-smithy-http-server/src/proto/rest/router.rs b/rust-runtime/aws-smithy-http-server/src/proto/rest/router.rs index bcf5f10c43..1d55f676d6 100644 --- a/rust-runtime/aws-smithy-http-server/src/proto/rest/router.rs +++ b/rust-runtime/aws-smithy-http-server/src/proto/rest/router.rs @@ -16,7 +16,6 @@ use tower::Service; use thiserror::Error; /// An AWS REST routing error. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Debug, Error, PartialEq)] pub enum Error { /// Operation not found. diff --git a/rust-runtime/aws-smithy-http-tower/src/lib.rs b/rust-runtime/aws-smithy-http-tower/src/lib.rs index d2a1c54603..92b60c2702 100644 --- a/rust-runtime/aws-smithy-http-tower/src/lib.rs +++ b/rust-runtime/aws-smithy-http-tower/src/lib.rs @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#![allow(clippy::derive_partial_eq_without_eq)] + pub mod dispatch; pub mod map_request; pub mod parse_response; diff --git a/rust-runtime/aws-smithy-http/src/lib.rs b/rust-runtime/aws-smithy-http/src/lib.rs index 54449bf38e..8c577a2656 100644 --- a/rust-runtime/aws-smithy-http/src/lib.rs +++ b/rust-runtime/aws-smithy-http/src/lib.rs @@ -15,6 +15,7 @@ //! | `rt-tokio` | Provides features that are dependent on `tokio` including the `ByteStream::from_path` util | //! | `event-stream` | Provides Sender/Receiver implementations for Event Stream codegen. | +#![allow(clippy::derive_partial_eq_without_eq)] #![cfg_attr(docsrs, feature(doc_cfg))] pub mod body; diff --git a/rust-runtime/aws-smithy-json/src/lib.rs b/rust-runtime/aws-smithy-json/src/lib.rs index 58da71b621..a4e6904924 100644 --- a/rust-runtime/aws-smithy-json/src/lib.rs +++ b/rust-runtime/aws-smithy-json/src/lib.rs @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#![allow(clippy::derive_partial_eq_without_eq)] + //! JSON Abstractions for Smithy pub mod deserialize; diff --git a/rust-runtime/aws-smithy-query/src/lib.rs b/rust-runtime/aws-smithy-query/src/lib.rs index 3b9d57a9d0..b23b7bd567 100644 --- a/rust-runtime/aws-smithy-query/src/lib.rs +++ b/rust-runtime/aws-smithy-query/src/lib.rs @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#![allow(clippy::derive_partial_eq_without_eq)] + //! Abstractions for the Smithy AWS Query protocol use aws_smithy_types::date_time::{DateTimeFormatError, Format}; @@ -226,6 +228,7 @@ impl<'a> QueryValueWriter<'a> { mod tests { use crate::QueryWriter; use aws_smithy_types::date_time::Format; + use aws_smithy_types::Document::String; use aws_smithy_types::{DateTime, Number}; #[test] diff --git a/rust-runtime/aws-smithy-types-convert/src/lib.rs b/rust-runtime/aws-smithy-types-convert/src/lib.rs index 4487db52b6..c18ebec8e3 100644 --- a/rust-runtime/aws-smithy-types-convert/src/lib.rs +++ b/rust-runtime/aws-smithy-types-convert/src/lib.rs @@ -5,6 +5,7 @@ //! Conversions between `aws-smithy-types` and the types of frequently used Rust libraries. +#![allow(clippy::derive_partial_eq_without_eq)] #![warn( missing_docs, rustdoc::missing_crate_level_docs, diff --git a/rust-runtime/aws-smithy-types/src/lib.rs b/rust-runtime/aws-smithy-types/src/lib.rs index 1e45b94183..39d91c75be 100644 --- a/rust-runtime/aws-smithy-types/src/lib.rs +++ b/rust-runtime/aws-smithy-types/src/lib.rs @@ -5,6 +5,7 @@ //! Protocol-agnostic types for smithy-rs. +#![allow(clippy::derive_partial_eq_without_eq)] #![warn( missing_docs, rustdoc::missing_crate_level_docs, diff --git a/rust-runtime/aws-smithy-types/src/retry.rs b/rust-runtime/aws-smithy-types/src/retry.rs index bbaf127923..43be79cae4 100644 --- a/rust-runtime/aws-smithy-types/src/retry.rs +++ b/rust-runtime/aws-smithy-types/src/retry.rs @@ -137,7 +137,6 @@ impl fmt::Display for RetryModeParseError { impl std::error::Error for RetryModeParseError {} /// Builder for [`RetryConfig`]. -#[allow(clippy::derive_partial_eq_without_eq)] #[non_exhaustive] #[derive(Debug, Default, Clone, PartialEq)] pub struct RetryConfigBuilder { @@ -225,7 +224,6 @@ impl RetryConfigBuilder { } /// Retry configuration for requests. -#[allow(clippy::derive_partial_eq_without_eq)] #[non_exhaustive] #[derive(Debug, Clone, PartialEq)] pub struct RetryConfig { diff --git a/rust-runtime/aws-smithy-types/src/timeout.rs b/rust-runtime/aws-smithy-types/src/timeout.rs index 1212d1ff10..04e92650a9 100644 --- a/rust-runtime/aws-smithy-types/src/timeout.rs +++ b/rust-runtime/aws-smithy-types/src/timeout.rs @@ -199,7 +199,6 @@ impl From for TimeoutConfigBuilder { /// ); /// # } /// ``` -#[allow(clippy::derive_partial_eq_without_eq)] #[non_exhaustive] #[derive(Clone, PartialEq, Debug)] pub struct TimeoutConfig { @@ -277,7 +276,6 @@ impl TimeoutConfig { } /// Configuration subset of [`TimeoutConfig`] for operation timeouts -#[allow(clippy::derive_partial_eq_without_eq)] #[non_exhaustive] #[derive(Clone, PartialEq, Debug)] pub struct OperationTimeoutConfig { diff --git a/rust-runtime/aws-smithy-xml/src/decode.rs b/rust-runtime/aws-smithy-xml/src/decode.rs index 1c7d3125eb..c567fbd9d9 100644 --- a/rust-runtime/aws-smithy-xml/src/decode.rs +++ b/rust-runtime/aws-smithy-xml/src/decode.rs @@ -77,7 +77,6 @@ impl XmlDecodeError { } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(PartialEq, Debug)] pub struct Name<'a> { pub prefix: &'a str, diff --git a/rust-runtime/aws-smithy-xml/src/lib.rs b/rust-runtime/aws-smithy-xml/src/lib.rs index f9d4e990ce..fcd4144700 100644 --- a/rust-runtime/aws-smithy-xml/src/lib.rs +++ b/rust-runtime/aws-smithy-xml/src/lib.rs @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#![allow(clippy::derive_partial_eq_without_eq)] + //! Abstractions for Smithy //! [XML Binding Traits](https://awslabs.github.io/smithy/1.0/spec/core/xml-traits.html) pub mod decode; From caa35a029ca9ba2e15d184b9e4af9df2ffd9c7c5 Mon Sep 17 00:00:00 2001 From: John DiSanti Date: Fri, 10 Feb 2023 09:18:02 -0800 Subject: [PATCH 09/10] Fix weird auto-import --- rust-runtime/aws-smithy-query/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/rust-runtime/aws-smithy-query/src/lib.rs b/rust-runtime/aws-smithy-query/src/lib.rs index b23b7bd567..26e5ab50bf 100644 --- a/rust-runtime/aws-smithy-query/src/lib.rs +++ b/rust-runtime/aws-smithy-query/src/lib.rs @@ -228,7 +228,6 @@ impl<'a> QueryValueWriter<'a> { mod tests { use crate::QueryWriter; use aws_smithy_types::date_time::Format; - use aws_smithy_types::Document::String; use aws_smithy_types::{DateTime, Number}; #[test] From f4a5653477ea161e0ca30906675cd0f591ee9d59 Mon Sep 17 00:00:00 2001 From: John DiSanti Date: Fri, 10 Feb 2023 10:21:48 -0800 Subject: [PATCH 10/10] Fix another auto-import issue --- rust-runtime/aws-smithy-http-server-python/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/rust-runtime/aws-smithy-http-server-python/src/lib.rs b/rust-runtime/aws-smithy-http-server-python/src/lib.rs index 3895b65a45..17b7a96a03 100644 --- a/rust-runtime/aws-smithy-http-server-python/src/lib.rs +++ b/rust-runtime/aws-smithy-http-server-python/src/lib.rs @@ -40,7 +40,6 @@ pub use util::error::{rich_py_err, RichPyErr}; #[cfg(test)] mod tests { - use parking_lot::Once; use std::sync::Once; use pyo3::{PyErr, Python};