diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 774c4f3c7a..52b54efd45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ on: required: false env: - rust_version: 1.62.1 + rust_version: 1.63.0 rust_toolchain_components: clippy,rustfmt ENCRYPTED_DOCKER_PASSWORD: ${{ secrets.ENCRYPTED_DOCKER_PASSWORD }} DOCKER_LOGIN_TOKEN_PASSPHRASE: ${{ secrets.DOCKER_LOGIN_TOKEN_PASSPHRASE }} diff --git a/.github/workflows/claim-crate-names.yml b/.github/workflows/claim-crate-names.yml index 650b8cac7c..63b5eac307 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 7bcd2e833f..131939fcb0 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 8cd5e74287..049fd53971 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.semantic_version }} (${{ inputs.commit_sha }}) - ${{ inputs.dry_run && 'Dry run' || 'Production run' }} @@ -18,8 +18,8 @@ on: workflow_dispatch: inputs: commit_sha: - description: | - The SHA of the git commit that you want to release. + description: | + The SHA of the git commit that you want to release. You must use the non-abbreviated SHA (e.g. b2318b0 won't work!). required: true type: string @@ -75,8 +75,8 @@ jobs: # We need `always` here otherwise this job won't run if the previous job has been skipped # See https://samanpavel.medium.com/github-actions-conditional-job-execution-e6aa363d2867 if: | - always() && - needs.acquire-base-image.result == 'success' && + always() && + needs.acquire-base-image.result == 'success' && (needs.release-ci.result == 'success' || needs.release-ci.result == 'skipped') runs-on: ubuntu-latest outputs: @@ -234,7 +234,7 @@ jobs: shell: bash run: | set -eux - + # This will fail if other commits have been pushed to `main` after `commit_sha` # In particular, this will ALWAYS fail if you are creating a new release series from # a commit that is not the current tip of `main`. 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 0afcaae4a3..99476bb5b3 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -10,3 +10,15 @@ # references = ["smithy-rs#920"] # meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client | server | all"} # author = "rcoh" + +[[aws-sdk-rust]] +message = "Upgrade Rust MSRV to 1.63.0" +references = ["smithy-rs#2222"] +meta = { "breaking" = true, "tada" = true, "bug" = false } +author = "Nugine" + +[[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" 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-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 c895143184..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; @@ -270,7 +272,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-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/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-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/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/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/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) 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-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 b5a24be36c..3cc82af7a0 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 @@ -211,9 +211,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 -> 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..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 @@ -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; @@ -546,3 +556,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..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,7 +92,7 @@ fun containerDefaultMetadata( model: Model, additionalAttributes: List = emptyList(), ): RustMetadata { - val defaultDerives = setOf(RuntimeType.Debug, RuntimeType.PartialEq, RuntimeType.Clone) + 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,22 +101,17 @@ 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, - Visibility.PUBLIC, - ) + + return RustMetadata(derives, additionalAttributes, Visibility.PUBLIC) } /** * 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/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 69aca45630..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 @@ -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 + 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) { @@ -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 b2ca5e066f..e018147808 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/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 f05e542381..a09ca9f10c 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 @@ -105,7 +105,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 9857dcc895..fa3037b59b 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-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 ce422fe5ee..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; @@ -379,8 +381,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-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/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..17b7a96a03 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. 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 df0b8eafc5..4cac7f06d2 100644 --- a/rust-runtime/aws-smithy-http-server-python/src/util.rs +++ b/rust-runtime/aws-smithy-http-server-python/src/util.rs @@ -130,6 +130,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/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-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/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-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..26e5ab50bf 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}; 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/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/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-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; 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..55b97a21d2 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 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(), 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/ci-build/Dockerfile b/tools/ci-build/Dockerfile index 38dd3a50d1..bfee165281 100644 --- a/tools/ci-build/Dockerfile +++ b/tools/ci-build/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