diff --git a/.changelog/1761582203.md b/.changelog/1761582203.md new file mode 100644 index 00000000000..456b1b08166 --- /dev/null +++ b/.changelog/1761582203.md @@ -0,0 +1,14 @@ +--- +applies_to: +- aws-sdk-rust +- client +- server +authors: +- ysaito1001 +references: +- smithy-rs#4367 +breaking: true +new_feature: false +bug_fix: false +--- +Upgrade MSRV to Rust 1.88.0. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af0ea643893..237d2612d02 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ on: required: false env: - rust_version: 1.86.0 + rust_version: 1.88.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 a2eef2ab69f..a6c027cf189 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.86.0 + rust_version: 1.88.0 name: Claim unpublished crate names on crates.io run-name: ${{ github.workflow }} diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index d6c37da5805..166571dd311 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -8,7 +8,7 @@ on: name: Update GitHub Pages env: - rust_version: 1.86.0 + rust_version: 1.88.0 # Allow only one doc pages build to run at a time for the entire smithy-rs repo concurrency: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8e0b1985315..2cc7cf5bbca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ concurrency: cancel-in-progress: true env: - rust_version: 1.86.0 + rust_version: 1.88.0 name: Release smithy-rs on: diff --git a/.github/workflows/update-sdk-next.yml b/.github/workflows/update-sdk-next.yml index ef1864f9171..85433b22d61 100644 --- a/.github/workflows/update-sdk-next.yml +++ b/.github/workflows/update-sdk-next.yml @@ -46,7 +46,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: 1.86.0 + toolchain: 1.88.0 - name: Delete old SDK run: | - name: Generate a fresh SDK diff --git a/aws/codegen-aws-sdk/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt b/aws/codegen-aws-sdk/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt index 33aa8bf7391..93e72957ca5 100644 --- a/aws/codegen-aws-sdk/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt +++ b/aws/codegen-aws-sdk/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt @@ -186,7 +186,7 @@ private class AwsFluentClientRetryPartition(private val codegenContext: ClientCo rustTemplate( """ let default_retry_partition = match config.region() { - Some(region) => #{Cow}::from(format!("{default_retry_partition}-{}", region)), + Some(region) => #{Cow}::from(format!("{default_retry_partition}-{region}")), None => #{Cow}::from(default_retry_partition), }; """, diff --git a/aws/rust-runtime/Cargo.lock b/aws/rust-runtime/Cargo.lock index ad1858d7c4c..e3f72ffad1b 100644 --- a/aws/rust-runtime/Cargo.lock +++ b/aws/rust-runtime/Cargo.lock @@ -113,7 +113,7 @@ dependencies = [ [[package]] name = "aws-runtime" -version = "1.5.12" +version = "1.5.13" dependencies = [ "arbitrary", "aws-credential-types", @@ -154,7 +154,7 @@ version = "1.1.9" [[package]] name = "aws-sigv4" -version = "1.3.5" +version = "1.3.6" dependencies = [ "aws-credential-types", "aws-smithy-eventstream", @@ -215,7 +215,7 @@ dependencies = [ [[package]] name = "aws-smithy-eventstream" -version = "0.60.12" +version = "0.60.13" dependencies = [ "aws-smithy-types", "bytes", @@ -269,7 +269,7 @@ dependencies = [ [[package]] name = "aws-smithy-protocol-test" -version = "0.63.5" +version = "0.63.6" dependencies = [ "assert-json-diff", "aws-smithy-runtime-api", @@ -308,7 +308,7 @@ dependencies = [ [[package]] name = "aws-smithy-runtime-api" -version = "1.9.1" +version = "1.9.2" dependencies = [ "aws-smithy-async", "aws-smithy-types", @@ -323,7 +323,7 @@ dependencies = [ [[package]] name = "aws-smithy-types" -version = "1.3.3" +version = "1.3.4" dependencies = [ "base64-simd", "bytes", @@ -347,7 +347,7 @@ dependencies = [ [[package]] name = "aws-types" -version = "1.3.9" +version = "1.3.10" dependencies = [ "aws-credential-types", "aws-smithy-async", diff --git a/aws/rust-runtime/aws-config/Cargo.lock b/aws/rust-runtime/aws-config/Cargo.lock index 1c3d8b406e4..7c01f2e5c34 100644 --- a/aws/rust-runtime/aws-config/Cargo.lock +++ b/aws/rust-runtime/aws-config/Cargo.lock @@ -35,7 +35,7 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "aws-config" -version = "1.8.9" +version = "1.8.10" dependencies = [ "aws-credential-types", "aws-runtime", @@ -69,7 +69,7 @@ dependencies = [ [[package]] name = "aws-credential-types" -version = "1.2.8" +version = "1.2.9" dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api", @@ -102,7 +102,7 @@ dependencies = [ [[package]] name = "aws-runtime" -version = "1.5.12" +version = "1.5.13" dependencies = [ "aws-credential-types", "aws-sigv4", diff --git a/aws/rust-runtime/aws-config/Cargo.toml b/aws/rust-runtime/aws-config/Cargo.toml index 9859d4bd91c..344185a2226 100644 --- a/aws/rust-runtime/aws-config/Cargo.toml +++ b/aws/rust-runtime/aws-config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-config" -version = "1.8.9" +version = "1.8.10" authors = [ "AWS Rust SDK Team ", "Russell Cohen ", diff --git a/aws/rust-runtime/aws-config/src/credential_process.rs b/aws/rust-runtime/aws-config/src/credential_process.rs index 379f88a03c6..14bafb4580a 100644 --- a/aws/rust-runtime/aws-config/src/credential_process.rs +++ b/aws/rust-runtime/aws-config/src/credential_process.rs @@ -99,8 +99,7 @@ impl CredentialProcessProvider { .await .map_err(|e| { CredentialsError::provider_error(format!( - "Error retrieving credentials from external process: {}", - e + "Error retrieving credentials from external process: {e}", )) })?; @@ -118,8 +117,7 @@ impl CredentialProcessProvider { let output = std::str::from_utf8(&output.stdout).map_err(|e| { CredentialsError::provider_error(format!( - "Error retrieving credentials from external process: could not decode output as UTF-8: {}", - e + "Error retrieving credentials from external process: could not decode output as UTF-8: {e}", )) })?; @@ -132,8 +130,7 @@ impl CredentialProcessProvider { }) .map_err(|invalid| { CredentialsError::provider_error(format!( - "Error retrieving credentials from external process, could not parse response: {}", - invalid + "Error retrieving credentials from external process, could not parse response: {invalid}", )) }) } @@ -235,7 +232,7 @@ pub(crate) fn parse_credential_process_json_credentials( Some(version) => { return Err(InvalidJsonCredentials::InvalidField { field: "version", - err: format!("unknown version number: {}", version).into(), + err: format!("unknown version number: {version}").into(), }) } } diff --git a/aws/rust-runtime/aws-config/src/ecs.rs b/aws/rust-runtime/aws-config/src/ecs.rs index f9c2ed63e16..5c3e811154c 100644 --- a/aws/rust-runtime/aws-config/src/ecs.rs +++ b/aws/rust-runtime/aws-config/src/ecs.rs @@ -136,7 +136,7 @@ impl EcsCredentialsProvider { Err(CredentialsError::not_loaded("ECS provider not configured")) } Provider::InvalidConfiguration(err) => { - Err(CredentialsError::invalid_configuration(format!("{}", err))) + Err(CredentialsError::invalid_configuration(format!("{err}"))) } Provider::Configured(provider) => provider.credentials(auth).await, } @@ -253,13 +253,11 @@ enum EcsConfigurationError { impl Display for EcsConfigurationError { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { - EcsConfigurationError::InvalidRelativeUri { err, uri } => write!( - f, - "invalid relative URI for ECS provider ({}): {}", - err, uri - ), + EcsConfigurationError::InvalidRelativeUri { err, uri } => { + write!(f, "invalid relative URI for ECS provider ({err}): {uri}",) + } EcsConfigurationError::InvalidFullUri { err, uri } => { - write!(f, "invalid full URI for ECS provider ({}): {}", err, uri) + write!(f, "invalid full URI for ECS provider ({err}): {uri}") } EcsConfigurationError::NotConfigured => write!( f, @@ -267,8 +265,7 @@ impl Display for EcsConfigurationError { ), EcsConfigurationError::InvalidAuthToken { err, value } => write!( f, - "`{}` could not be used as a header value for the auth token. {}", - value, err + "`{value}` could not be used as a header value for the auth token. {err}", ), } } diff --git a/aws/rust-runtime/aws-config/src/http_credential_provider.rs b/aws/rust-runtime/aws-config/src/http_credential_provider.rs index 482265ac2fe..fb66e5ab8e9 100644 --- a/aws/rust-runtime/aws-config/src/http_credential_provider.rs +++ b/aws/rust-runtime/aws-config/src/http_credential_provider.rs @@ -203,8 +203,7 @@ fn parse_response( } JsonCredentials::Error { code, message } => Err(OrchestratorError::operation( CredentialsError::provider_error(format!( - "failed to load credentials [{}]: {}", - code, message + "failed to load credentials [{code}]: {message}", )), )), } diff --git a/aws/rust-runtime/aws-config/src/imds/credentials.rs b/aws/rust-runtime/aws-config/src/imds/credentials.rs index 84d1aa2f02e..e8a3fbaf533 100644 --- a/aws/rust-runtime/aws-config/src/imds/credentials.rs +++ b/aws/rust-runtime/aws-config/src/imds/credentials.rs @@ -225,8 +225,7 @@ impl ImdsCredentialsProvider { let credentials = self .client .get(format!( - "/latest/meta-data/iam/security-credentials/{}", - profile + "/latest/meta-data/iam/security-credentials/{profile}", )) .await .map_err(CredentialsError::provider_error)?; @@ -256,17 +255,13 @@ impl ImdsCredentialsProvider { if code == codes::ASSUME_ROLE_UNAUTHORIZED_ACCESS => { Err(CredentialsError::invalid_configuration(format!( - "Incorrect IMDS/IAM configuration: [{}] {}. \ + "Incorrect IMDS/IAM configuration: [{code}] {message}. \ Hint: Does this role have a trust relationship with EC2?", - code, message - ))) - } - Ok(JsonCredentials::Error { code, message }) => { - Err(CredentialsError::provider_error(format!( - "Error retrieving credentials from IMDS: {} {}", - code, message ))) } + Ok(JsonCredentials::Error { code, message }) => Err(CredentialsError::provider_error( + format!("Error retrieving credentials from IMDS: {code} {message}"), + )), // got bad data from IMDS, should not occur during normal operation: Err(invalid) => Err(CredentialsError::unhandled(invalid)), } diff --git a/aws/rust-runtime/aws-config/src/json_credentials.rs b/aws/rust-runtime/aws-config/src/json_credentials.rs index b90c6d2447b..3de9184360e 100644 --- a/aws/rust-runtime/aws-config/src/json_credentials.rs +++ b/aws/rust-runtime/aws-config/src/json_credentials.rs @@ -45,16 +45,14 @@ impl Display for InvalidJsonCredentials { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { InvalidJsonCredentials::JsonError(json) => { - write!(f, "invalid JSON in response: {}", json) + write!(f, "invalid JSON in response: {json}") } - InvalidJsonCredentials::MissingField(field) => write!( - f, - "Expected field `{}` in response but it was missing", - field - ), - InvalidJsonCredentials::Other(msg) => write!(f, "{}", msg), + InvalidJsonCredentials::MissingField(field) => { + write!(f, "Expected field `{field}` in response but it was missing",) + } + InvalidJsonCredentials::Other(msg) => write!(f, "{msg}"), InvalidJsonCredentials::InvalidField { field, err } => { - write!(f, "Invalid field in response: `{}`. {}", field, err) + write!(f, "Invalid field in response: `{field}`. {err}") } } } @@ -237,7 +235,7 @@ pub(crate) fn json_parse_loop<'a>( } other => { return Err(InvalidJsonCredentials::Other( - format!("expected object key, found: {:?}", other).into(), + format!("expected object key, found: {other:?}").into(), )); } } diff --git a/aws/rust-runtime/aws-config/src/profile/credentials.rs b/aws/rust-runtime/aws-config/src/profile/credentials.rs index 611058077e9..506ac48878a 100644 --- a/aws/rust-runtime/aws-config/src/profile/credentials.rs +++ b/aws/rust-runtime/aws-config/src/profile/credentials.rs @@ -301,7 +301,7 @@ impl ProfileFileError { fn missing_field(profile: &Profile, field: &'static str) -> Self { ProfileFileError::MissingProfile { profile: profile.name().to_string(), - message: format!("`{}` was missing", field).into(), + message: format!("`{field}` was missing").into(), } } } @@ -319,33 +319,30 @@ impl Display for ProfileFileError { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { ProfileFileError::InvalidProfile(err) => { - write!(f, "invalid profile: {}", err) + write!(f, "invalid profile: {err}") } ProfileFileError::CredentialLoop { profiles, next } => write!( f, - "profile formed an infinite loop. first we loaded {:?}, \ - then attempted to reload {}", - profiles, next + "profile formed an infinite loop. first we loaded {profiles:?}, \ + then attempted to reload {next}", ), ProfileFileError::MissingCredentialSource { profile, message } => { - write!(f, "missing credential source in `{}`: {}", profile, message) + write!(f, "missing credential source in `{profile}`: {message}") } ProfileFileError::InvalidCredentialSource { profile, message } => { - write!(f, "invalid credential source in `{}`: {}", profile, message) + write!(f, "invalid credential source in `{profile}`: {message}") } ProfileFileError::MissingProfile { profile, message } => { - write!(f, "profile `{}` was not defined: {}", profile, message) + write!(f, "profile `{profile}` was not defined: {message}") } ProfileFileError::UnknownProvider { name } => write!( f, - "profile referenced `{}` provider but that provider is not supported", - name + "profile referenced `{name}` provider but that provider is not supported", ), ProfileFileError::NoProfilesDefined => write!(f, "No profiles were defined"), ProfileFileError::ProfileDidNotContainCredentials { profile } => write!( f, - "profile `{}` did not contain credential information", - profile + "profile `{profile}` did not contain credential information" ), ProfileFileError::FeatureNotEnabled { feature, message } => { let message = message.as_deref().unwrap_or_default(); diff --git a/aws/rust-runtime/aws-config/src/profile/credentials/repr.rs b/aws/rust-runtime/aws-config/src/profile/credentials/repr.rs index 4fc90ba3dad..1106bcdd205 100644 --- a/aws/rust-runtime/aws-config/src/profile/credentials/repr.rs +++ b/aws/rust-runtime/aws-config/src/profile/credentials/repr.rs @@ -190,7 +190,7 @@ pub(crate) fn resolve_chain( } else { ProfileFileError::InvalidCredentialSource { profile: profile.name().into(), - message: format!("could not load source profile: {}", err).into(), + message: format!("could not load source profile: {err}").into(), } } })?; diff --git a/aws/rust-runtime/aws-config/src/sensitive_command.rs b/aws/rust-runtime/aws-config/src/sensitive_command.rs index 84f87584a3c..1f2edd74bd1 100644 --- a/aws/rust-runtime/aws-config/src/sensitive_command.rs +++ b/aws/rust-runtime/aws-config/src/sensitive_command.rs @@ -36,7 +36,7 @@ where let command = self.0.as_ref(); match command.find(char::is_whitespace) { Some(index) => write!(f, "{} ** arguments redacted **", &command[0..index]), - None => write!(f, "{}", command), + None => write!(f, "{command}"), } } } diff --git a/aws/rust-runtime/aws-config/src/sso/cache.rs b/aws/rust-runtime/aws-config/src/sso/cache.rs index 6143256497a..42a1bb1b328 100644 --- a/aws/rust-runtime/aws-config/src/sso/cache.rs +++ b/aws/rust-runtime/aws-config/src/sso/cache.rs @@ -294,7 +294,7 @@ fn json_parse_loop<'a>( } other => { return Err(Error::Other( - format!("expected object key, found: {:?}", other).into(), + format!("expected object key, found: {other:?}").into(), )); } } diff --git a/aws/rust-runtime/aws-config/src/sso/credentials.rs b/aws/rust-runtime/aws-config/src/sso/credentials.rs index a885761dc72..5b6b4fc6dd7 100644 --- a/aws/rust-runtime/aws-config/src/sso/credentials.rs +++ b/aws/rust-runtime/aws-config/src/sso/credentials.rs @@ -284,8 +284,7 @@ async fn load_sso_credentials( .try_into() .map_err(|err| { CredentialsError::unhandled(format!( - "expiration could not be converted into a system time: {}", - err + "expiration could not be converted into a system time: {err}", )) })?; let mut builder = Credentials::builder() diff --git a/aws/rust-runtime/aws-config/src/web_identity_token.rs b/aws/rust-runtime/aws-config/src/web_identity_token.rs index d490f5574db..be8b25554b1 100644 --- a/aws/rust-runtime/aws-config/src/web_identity_token.rs +++ b/aws/rust-runtime/aws-config/src/web_identity_token.rs @@ -130,7 +130,7 @@ impl WebIdentityTokenCredentialsProvider { match &self.source { Source::Env(env) => { let token_file = env.get(ENV_VAR_TOKEN_FILE).map_err(|_| { - CredentialsError::not_loaded(format!("${} was not set", ENV_VAR_TOKEN_FILE)) + CredentialsError::not_loaded(format!("${ENV_VAR_TOKEN_FILE} was not set")) })?; let role_arn = env.get(ENV_VAR_ROLE_ARN).map_err(|_| { CredentialsError::invalid_configuration( diff --git a/aws/rust-runtime/aws-runtime/Cargo.toml b/aws/rust-runtime/aws-runtime/Cargo.toml index 2928bb0d6f7..043d3885149 100644 --- a/aws/rust-runtime/aws-runtime/Cargo.toml +++ b/aws/rust-runtime/aws-runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-runtime" -version = "1.5.12" +version = "1.5.13" authors = ["AWS Rust SDK Team "] description = "Runtime support code for the AWS SDK. This crate isn't intended to be used directly." edition = "2021" diff --git a/aws/rust-runtime/aws-runtime/src/env_config.rs b/aws/rust-runtime/aws-runtime/src/env_config.rs index f69cc18e26e..32bfd0e64b1 100644 --- a/aws/rust-runtime/aws-runtime/src/env_config.rs +++ b/aws/rust-runtime/aws-runtime/src/env_config.rs @@ -212,7 +212,7 @@ impl<'a> EnvConfigValue<'a> { value .map(|(v, ctx)| { validator(v.as_ref()).map_err(|err| EnvConfigError { - property_source: format!("{}", ctx), + property_source: format!("{ctx}"), err, }) }) @@ -234,7 +234,7 @@ impl<'a> EnvConfigValue<'a> { let origin: Origin = (&ctx).into(); validator(v.as_ref()) .map_err(|err| EnvConfigError { - property_source: format!("{}", ctx), + property_source: format!("{ctx}"), err, }) .map(|value| (Some(value), origin)) diff --git a/aws/rust-runtime/aws-runtime/src/env_config/normalize.rs b/aws/rust-runtime/aws-runtime/src/env_config/normalize.rs index a86e45bf704..9d838454db2 100644 --- a/aws/rust-runtime/aws-runtime/src/env_config/normalize.rs +++ b/aws/rust-runtime/aws-runtime/src/env_config/normalize.rs @@ -203,10 +203,7 @@ fn validate_identifier(input: &str) -> Result<&str, ()> { input .chars() .all(|ch| { - ch.is_ascii_alphanumeric() - || ['_', '-', '/', '.', '%', '@', ':', '+'] - .iter() - .any(|c| *c == ch) + ch.is_ascii_alphanumeric() || ['_', '-', '/', '.', '%', '@', ':', '+'].contains(&ch) }) .then_some(input) .ok_or(()) diff --git a/aws/rust-runtime/aws-runtime/src/env_config/parse.rs b/aws/rust-runtime/aws-runtime/src/env_config/parse.rs index eafa41f3a0b..48a337efa9e 100644 --- a/aws/rust-runtime/aws-runtime/src/env_config/parse.rs +++ b/aws/rust-runtime/aws-runtime/src/env_config/parse.rs @@ -234,12 +234,12 @@ impl PropertyError { ctx.get_mut(0..1).unwrap().make_ascii_uppercase(); EnvConfigParseError { location, - message: format!("{} did not have a name", ctx), + message: format!("{ctx} did not have a name"), } } PropertyError::NoEquals => EnvConfigParseError { location, - message: format!("Expected an '=' sign defining a {}", ctx), + message: format!("Expected an '=' sign defining a {ctx}"), }, } } diff --git a/aws/rust-runtime/aws-runtime/src/user_agent.rs b/aws/rust-runtime/aws-runtime/src/user_agent.rs index c13ce396266..f15196d230e 100644 --- a/aws/rust-runtime/aws-runtime/src/user_agent.rs +++ b/aws/rust-runtime/aws-runtime/src/user_agent.rs @@ -247,22 +247,22 @@ impl AwsUserAgent { write!(ua_value, "{} ", &self.os_metadata).unwrap(); write!(ua_value, "{} ", &self.language_metadata).unwrap(); if let Some(ref env_meta) = self.exec_env_metadata { - write!(ua_value, "{} ", env_meta).unwrap(); + write!(ua_value, "{env_meta} ").unwrap(); } if !self.business_metrics.is_empty() { write!(ua_value, "{} ", &self.business_metrics).unwrap() } for framework in &self.framework_metadata { - write!(ua_value, "{} ", framework).unwrap(); + write!(ua_value, "{framework} ").unwrap(); } for additional_metadata in &self.additional_metadata { - write!(ua_value, "{} ", additional_metadata).unwrap(); + write!(ua_value, "{additional_metadata} ").unwrap(); } if let Some(app_name) = &self.app_name { - write!(ua_value, "app/{}", app_name).unwrap(); + write!(ua_value, "app/{app_name}").unwrap(); } if let Some(additional_metadata) = &self.build_env_additional_metadata { - write!(ua_value, "{}", additional_metadata).unwrap(); + write!(ua_value, "{additional_metadata}").unwrap(); } if ua_value.ends_with(' ') { ua_value.truncate(ua_value.len() - 1); @@ -418,7 +418,7 @@ impl AdditionalMetadataList { impl fmt::Display for AdditionalMetadataList { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { for metadata in &self.0 { - write!(f, " {}", metadata)?; + write!(f, " {metadata}")?; } Ok(()) } @@ -579,9 +579,9 @@ impl fmt::Display for OsMetadata { OsFamily::Ios => "ios", OsFamily::Other => "other", }; - write!(f, "os/{}", os_family)?; + write!(f, "os/{os_family}")?; if let Some(ref version) = self.version { - write!(f, "/{}", version)?; + write!(f, "/{version}")?; } Ok(()) } diff --git a/aws/rust-runtime/aws-runtime/src/user_agent/metrics.rs b/aws/rust-runtime/aws-runtime/src/user_agent/metrics.rs index daf97fa5b52..30642ba89f6 100644 --- a/aws/rust-runtime/aws-runtime/src/user_agent/metrics.rs +++ b/aws/rust-runtime/aws-runtime/src/user_agent/metrics.rs @@ -318,7 +318,7 @@ impl fmt::Display for BusinessMetrics { MAX_COMMA_SEPARATED_METRICS_VALUES_LENGTH, ); - write!(f, "m/{}", metrics_values) + write!(f, "m/{metrics_values}") } } #[cfg(test)] diff --git a/aws/rust-runtime/aws-sigv4/Cargo.toml b/aws/rust-runtime/aws-sigv4/Cargo.toml index 8bb8ed2722a..de172669820 100644 --- a/aws/rust-runtime/aws-sigv4/Cargo.toml +++ b/aws/rust-runtime/aws-sigv4/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-sigv4" -version = "1.3.5" +version = "1.3.6" authors = ["AWS Rust SDK Team ", "David Barsky "] description = "SigV4 signer for HTTP requests and Event Stream messages." edition = "2021" diff --git a/aws/rust-runtime/aws-sigv4/src/event_stream.rs b/aws/rust-runtime/aws-sigv4/src/event_stream.rs index 154bb11facf..4f619893b14 100644 --- a/aws/rust-runtime/aws-sigv4/src/event_stream.rs +++ b/aws/rust-runtime/aws-sigv4/src/event_stream.rs @@ -74,14 +74,14 @@ fn calculate_string_to_sign( let mut sts: Vec = Vec::new(); writeln!(sts, "AWS4-HMAC-SHA256-PAYLOAD").unwrap(); - writeln!(sts, "{}", date_time_str).unwrap(); + writeln!(sts, "{date_time_str}").unwrap(); writeln!( sts, "{}/{}/{}/aws4_request", date_str, params.region, params.name ) .unwrap(); - writeln!(sts, "{}", last_signature).unwrap(); + writeln!(sts, "{last_signature}").unwrap(); let date_header = Header::new(":date", HeaderValue::Timestamp(time.into())); let mut date_buffer = Vec::new(); diff --git a/aws/rust-runtime/aws-sigv4/src/sign/v4.rs b/aws/rust-runtime/aws-sigv4/src/sign/v4.rs index fc00249854a..1806f362d37 100644 --- a/aws/rust-runtime/aws-sigv4/src/sign/v4.rs +++ b/aws/rust-runtime/aws-sigv4/src/sign/v4.rs @@ -38,7 +38,7 @@ pub fn generate_signing_key( // kService = HMAC(kRegion, Service) // kSigning = HMAC(kService, "aws4_request") - let secret = format!("AWS4{}", secret); + let secret = format!("AWS4{secret}"); let mut mac = Hmac::::new_from_slice(secret.as_ref()).expect("HMAC can take key of any size"); mac.update(format_date(time).as_bytes()); diff --git a/aws/rust-runtime/aws-types/Cargo.toml b/aws/rust-runtime/aws-types/Cargo.toml index 9d00305889a..82d530b7b21 100644 --- a/aws/rust-runtime/aws-types/Cargo.toml +++ b/aws/rust-runtime/aws-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-types" -version = "1.3.9" +version = "1.3.10" authors = ["AWS Rust SDK Team ", "Russell Cohen "] description = "Cross-service types for the AWS SDK." edition = "2021" diff --git a/aws/rust-runtime/aws-types/build.rs b/aws/rust-runtime/aws-types/build.rs index 593ac054b34..1b776053eef 100644 --- a/aws/rust-runtime/aws-types/build.rs +++ b/aws/rust-runtime/aws-types/build.rs @@ -13,7 +13,7 @@ fn generate_build_vars(output_path: &Path) { let rust_version = rustc_version::version().expect("Could not retrieve rustc version"); let mut f = File::create(output_path.join("build_env.rs")).expect("Could not create build environment"); - f.write_all(format!("const RUST_VERSION: &str = \"{}\";", rust_version).as_bytes()) + f.write_all(format!("const RUST_VERSION: &str = \"{rust_version}\";").as_bytes()) .expect("Unable to write rust version"); f.flush().expect("failed to flush"); } diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/generators/EndpointResolverGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/generators/EndpointResolverGenerator.kt index c5adc23dcf0..3ce3bf3dd69 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/generators/EndpointResolverGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/endpoint/generators/EndpointResolverGenerator.kt @@ -260,7 +260,7 @@ internal class EndpointResolverGenerator( // it's hard to figure out if these are always needed or not Attribute.AllowUnreachableCode.render(this) rustTemplate( - """return Err(#{EndpointError}::message(format!("No rules matched these parameters. This is a bug. {:?}", $PARAMS_NAME)));""", + """return Err(#{EndpointError}::message(format!("No rules matched these parameters. This is a bug. {$PARAMS_NAME:?}")));""", *codegenScope, ) } diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ClientEnumGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ClientEnumGenerator.kt index 04f6028ef97..4b5cac04ab7 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ClientEnumGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ClientEnumGenerator.kt @@ -155,7 +155,7 @@ data class InfallibleEnumType( """, ) } - rust("""${context.enumName}::Unknown(value) => write!(f, "{}", value)""") + rust("""${context.enumName}::Unknown(value) => write!(f, "{value}")""") }, ) } diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingGenerator.kt index 9c24ae3ad33..ed594487b62 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/EndpointTraitBindingGenerator.kt @@ -9,6 +9,7 @@ import software.amazon.smithy.model.Model import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.model.traits.EndpointTrait import software.amazon.smithy.rust.codegen.client.smithy.generators.http.rustFormatString +import software.amazon.smithy.rust.codegen.core.rustlang.Attribute.Companion.AllowUninlinedFormatArgs import software.amazon.smithy.rust.codegen.core.rustlang.RustWriter import software.amazon.smithy.rust.codegen.core.rustlang.rust import software.amazon.smithy.rust.codegen.core.rustlang.rustBlock @@ -88,6 +89,11 @@ class EndpointTraitBindings( } "${label.content} = $field" } + // Suppress the suggestion that would change the following: + // EndpointPrefix::new(format!("{accountId}.")) + // To: + // EndpointPrefix::new(format!("{accountId}.", accountId = account_id)) + AllowUninlinedFormatArgs.render(this) rustTemplate( "#{EndpointPrefix}::new(format!($formatLiteral, ${args.joinToString()}))", "EndpointPrefix" to endpointPrefix, diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/http/RequestBindingGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/http/RequestBindingGenerator.kt index d9e23715a97..df60e52448b 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/http/RequestBindingGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/http/RequestBindingGenerator.kt @@ -135,6 +135,11 @@ class RequestBindingGenerator( "${label.content} = ${local(member)}" } val combinedArgs = listOf(formatString, *args.toTypedArray()) + // Suppress the suggestion that would change the following: + // ::std::write!(output, "/snapshots/{SnapshotId}/blocks/{BlockIndex}", SnapshotId = snapshot_id, BlockIndex = block_index) + // To: + // ::std::write!(output, "/snapshots/{snapshot_id}/blocks/{block_index}") + Attribute.AllowUninlinedFormatArgs.render(writer) writer.rustBlockTemplate( "fn uri_base(_input: &#{Input}, output: &mut #{String}) -> #{Result}<(), #{BuildError}>", *codegenScope, 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 bf64a783d93..71f2a8d791b 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 @@ -598,6 +598,7 @@ class Attribute(val inner: Writable, val isDeriveHelper: Boolean = false) { val AllowIrrefutableLetPatterns = Attribute(allow("irrefutable_let_patterns")) val AllowMissingDocs = Attribute(allow("missing_docs")) val AllowNonSnakeCase = Attribute(allow("non_snake_case")) + val AllowUninlinedFormatArgs = Attribute(allow("clippy::uninlined_format_args")) val AllowUnreachableCode = Attribute(allow("unreachable_code")) val AllowUnreachablePatterns = Attribute(allow("unreachable_patterns")) val AllowUnused = Attribute(allow("unused")) 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 bb851ab7022..db0fd7736e9 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 @@ -69,6 +69,8 @@ class AllowLintsCustomization( private val rustcLints: List = allowedRustcLints, private val clippyLints: List = allowedClippyLints, private val rustdocLints: List = allowedRustdocLints, + // TODO(https://github.com/smithy-lang/smithy-rs/issues/4366) Remove additionalClippyLints once the issue is resolved + private val additionalClippyLints: List = emptyList(), ) : LibRsCustomization() { override fun section(section: LibRsSection) = when (section) { @@ -77,7 +79,7 @@ class AllowLintsCustomization( rustcLints.forEach { Attribute(allow(it)).render(this, AttributeKind.Inner) } - clippyLints.forEach { + (clippyLints + additionalClippyLints).forEach { Attribute(allow("clippy::$it")).render(this, AttributeKind.Inner) } rustdocLints.forEach { diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/error/ErrorImplGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/error/ErrorImplGenerator.kt index bc6881521bf..3280412ef98 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/error/ErrorImplGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/error/ErrorImplGenerator.kt @@ -164,7 +164,12 @@ class ErrorImplGenerator( write("""::std::write!(f, ": {}", $REDACTION)?;""") } else { ifSet(it, symbolProvider.toSymbol(it), ValueExpression.Reference("&self.message")) { field -> - write("""::std::write!(f, ": {}", ${field.asRef()})?;""") + val referenced = field.asRef() + if (referenced.startsWith("&")) { + write("""::std::write!(f, ": {}", $referenced)?;""") + } else { + write("""::std::write!(f, ": {$referenced}")?;""") + } } } } 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 e31aabea1a4..bade1055401 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 @@ -774,12 +774,11 @@ class HttpBindingGenerator( }, "invalid_header_value" to OperationBuildError(runtimeConfig).invalidField(memberName) { + val maybeRedactedValue = memberShape.redactIfNecessary(model, "v") rust( """ format!( - "`{}` cannot be used as a header value: {}", - ${memberShape.redactIfNecessary(model, "v")}, - err + "`{$maybeRedactedValue}` cannot be used as a header value: {err}" ) """, ) diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/AwsQueryParserGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/AwsQueryParserGenerator.kt index 2fc1f5c6497..2cdf05082ab 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/AwsQueryParserGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/AwsQueryParserGenerator.kt @@ -38,12 +38,12 @@ class AwsQueryParserGenerator( rustTemplate( """ if !(${XmlBindingTraitParserGenerator.XmlName(responseWrapperName).matchExpression("start_el")}) { - return Err(#{XmlDecodeError}::custom(format!("invalid root, expected $responseWrapperName got {:?}", start_el))) + return Err(#{XmlDecodeError}::custom(format!("invalid root, expected $responseWrapperName got {start_el:?}"))) } if let Some(mut result_tag) = decoder.next_tag() { let start_el = result_tag.start_el(); if !(${XmlBindingTraitParserGenerator.XmlName(resultWrapperName).matchExpression("start_el")}) { - return Err(#{XmlDecodeError}::custom(format!("invalid result, expected $resultWrapperName got {:?}", start_el))) + return Err(#{XmlDecodeError}::custom(format!("invalid result, expected $resultWrapperName got {start_el:?}"))) } """, "XmlDecodeError" to context.xmlDecodeErrorType, diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/Ec2QueryParserGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/Ec2QueryParserGenerator.kt index 00cdc784d17..b98c069e00e 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/Ec2QueryParserGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/Ec2QueryParserGenerator.kt @@ -35,7 +35,7 @@ class Ec2QueryParserGenerator( rustTemplate( """ if !(${XmlBindingTraitParserGenerator.XmlName(responseWrapperName).matchExpression("start_el")}) { - return Err(#{XmlDecodeError}::custom(format!("invalid root, expected $responseWrapperName got {:?}", start_el))) + return Err(#{XmlDecodeError}::custom(format!("invalid root, expected $responseWrapperName got {start_el:?}"))) } """, "XmlDecodeError" to context.xmlDecodeErrorType, diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/EventStreamUnmarshallerGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/EventStreamUnmarshallerGenerator.kt index 28737bf353c..39fcb5dfc61 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/EventStreamUnmarshallerGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/EventStreamUnmarshallerGenerator.kt @@ -136,7 +136,7 @@ class EventStreamUnmarshallerGenerator( } rustBlock("value => ") { rustTemplate( - "return Err(#{Error}::unmarshalling(format!(\"unrecognized :message-type: {}\", value)));", + "return Err(#{Error}::unmarshalling(format!(\"unrecognized :message-type: {value}\")));", *codegenScope, ) } @@ -171,7 +171,7 @@ class EventStreamUnmarshallerGenerator( false -> rustTemplate( - "return Err(#{Error}::unmarshalling(format!(\"unrecognized :event-type: {}\", _unknown_variant)));", + "return Err(#{Error}::unmarshalling(format!(\"unrecognized :event-type: {_unknown_variant}\")));", *codegenScope, ) } @@ -279,8 +279,7 @@ class EventStreamUnmarshallerGenerator( let content_type = response_headers.content_type().unwrap_or_default(); if content_type != ${contentType.dq()} { return Err(#{Error}::unmarshalling(format!( - "expected :content-type to be '$contentType', but was '{}'", - content_type + "expected :content-type to be '$contentType', but was '{content_type}'" ))) } """, @@ -320,7 +319,7 @@ class EventStreamUnmarshallerGenerator( """ #{parser}(&message.payload()[..]) .map_err(|err| { - #{Error}::unmarshalling(format!("failed to unmarshall $memberName: {}", err)) + #{Error}::unmarshalling(format!("failed to unmarshall $memberName: {err}")) })? """, "parser" to parser, @@ -371,7 +370,7 @@ class EventStreamUnmarshallerGenerator( """ builder = #{parser}(&message.payload()[..], builder) .map_err(|err| { - #{Error}::unmarshalling(format!("failed to unmarshall ${member.memberName}: {}", err)) + #{Error}::unmarshalling(format!("failed to unmarshall ${member.memberName}: {err}")) })?; builder.set_meta(Some(generic)); return Ok(#{UnmarshalledMessage}::Error( @@ -385,7 +384,7 @@ class EventStreamUnmarshallerGenerator( "builder", target, mapErr = { rustTemplate( - """|err|#{Error}::unmarshalling(format!("{}", err))""", + """|err|#{Error}::unmarshalling(format!("{err}"))""", *codegenScope, ) }, @@ -411,7 +410,7 @@ class EventStreamUnmarshallerGenerator( """ builder = #{parser}(&message.payload()[..], builder) .map_err(|err| { - #{Error}::unmarshalling(format!("failed to unmarshall ${member.memberName}: {}", err)) + #{Error}::unmarshalling(format!("failed to unmarshall ${member.memberName}: {err}")) })?; """, "parser" to parser, diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/JsonParserGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/JsonParserGenerator.kt index a1d4d360821..50569ccc776 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/JsonParserGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/JsonParserGenerator.kt @@ -632,7 +632,7 @@ class JsonParserGenerator( // Consultation: https://github.com/awslabs/smithy/issues/1222 false -> rustTemplate( - """variant => return Err(#{Error}::custom(format!("unexpected union variant: {}", variant)))""", + """variant => return Err(#{Error}::custom(format!("unexpected union variant: {variant}")))""", *codegenScope, ) } @@ -693,7 +693,7 @@ class JsonParserGenerator( inner() } rustTemplate( - """other => return Err(#{Error}::custom(format!("expected object key or end object, found: {:?}", other)))""", + """other => return Err(#{Error}::custom(format!("expected object key or end object, found: {other:?}")))""", *codegenScope, ) } diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/RestXmlParserGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/RestXmlParserGenerator.kt index cea67a46c2b..67ad761e2e3 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/RestXmlParserGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/RestXmlParserGenerator.kt @@ -38,7 +38,7 @@ class RestXmlParserGenerator( if !${XmlBindingTraitParserGenerator.XmlName(shapeName).matchExpression("start_el")} { return Err( #{XmlDecodeError}::custom( - format!("encountered invalid XML root: expected $shapeName but got {:?}. This is likely a bug in the SDK.", start_el) + format!("encountered invalid XML root: expected $shapeName but got {start_el:?}. This is likely a bug in the SDK.") ) ) } diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/XmlBindingTraitParserGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/XmlBindingTraitParserGenerator.kt index 64cf8d9d7d2..b69a9f64fd3 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/XmlBindingTraitParserGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/XmlBindingTraitParserGenerator.kt @@ -150,7 +150,7 @@ class XmlBindingTraitParserGenerator( let mut decoder = doc.root_element()?; let start_el = decoder.start_el(); if !(${shapeName.matchExpression("start_el")}) { - return Err(#{XmlDecodeError}::custom(format!("invalid root, expected $shapeName got {:?}", start_el))) + return Err(#{XmlDecodeError}::custom(format!("invalid root, expected $shapeName got {start_el:?}"))) } """, *codegenScope, @@ -468,7 +468,7 @@ class XmlBindingTraitParserGenerator( true -> rust("_unknown => base = Some(#T::${UnionGenerator.UNKNOWN_VARIANT_NAME}),", symbol) false -> rustTemplate( - """variant => return Err(#{XmlDecodeError}::custom(format!("unexpected union variant: {:?}", variant)))""", + """variant => return Err(#{XmlDecodeError}::custom(format!("unexpected union variant: {variant:?}")))""", *codegenScope, ) } @@ -713,7 +713,7 @@ class XmlBindingTraitParserGenerator( provider() } rustTemplate( - """.map_err(|err|#{XmlDecodeError}::custom(format!("invalid base64: {:?}", err))).map(#{Blob}::new)""", + """.map_err(|err|#{XmlDecodeError}::custom(format!("invalid base64: {err:?}"))).map(#{Blob}::new)""", *codegenScope, ) } @@ -734,7 +734,7 @@ class XmlBindingTraitParserGenerator( provider() } rustTemplate( - """.map_err(|e| #{XmlDecodeError}::custom(format!("unknown variant {}", e)))?""", + """.map_err(|e| #{XmlDecodeError}::custom(format!("unknown variant {e}")))?""", *codegenScope, ) } else { diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/serialize/EventStreamMarshallerGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/serialize/EventStreamMarshallerGenerator.kt index dc3c63bb666..0e73d213593 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/serialize/EventStreamMarshallerGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/serialize/EventStreamMarshallerGenerator.kt @@ -304,7 +304,7 @@ open class EventStreamMarshallerGenerator( rustTemplate( """ #{serializerFn}(&$input) - .map_err(|err| #{Error}::marshalling(format!("{}", err)))? + .map_err(|err| #{Error}::marshalling(format!("{err}")))? """, "serializerFn" to serializerFn, *codegenScope, diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/customizations/ServerRequiredCustomizations.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/customizations/ServerRequiredCustomizations.kt index a366b39c2ea..97bed801244 100644 --- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/customizations/ServerRequiredCustomizations.kt +++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/customizations/ServerRequiredCustomizations.kt @@ -31,7 +31,9 @@ class ServerRequiredCustomizations : ServerCodegenDecorator { override fun libRsCustomizations( codegenContext: ServerCodegenContext, baseCustomizations: List, - ): List = baseCustomizations + AllowLintsCustomization() + ): List = + // TODO(https://github.com/smithy-lang/smithy-rs/issues/4366) Remove additionalClippyLints once the issue is resolved + baseCustomizations + AllowLintsCustomization(additionalClippyLints = listOf("uninlined_format_args")) override fun extras( codegenContext: ServerCodegenContext, diff --git a/examples/pokemon-service-common/src/lib.rs b/examples/pokemon-service-common/src/lib.rs index 16c25e02f55..9fc8c004577 100644 --- a/examples/pokemon-service-common/src/lib.rs +++ b/examples/pokemon-service-common/src/lib.rs @@ -293,7 +293,7 @@ pub async fn capture_pokemon( } None => break, }, - Err(e) => println!("{:?}", e), + Err(e) => println!("{e:?}"), } } }; diff --git a/examples/pokemon-service-lambda/src/main.rs b/examples/pokemon-service-lambda/src/main.rs index a5c914534b9..93de83b2ede 100644 --- a/examples/pokemon-service-lambda/src/main.rs +++ b/examples/pokemon-service-lambda/src/main.rs @@ -41,6 +41,6 @@ pub async fn main() { let lambda = lambda_http::run(handler); if let Err(err) = lambda.await { - eprintln!("lambda error: {}", err); + eprintln!("lambda error: {err}"); } } diff --git a/examples/pokemon-service-tls/src/main.rs b/examples/pokemon-service-tls/src/main.rs index 19d05119dc5..b077c5ca37f 100644 --- a/examples/pokemon-service-tls/src/main.rs +++ b/examples/pokemon-service-tls/src/main.rs @@ -134,7 +134,7 @@ pub async fn main() { .connections() .filter(|conn| { if let Err(err) = conn { - eprintln!("connection error: {:?}", err); + eprintln!("connection error: {err:?}"); future::ready(false) } else { future::ready(true) @@ -146,7 +146,7 @@ pub async fn main() { let server = hyper::Server::builder(hyper::server::accept::from_stream(listener)).serve(make_app); if let Err(err) = server.await { - eprintln!("server error: {}", err); + eprintln!("server error: {err}"); } } diff --git a/examples/pokemon-service/src/main.rs b/examples/pokemon-service/src/main.rs index 4420553a4d1..16045350405 100644 --- a/examples/pokemon-service/src/main.rs +++ b/examples/pokemon-service/src/main.rs @@ -110,6 +110,6 @@ pub async fn main() { // Run forever-ish... if let Err(err) = server.await { - eprintln!("server error: {}", err); + eprintln!("server error: {err}"); } } diff --git a/gradle.properties b/gradle.properties index 20c04016098..ac9b60416ea 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # # Rust MSRV (entered into the generated README) -rust.msrv=1.86.0 +rust.msrv=1.88.0 # To enable debug, swap out the two lines below. # When changing this value, be sure to run `./gradlew --stop` to kill the Gradle daemon. # org.gradle.jvmargs=-Xmx1024M -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:5006 diff --git a/rust-runtime/Cargo.lock b/rust-runtime/Cargo.lock index a30a9ebf303..7ec8b082c87 100644 --- a/rust-runtime/Cargo.lock +++ b/rust-runtime/Cargo.lock @@ -315,7 +315,7 @@ dependencies = [ [[package]] name = "aws-smithy-cbor" -version = "0.61.2" +version = "0.61.3" dependencies = [ "aws-smithy-types", "criterion", @@ -346,7 +346,7 @@ dependencies = [ [[package]] name = "aws-smithy-compression" -version = "0.0.5" +version = "0.0.6" dependencies = [ "aws-smithy-runtime-api", "aws-smithy-types", @@ -367,7 +367,7 @@ dependencies = [ [[package]] name = "aws-smithy-dns" -version = "0.1.3" +version = "0.1.4" dependencies = [ "aws-smithy-runtime-api", "criterion", @@ -377,7 +377,7 @@ dependencies = [ [[package]] name = "aws-smithy-eventstream" -version = "0.60.12" +version = "0.60.13" dependencies = [ "arbitrary", "aws-smithy-types", @@ -461,7 +461,7 @@ dependencies = [ [[package]] name = "aws-smithy-http-server" -version = "0.65.7" +version = "0.65.8" dependencies = [ "aws-smithy-cbor", "aws-smithy-http", @@ -491,7 +491,7 @@ dependencies = [ [[package]] name = "aws-smithy-http-server-python" -version = "0.66.4" +version = "0.66.5" dependencies = [ "aws-smithy-http", "aws-smithy-http-server", @@ -530,7 +530,7 @@ dependencies = [ [[package]] name = "aws-smithy-json" -version = "0.61.6" +version = "0.61.7" dependencies = [ "aws-smithy-types", "proptest", @@ -575,7 +575,7 @@ dependencies = [ [[package]] name = "aws-smithy-protocol-test" -version = "0.63.5" +version = "0.63.6" dependencies = [ "assert-json-diff", "aws-smithy-runtime-api", @@ -628,7 +628,7 @@ dependencies = [ [[package]] name = "aws-smithy-runtime-api" -version = "1.9.1" +version = "1.9.2" dependencies = [ "aws-smithy-async", "aws-smithy-types", @@ -644,7 +644,7 @@ dependencies = [ [[package]] name = "aws-smithy-types" -version = "1.3.3" +version = "1.3.4" dependencies = [ "base64 0.13.1", "base64-simd", @@ -702,7 +702,7 @@ dependencies = [ [[package]] name = "aws-smithy-xml" -version = "0.60.11" +version = "0.60.12" dependencies = [ "aws-smithy-protocol-test", "base64 0.13.1", diff --git a/rust-runtime/aws-smithy-cbor/Cargo.toml b/rust-runtime/aws-smithy-cbor/Cargo.toml index f60be2a228f..52c5342f88d 100644 --- a/rust-runtime/aws-smithy-cbor/Cargo.toml +++ b/rust-runtime/aws-smithy-cbor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-smithy-cbor" -version = "0.61.2" +version = "0.61.3" authors = [ "AWS Rust SDK Team ", "David Pérez ", diff --git a/rust-runtime/aws-smithy-cbor/src/decode.rs b/rust-runtime/aws-smithy-cbor/src/decode.rs index 2008e8f066f..c5ed29bb87f 100644 --- a/rust-runtime/aws-smithy-cbor/src/decode.rs +++ b/rust-runtime/aws-smithy-cbor/src/decode.rs @@ -55,11 +55,8 @@ impl DeserializeError { /// Unknown union variant was detected. Servers reject unknown union varaints. pub fn unknown_union_variant(variant_name: &str, at: usize) -> Self { Self { - _inner: Error::message(format!( - "encountered unknown union variant {}", - variant_name - )) - .at(at), + _inner: Error::message(format!("encountered unknown union variant {variant_name}")) + .at(at), } } diff --git a/rust-runtime/aws-smithy-checksums/src/body/calculate.rs b/rust-runtime/aws-smithy-checksums/src/body/calculate.rs index 3bdace7aadc..0b148202ef0 100644 --- a/rust-runtime/aws-smithy-checksums/src/body/calculate.rs +++ b/rust-runtime/aws-smithy-checksums/src/body/calculate.rs @@ -146,7 +146,7 @@ mod tests { acc }); - format!("0x{}", decoded_checksum) + format!("0x{decoded_checksum}") } #[tokio::test] diff --git a/rust-runtime/aws-smithy-checksums/src/lib.rs b/rust-runtime/aws-smithy-checksums/src/lib.rs index 5aca86fe251..5d42940db31 100644 --- a/rust-runtime/aws-smithy-checksums/src/lib.rs +++ b/rust-runtime/aws-smithy-checksums/src/lib.rs @@ -392,7 +392,7 @@ mod tests { acc }); - format!("0x{}", decoded_checksum) + format!("0x{decoded_checksum}") } #[test] diff --git a/rust-runtime/aws-smithy-compression/Cargo.toml b/rust-runtime/aws-smithy-compression/Cargo.toml index 37219486f13..48f657db466 100644 --- a/rust-runtime/aws-smithy-compression/Cargo.toml +++ b/rust-runtime/aws-smithy-compression/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-smithy-compression" -version = "0.0.5" +version = "0.0.6" authors = [ "AWS Rust SDK Team ", "Zelda Hessler ", diff --git a/rust-runtime/aws-smithy-compression/src/lib.rs b/rust-runtime/aws-smithy-compression/src/lib.rs index 257f546e37a..c01029b99f3 100644 --- a/rust-runtime/aws-smithy-compression/src/lib.rs +++ b/rust-runtime/aws-smithy-compression/src/lib.rs @@ -112,11 +112,9 @@ impl CompressionOptions { fn validate_level(level: u32) -> Result<(), BoxError> { if level > 9 { - return Err(format!( - "compression level `{}` is invalid, valid values are 0..=9", - level - ) - .into()); + return Err( + format!("compression level `{level}` is invalid, valid values are 0..=9").into(), + ); }; Ok(()) } @@ -126,8 +124,7 @@ impl CompressionOptions { ) -> Result<(), BoxError> { if min_compression_size_bytes > MAX_MIN_COMPRESSION_SIZE_BYTES { return Err(format!( - "min compression size `{}` is invalid, valid values are 0..=10_485_760", - min_compression_size_bytes + "min compression size `{min_compression_size_bytes}` is invalid, valid values are 0..=10_485_760" ) .into()); }; diff --git a/rust-runtime/aws-smithy-dns/Cargo.toml b/rust-runtime/aws-smithy-dns/Cargo.toml index 84785c28ad1..3ce29d2f462 100644 --- a/rust-runtime/aws-smithy-dns/Cargo.toml +++ b/rust-runtime/aws-smithy-dns/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-smithy-dns" -version = "0.1.3" +version = "0.1.4" authors = [ "AWS Rust SDK Team ", ] diff --git a/rust-runtime/aws-smithy-dns/src/hickory.rs b/rust-runtime/aws-smithy-dns/src/hickory.rs index df01c288fdd..d5776c95b2e 100644 --- a/rust-runtime/aws-smithy-dns/src/hickory.rs +++ b/rust-runtime/aws-smithy-dns/src/hickory.rs @@ -3,11 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -use std::{ - io::{Error as IoError, ErrorKind as IoErrorKind}, - net::IpAddr, - time::Duration, -}; +use std::{io::Error as IoError, net::IpAddr, time::Duration}; use aws_smithy_runtime_api::client::dns::{DnsFuture, ResolveDns, ResolveDnsError}; use hickory_resolver::{ @@ -60,10 +56,7 @@ impl ResolveDns for HickoryDnsResolver { match result { Ok(ips) => Ok(ips.into_iter().collect()), - Err(failure) => Err(ResolveDnsError::new(IoError::new( - IoErrorKind::Other, - failure, - ))), + Err(failure) => Err(ResolveDnsError::new(IoError::other(failure))), } }) } diff --git a/rust-runtime/aws-smithy-eventstream/Cargo.toml b/rust-runtime/aws-smithy-eventstream/Cargo.toml index 1d11217e6df..6d5e21d746f 100644 --- a/rust-runtime/aws-smithy-eventstream/Cargo.toml +++ b/rust-runtime/aws-smithy-eventstream/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "aws-smithy-eventstream" # Only patch releases can be made to this runtime crate until https://github.com/smithy-lang/smithy-rs/issues/3370 is resolved -version = "0.60.12" +version = "0.60.13" # authors = ["AWS Rust SDK Team ", "John DiSanti "] description = "Event stream logic for smithy-rs." diff --git a/rust-runtime/aws-smithy-eventstream/benches/write_message_performance.rs b/rust-runtime/aws-smithy-eventstream/benches/write_message_performance.rs index bce8233df4f..66a86b244fe 100644 --- a/rust-runtime/aws-smithy-eventstream/benches/write_message_performance.rs +++ b/rust-runtime/aws-smithy-eventstream/benches/write_message_performance.rs @@ -409,23 +409,17 @@ fn verify_implementations_match() { // Test original implementation let mut original_buffer = Vec::new(); - write_message_to(message, &mut original_buffer).expect(&format!( - "Original implementation failed for test case {}", - i - )); + write_message_to(message, &mut original_buffer) + .unwrap_or_else(|_| panic!("Original implementation failed for test case {i}")); // Test all optimized implementations let mut optimized_v1_buffer = Vec::new(); - write_message_to_optimized_v1(message, &mut optimized_v1_buffer).expect(&format!( - "Optimized v1 implementation failed for test case {}", - i - )); + write_message_to_optimized_v1(message, &mut optimized_v1_buffer) + .unwrap_or_else(|_| panic!("Optimized v1 implementation failed for test case {i}")); let mut optimized_v2_buffer = Vec::new(); - write_message_preallocate(message, &mut optimized_v2_buffer).expect(&format!( - "Optimized v2 implementation failed for test case {}", - i - )); + write_message_preallocate(message, &mut optimized_v2_buffer) + .unwrap_or_else(|_| panic!("Optimized v2 implementation failed for test case {i}")); // Compare results assert_eq!( @@ -444,25 +438,20 @@ fn verify_implementations_match() { let parsed_message = aws_smithy_eventstream::frame::read_message_from(&mut Bytes::from( original_buffer.clone(), )) - .expect(&format!( - "Failed to parse original output for test case {}", - i - )); + .unwrap_or_else(|_| panic!("Failed to parse original output for test case {i}")); // Verify headers match assert_eq!( message.headers(), parsed_message.headers(), - "Headers don't match after round-trip for test case {}", - i + "Headers don't match after round-trip for test case {i}" ); // Verify payload matches assert_eq!( message.payload().as_ref(), parsed_message.payload().as_ref(), - "Payload doesn't match after round-trip for test case {}", - i + "Payload doesn't match after round-trip for test case {i}" ); println!("✓ Test case {} passed - {} bytes", i, original_buffer.len()); diff --git a/rust-runtime/aws-smithy-eventstream/src/error.rs b/rust-runtime/aws-smithy-eventstream/src/error.rs index 99cb4ba759f..5417eae8ca5 100644 --- a/rust-runtime/aws-smithy-eventstream/src/error.rs +++ b/rust-runtime/aws-smithy-eventstream/src/error.rs @@ -83,29 +83,26 @@ impl fmt::Display for Error { HeaderValueTooLong => write!(f, "header value too long to fit in event stream frame"), InvalidHeaderNameLength => write!(f, "invalid header name length"), InvalidHeaderValue => write!(f, "invalid header value"), - InvalidHeaderValueType(val) => write!(f, "invalid header value type: {}", val), + InvalidHeaderValueType(val) => write!(f, "invalid header value type: {val}"), InvalidHeadersLength => write!(f, "invalid headers length"), InvalidMessageLength => write!(f, "invalid message length"), InvalidUtf8String => write!(f, "encountered invalid UTF-8 string"), MessageChecksumMismatch(expected, actual) => write!( f, - "message checksum 0x{:X} didn't match expected checksum 0x{:X}", - actual, expected + "message checksum 0x{actual:X} didn't match expected checksum 0x{expected:X}" ), MessageTooLong => write!(f, "message too long to fit in event stream frame"), PayloadTooLong => write!(f, "message payload too long to fit in event stream frame"), PreludeChecksumMismatch(expected, actual) => write!( f, - "prelude checksum 0x{:X} didn't match expected checksum 0x{:X}", - actual, expected + "prelude checksum 0x{actual:X} didn't match expected checksum 0x{expected:X}" ), TimestampValueTooLarge(time) => write!( f, - "timestamp value {:?} is too large to fit into an i64", - time + "timestamp value {time:?} is too large to fit into an i64" ), - Marshalling(error) => write!(f, "failed to marshall message: {}", error), - Unmarshalling(error) => write!(f, "failed to unmarshall message: {}", error), + Marshalling(error) => write!(f, "failed to marshall message: {error}"), + Unmarshalling(error) => write!(f, "failed to unmarshall message: {error}"), } } } diff --git a/rust-runtime/aws-smithy-eventstream/src/frame.rs b/rust-runtime/aws-smithy-eventstream/src/frame.rs index 8f1c9391200..a30a2015eee 100644 --- a/rust-runtime/aws-smithy-eventstream/src/frame.rs +++ b/rust-runtime/aws-smithy-eventstream/src/frame.rs @@ -743,7 +743,7 @@ mod message_frame_decoder_tests { #[test] fn multiple_streaming_messages() { for chunk_size in 1..=11 { - println!("chunk size: {}", chunk_size); + println!("chunk size: {chunk_size}"); multiple_streaming_messages_chunk_size(chunk_size); } } diff --git a/rust-runtime/aws-smithy-eventstream/src/message_size_hint.rs b/rust-runtime/aws-smithy-eventstream/src/message_size_hint.rs index 1771917b2f2..0d537a0c3b0 100644 --- a/rust-runtime/aws-smithy-eventstream/src/message_size_hint.rs +++ b/rust-runtime/aws-smithy-eventstream/src/message_size_hint.rs @@ -123,14 +123,13 @@ mod tests { // Get actual serialized size let mut buffer = Vec::new(); write_message_to(message, &mut buffer) - .expect(&format!("Failed to serialize test case {}", i)); + .unwrap_or_else(|_| panic!("Failed to serialize test case {i}")); let actual_size = buffer.len(); // The size hint should exactly match the actual serialized size assert_eq!( size_hint, actual_size, - "Size hint mismatch for test case {}: hint={}, actual={}", - i, size_hint, actual_size + "Size hint mismatch for test case {i}: hint={size_hint}, actual={actual_size}" ); } } diff --git a/rust-runtime/aws-smithy-eventstream/src/smithy.rs b/rust-runtime/aws-smithy-eventstream/src/smithy.rs index 85598094f13..8d29e675e77 100644 --- a/rust-runtime/aws-smithy-eventstream/src/smithy.rs +++ b/rust-runtime/aws-smithy-eventstream/src/smithy.rs @@ -74,13 +74,11 @@ fn expect_header_str_value<'a>( match header { Some(header) => Ok(header.value().as_string().map_err(|value| { Error::from(ErrorKind::Unmarshalling(format!( - "expected response {} header to be string, received {:?}", - name, value + "expected response {name} header to be string, received {value:?}" ))) })?), None => Err(ErrorKind::Unmarshalling(format!( - "expected response to include {} header, but it was missing", - name + "expected response to include {name} header, but it was missing" )) .into()), } diff --git a/rust-runtime/aws-smithy-eventstream/src/test_util.rs b/rust-runtime/aws-smithy-eventstream/src/test_util.rs index bc4c11f1cd5..9e5c75ad626 100644 --- a/rust-runtime/aws-smithy-eventstream/src/test_util.rs +++ b/rust-runtime/aws-smithy-eventstream/src/test_util.rs @@ -24,10 +24,8 @@ pub fn validate_body( expected_frames.len(), actual_frames.len(), "Frame count didn't match.\n\ - Expected: {:?}\n\ - Actual: {:?}", - expected_frames, - actual_frames + Expected: {expected_frames:?}\n\ + Actual: {actual_frames:?}", ); } diff --git a/rust-runtime/aws-smithy-fuzz/Cargo.toml b/rust-runtime/aws-smithy-fuzz/Cargo.toml index b6272008c22..77cb3a725d9 100644 --- a/rust-runtime/aws-smithy-fuzz/Cargo.toml +++ b/rust-runtime/aws-smithy-fuzz/Cargo.toml @@ -1,7 +1,7 @@ [workspace] [package] name = "aws-smithy-fuzz" -version = "0.1.1" +version = "0.1.2" authors = ["AWS Rust SDK Team "] description = "Fuzzing utilities for smithy-rs servers" edition = "2021" diff --git a/rust-runtime/aws-smithy-fuzz/src/lib.rs b/rust-runtime/aws-smithy-fuzz/src/lib.rs index d57a02d2e20..22a83dc1318 100644 --- a/rust-runtime/aws-smithy-fuzz/src/lib.rs +++ b/rust-runtime/aws-smithy-fuzz/src/lib.rs @@ -149,7 +149,7 @@ fn assert_ready_tokio(future: F) -> F::Output { } /// Polls a future and panics if it isn't already ready. -fn assert_ready(mut future: F) -> F::Output { +fn assert_ready(future: F) -> F::Output { // Create a waker that does nothing. let waker = noop_waker(); // Create a context from the waker. diff --git a/rust-runtime/aws-smithy-http-client/src/client/proxy.rs b/rust-runtime/aws-smithy-http-client/src/client/proxy.rs index f4d8f42b5ed..dfeaacfbd4e 100644 --- a/rust-runtime/aws-smithy-http-client/src/client/proxy.rs +++ b/rust-runtime/aws-smithy-http-client/src/client/proxy.rs @@ -97,7 +97,7 @@ impl From for ProxyError { impl fmt::Display for ProxyError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match &self.kind { - ErrorKind::InvalidUrl(url) => write!(f, "invalid proxy URL: {}", url), + ErrorKind::InvalidUrl(url) => write!(f, "invalid proxy URL: {url}"), } } } @@ -472,7 +472,7 @@ impl ProxyConfig { Some("http") | Some("https") => {} Some(scheme) => { return Err( - ErrorKind::InvalidUrl(format!("unsupported proxy scheme: {}", scheme)).into(), + ErrorKind::InvalidUrl(format!("unsupported proxy scheme: {scheme}")).into(), ); } None => { diff --git a/rust-runtime/aws-smithy-http-client/src/client/tls/rustls_provider.rs b/rust-runtime/aws-smithy-http-client/src/client/tls/rustls_provider.rs index e1b769c374d..c917c8c3c62 100644 --- a/rust-runtime/aws-smithy-http-client/src/client/tls/rustls_provider.rs +++ b/rust-runtime/aws-smithy-http-client/src/client/tls/rustls_provider.rs @@ -322,7 +322,7 @@ pub(crate) mod connect { let tunneled = tunnel .call(dst_clone.clone()) .await - .map_err(|e| BoxError::from(format!("CONNECT tunnel failed: {}", e)))?; + .map_err(|e| BoxError::from(format!("CONNECT tunnel failed: {e}")))?; // Stage 2: Manual TLS handshake over tunneled stream let host = dst_clone @@ -330,7 +330,7 @@ pub(crate) mod connect { .ok_or("missing host in URI for TLS handshake")?; let server_name = ServerName::try_from(host.to_owned()).map_err(|e| { - BoxError::from(format!("invalid server name for TLS handshake: {}", e)) + BoxError::from(format!("invalid server name for TLS handshake: {e}")) })?; let tls_connector = tokio_rustls::TlsConnector::from(tls_config) diff --git a/rust-runtime/aws-smithy-http-client/src/client/tls/s2n_tls_provider.rs b/rust-runtime/aws-smithy-http-client/src/client/tls/s2n_tls_provider.rs index 3515f15f44f..888221f0de7 100644 --- a/rust-runtime/aws-smithy-http-client/src/client/tls/s2n_tls_provider.rs +++ b/rust-runtime/aws-smithy-http-client/src/client/tls/s2n_tls_provider.rs @@ -222,7 +222,7 @@ pub(crate) mod connect { let tunneled = tunnel .call(dst_clone.clone()) .await - .map_err(|e| BoxError::from(format!("CONNECT tunnel failed: {}", e)))?; + .map_err(|e| BoxError::from(format!("CONNECT tunnel failed: {e}")))?; // Stage 2: Manual TLS handshake over tunneled stream let host = dst_clone @@ -234,7 +234,7 @@ pub(crate) mod connect { let tls_stream = tls_connector .connect(host, TokioIo::new(tunneled)) .await - .map_err(|e| BoxError::from(format!("s2n-tls handshake failed: {}", e)))?; + .map_err(|e| BoxError::from(format!("s2n-tls handshake failed: {e}")))?; Ok(Conn { inner: Box::new(S2nTlsConn { diff --git a/rust-runtime/aws-smithy-http-client/src/test_util/dvr/replay.rs b/rust-runtime/aws-smithy-http-client/src/test_util/dvr/replay.rs index 0bf866a33d9..d5f1f229427 100644 --- a/rust-runtime/aws-smithy-http-client/src/test_util/dvr/replay.rs +++ b/rust-runtime/aws-smithy-http-client/src/test_util/dvr/replay.rs @@ -161,8 +161,7 @@ impl ReplayingClient { let actual = actual_requests .remove(&conn_id) .ok_or(format!( - "expected connection {:?} but request was never sent", - conn_id + "expected connection {conn_id:?} but request was never sent" ))? .take() .await; diff --git a/rust-runtime/aws-smithy-http-client/src/test_util/wire.rs b/rust-runtime/aws-smithy-http-client/src/test_util/wire.rs index 03c53f9d215..8fc3172f403 100644 --- a/rust-runtime/aws-smithy-http-client/src/test_util/wire.rs +++ b/rust-runtime/aws-smithy-http-client/src/test_util/wire.rs @@ -81,19 +81,16 @@ pub fn check_matches(events: &[RecordedEvent], matchers: &[Matcher]) { loop { idx += 1; let bail = |err: Box| { - panic!( - "failed on event {}:\n {}\n actual recorded events: {:?}", - idx, err, events - ) + panic!("failed on event {idx}:\n {err}\n actual recorded events: {events:?}") }; match (events_iter.next(), matcher_iter.next()) { (Some(event), Some((matcher, _msg))) => matcher(event).unwrap_or_else(bail), (None, None) => return, (Some(event), None) => { - bail(format!("got {:?} but no more events were expected", event).into()) + bail(format!("got {event:?} but no more events were expected").into()) } (None, Some((_expect, msg))) => { - bail(format!("expected {:?} but no more events were expected", msg).into()) + bail(format!("expected {msg:?} but no more events were expected").into()) } } } @@ -270,7 +267,7 @@ impl WireMockServer { let next_event = events.clone().lock().unwrap().pop(); async move { let next_event = next_event - .unwrap_or_else(|| panic!("no more events! Log: {:?}", wire_log)); + .unwrap_or_else(|| panic!("no more events! Log: {wire_log:?}")); wire_log .lock() @@ -293,7 +290,7 @@ impl WireMockServer { let conn = conn_builder.serve_connection(io, svc); let fut = graceful.watch(conn); if let Err(e) = fut.await { - panic!("Error serving connection: {:?}", e); + panic!("Error serving connection: {e:?}"); } }); }, @@ -403,7 +400,7 @@ impl tower::Service for InnerDnsResolver { let socket_addr = self.socket_addr; let log = self.log.clone(); Box::pin(async move { - println!("looking up {:?}, replying with {:?}", req, socket_addr); + println!("looking up {req:?}, replying with {socket_addr:?}"); log.lock() .unwrap() .push(RecordedEvent::DnsLookup(req.to_string())); diff --git a/rust-runtime/aws-smithy-http-server-python/Cargo.toml b/rust-runtime/aws-smithy-http-server-python/Cargo.toml index f270bd24425..f7c526f2e02 100644 --- a/rust-runtime/aws-smithy-http-server-python/Cargo.toml +++ b/rust-runtime/aws-smithy-http-server-python/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-smithy-http-server-python" -version = "0.66.4" +version = "0.66.5" authors = ["Smithy Rust Server "] edition = "2021" license = "Apache-2.0" diff --git a/rust-runtime/aws-smithy-http-server-python/src/middleware/request.rs b/rust-runtime/aws-smithy-http-server-python/src/middleware/request.rs index 36be08e3f5f..8eeffbc8304 100644 --- a/rust-runtime/aws-smithy-http-server-python/src/middleware/request.rs +++ b/rust-runtime/aws-smithy-http-server-python/src/middleware/request.rs @@ -88,10 +88,7 @@ impl PyRequest { || Err(PyMiddlewareError::RequestGone.into()), |parts| { parts.uri = uri_str.parse().map_err(|e: http::uri::InvalidUri| { - PyValueError::new_err(format!( - "URI `{}` cannot be parsed. Error: {}", - uri_str, e - )) + PyValueError::new_err(format!("URI `{uri_str}` cannot be parsed. Error: {e}")) })?; Ok(()) }, diff --git a/rust-runtime/aws-smithy-http-server-python/src/socket.rs b/rust-runtime/aws-smithy-http-server-python/src/socket.rs index 5559e0ace9f..7c6aa02988a 100644 --- a/rust-runtime/aws-smithy-http-server-python/src/socket.rs +++ b/rust-runtime/aws-smithy-http-server-python/src/socket.rs @@ -40,7 +40,7 @@ impl PySocket { #[pyo3(text_signature = "($self, address, port, backlog=None)")] #[new] pub fn new(address: String, port: i32, backlog: Option) -> PyResult { - let address: SocketAddr = format!("{}:{}", address, port).parse()?; + let address: SocketAddr = format!("{address}:{port}").parse()?; let (domain, ip_version) = PySocket::socket_domain(address); tracing::trace!(address = %address, ip_version, "shared socket listening"); let socket = Socket::new(domain, Type::STREAM, Some(Protocol::TCP))?; 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 9e6dbed364a..053add39bfd 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 @@ -272,7 +272,7 @@ mod tests { }); let server = Server::builder(listener).serve(make_svc); if let Err(err) = server.await { - panic!("server error: {}", err); + panic!("server error: {err}"); } }); }); diff --git a/rust-runtime/aws-smithy-http-server/Cargo.toml b/rust-runtime/aws-smithy-http-server/Cargo.toml index f66359d789e..456fb88099c 100644 --- a/rust-runtime/aws-smithy-http-server/Cargo.toml +++ b/rust-runtime/aws-smithy-http-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-smithy-http-server" -version = "0.65.7" +version = "0.65.8" authors = ["Smithy Rust Server "] edition = "2021" license = "Apache-2.0" diff --git a/rust-runtime/aws-smithy-http-server/src/instrumentation/sensitivity/headers.rs b/rust-runtime/aws-smithy-http-server/src/instrumentation/sensitivity/headers.rs index 3dd5f5b5280..430081afb35 100644 --- a/rust-runtime/aws-smithy-http-server/src/instrumentation/sensitivity/headers.rs +++ b/rust-runtime/aws-smithy-http-server/src/instrumentation/sensitivity/headers.rs @@ -190,7 +190,7 @@ mod tests { let original: HeaderMap = to_header_map(HEADER_MAP); let output = SensitiveHeaders::new(&original, |_| HeaderMarker::default()); - assert_eq!(format!("{:?}", output), format!("{:?}", original)); + assert_eq!(format!("{output:?}"), format!("{:?}", original)); } #[cfg(not(feature = "unredacted-logging"))] @@ -212,7 +212,7 @@ mod tests { value: true, key_suffix: None, }); - assert_eq!(format!("{:?}", output), format!("{:?}", expected)); + assert_eq!(format!("{output:?}"), format!("{:?}", expected)); } #[cfg(not(feature = "unredacted-logging"))] @@ -234,7 +234,7 @@ mod tests { value: name == "name-a", key_suffix: None, }); - assert_eq!(format!("{:?}", output), format!("{:?}", expected)); + assert_eq!(format!("{output:?}"), format!("{:?}", expected)); } #[cfg(not(feature = "unredacted-logging"))] @@ -261,6 +261,6 @@ mod tests { None }, }); - assert_eq!(format!("{:?}", output), format!("{:?}", expected)); + assert_eq!(format!("{output:?}"), format!("{:?}", expected)); } } diff --git a/rust-runtime/aws-smithy-http-server/src/instrumentation/sensitivity/sensitive.rs b/rust-runtime/aws-smithy-http-server/src/instrumentation/sensitivity/sensitive.rs index d25e9a2c04b..e56a42f07d3 100644 --- a/rust-runtime/aws-smithy-http-server/src/instrumentation/sensitivity/sensitive.rs +++ b/rust-runtime/aws-smithy-http-server/src/instrumentation/sensitivity/sensitive.rs @@ -78,11 +78,11 @@ mod tests { fn debug() { let inner = "hello world"; let sensitive = Sensitive(inner); - let actual = format!("{:?}", sensitive); + let actual = format!("{sensitive:?}"); let expected = if cfg!(feature = "unredacted-logging") { - format!("{:?}", inner) + format!("{inner:?}") } else { - format!("{:?}", REDACTED) + format!("{REDACTED:?}") }; assert_eq!(actual, expected) } @@ -91,7 +91,7 @@ mod tests { fn display() { let inner = "hello world"; let sensitive = Sensitive(inner); - let actual = format!("{}", sensitive); + let actual = format!("{sensitive}"); let expected = if cfg!(feature = "unredacted-logging") { inner.to_string() } else { diff --git a/rust-runtime/aws-smithy-http-server/src/instrumentation/sensitivity/uri/label.rs b/rust-runtime/aws-smithy-http-server/src/instrumentation/sensitivity/uri/label.rs index 1bb88bcb4b3..c3b4a6f2672 100644 --- a/rust-runtime/aws-smithy-http-server/src/instrumentation/sensitivity/uri/label.rs +++ b/rust-runtime/aws-smithy-http-server/src/instrumentation/sensitivity/uri/label.rs @@ -101,7 +101,7 @@ where if (self.label_marker)(index) { write!(f, "/{}", Sensitive(segment))?; } else { - write!(f, "/{}", segment)?; + write!(f, "/{segment}")?; } // Add the segment length and the separator to the `greedy_start`. let greedy_start = greedy_start + segment.len() + 1; @@ -140,7 +140,7 @@ where if (self.label_marker)(index) { write!(f, "/{}", Sensitive(segment))?; } else { - write!(f, "/{}", segment)?; + write!(f, "/{segment}")?; } } } diff --git a/rust-runtime/aws-smithy-http-server/src/protocol/mod.rs b/rust-runtime/aws-smithy-http-server/src/protocol/mod.rs index 6d6bbf3b650..55800980a69 100644 --- a/rust-runtime/aws-smithy-http-server/src/protocol/mod.rs +++ b/rust-runtime/aws-smithy-http-server/src/protocol/mod.rs @@ -176,7 +176,7 @@ mod tests { assert_eq!(actually_expected_mime, expected_mime); assert_eq!(actually_found_mime, found_mime); } - _ => panic!("unexpected `MissingContentTypeReason`: {}", e), + _ => panic!("unexpected `MissingContentTypeReason`: {e}"), }, } } diff --git a/rust-runtime/aws-smithy-http-server/src/protocol/rpc_v2_cbor/router.rs b/rust-runtime/aws-smithy-http-server/src/protocol/rpc_v2_cbor/router.rs index 9a4ddb64eec..019bcda9127 100644 --- a/rust-runtime/aws-smithy-http-server/src/protocol/rpc_v2_cbor/router.rs +++ b/rust-runtime/aws-smithy-http-server/src/protocol/rpc_v2_cbor/router.rs @@ -85,8 +85,7 @@ impl RpcV2CborRouter { // segment. static PATH_REGEX: LazyLock = LazyLock::new(|| { Regex::new(&format!( - r#"/service/({}\.)*(?P{})/operation/(?P{})$"#, - IDENTIFIER_PATTERN, IDENTIFIER_PATTERN, IDENTIFIER_PATTERN, + r#"/service/({IDENTIFIER_PATTERN}\.)*(?P{IDENTIFIER_PATTERN})/operation/(?P{IDENTIFIER_PATTERN})$"#, )) .unwrap() }); @@ -268,7 +267,7 @@ mod tests { let valid_identifiers = vec!["a", "_a", "_0", "__0", "variable123", "_underscored_variable"]; for id in &valid_identifiers { - assert!(identifier_regex().is_match(id), "'{}' is incorrectly rejected", id); + assert!(identifier_regex().is_match(id), "'{id}' is incorrectly rejected"); } } @@ -285,7 +284,7 @@ mod tests { ]; for id in &invalid_identifiers { - assert!(!identifier_regex().is_match(id), "'{}' is incorrectly accepted", id); + assert!(!identifier_regex().is_match(id), "'{id}' is incorrectly accepted"); } } @@ -307,8 +306,8 @@ mod tests { "/service/namespace.Service/operation/Operation", ] { let captures = regex.captures(uri).unwrap(); - assert_eq!("Service", &captures["service"], "uri: {}", uri); - assert_eq!("Operation", &captures["operation"], "uri: {}", uri); + assert_eq!("Service", &captures["service"], "uri: {uri}"); + assert_eq!("Operation", &captures["operation"], "uri: {uri}"); } } @@ -328,7 +327,7 @@ mod tests { "/service/namespace-Service/operation/Operation", "/service/.Service/operation/Operation", ] { - assert!(regex.captures(uri).is_none(), "uri: {}", uri); + assert!(regex.captures(uri).is_none(), "uri: {uri}"); } } diff --git a/rust-runtime/aws-smithy-http-server/src/routing/request_spec.rs b/rust-runtime/aws-smithy-http-server/src/routing/request_spec.rs index 472f66873fe..bde01ddaa83 100644 --- a/rust-runtime/aws-smithy-http-server/src/routing/request_spec.rs +++ b/rust-runtime/aws-smithy-http-server/src/routing/request_spec.rs @@ -115,7 +115,7 @@ impl From<&PathSpec> for Regex { .fold(String::new(), |a, b| a + sep + &b) }; - Regex::new(&format!("^{}$", re)).expect("invalid `Regex` from `PathSpec`; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues") + Regex::new(&format!("^{re}$")).expect("invalid `Regex` from `PathSpec`; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues") } } diff --git a/rust-runtime/aws-smithy-http/src/endpoint.rs b/rust-runtime/aws-smithy-http/src/endpoint.rs index 3c5adc46426..37f97340c92 100644 --- a/rust-runtime/aws-smithy-http/src/endpoint.rs +++ b/rust-runtime/aws-smithy-http/src/endpoint.rs @@ -32,7 +32,7 @@ pub fn apply_endpoint( .map(|auth| auth.as_str()) .unwrap_or(""); let authority = if !prefix.is_empty() { - Cow::Owned(format!("{}{}", prefix, authority)) + Cow::Owned(format!("{prefix}{authority}")) } else { Cow::Borrowed(authority) }; @@ -66,6 +66,6 @@ fn merge_paths<'a>(endpoint: &'a http_1x::Uri, uri: &'a http_1x::Uri) -> Cow<'a, let uri_path_no_slash = uri_path_and_query .strip_prefix('/') .unwrap_or(uri_path_and_query); - Cow::Owned(format!("{}/{}", ep_no_slash, uri_path_no_slash)) + Cow::Owned(format!("{ep_no_slash}/{uri_path_no_slash}")) } } diff --git a/rust-runtime/aws-smithy-http/src/event_stream/receiver.rs b/rust-runtime/aws-smithy-http/src/event_stream/receiver.rs index e2b71faa8cb..733b8a6610b 100644 --- a/rust-runtime/aws-smithy-http/src/event_stream/receiver.rs +++ b/rust-runtime/aws-smithy-http/src/event_stream/receiver.rs @@ -456,7 +456,7 @@ mod tests { midpoint + b2 % midpoint, combined.len() ); - println!("[{}, {}], [{}, {}], [{}, {}]", start, boundary1, boundary1, boundary2, boundary2, end); + println!("[{start}, {boundary1}], [{boundary1}, {boundary2}], [{boundary2}, {end}]"); let rt = tokio::runtime::Runtime::new().unwrap(); rt.block_on(async move { diff --git a/rust-runtime/aws-smithy-http/src/header.rs b/rust-runtime/aws-smithy-http/src/header.rs index 4519bf490f8..10b063b03ba 100644 --- a/rust-runtime/aws-smithy-http/src/header.rs +++ b/rust-runtime/aws-smithy-http/src/header.rs @@ -64,7 +64,7 @@ pub fn many_dates<'a>( let mut header = header; while !header.is_empty() { let (v, next) = DateTime::read(header, format, ',').map_err(|err| { - ParseError::new(format!("header could not be parsed as date: {}", err)) + ParseError::new(format!("header could not be parsed as date: {err}")) })?; out.push(v); header = next; diff --git a/rust-runtime/aws-smithy-http/src/query_writer.rs b/rust-runtime/aws-smithy-http/src/query_writer.rs index 7694da6b02f..795f841204d 100644 --- a/rust-runtime/aws-smithy-http/src/query_writer.rs +++ b/rust-runtime/aws-smithy-http/src/query_writer.rs @@ -162,7 +162,7 @@ mod test { } if !problematic_chars.is_empty() { - panic!("we got some bad bytes here: {:#?}", problematic_chars) + panic!("we got some bad bytes here: {problematic_chars:#?}") } } diff --git a/rust-runtime/aws-smithy-json/Cargo.toml b/rust-runtime/aws-smithy-json/Cargo.toml index d92c98ca445..e311860a417 100644 --- a/rust-runtime/aws-smithy-json/Cargo.toml +++ b/rust-runtime/aws-smithy-json/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-smithy-json" -version = "0.61.6" +version = "0.61.7" authors = ["AWS Rust SDK Team ", "John DiSanti "] description = "Token streaming JSON parser for smithy-rs." edition = "2021" diff --git a/rust-runtime/aws-smithy-json/src/deserialize/error.rs b/rust-runtime/aws-smithy-json/src/deserialize/error.rs index 8ecacae82b0..21235788f62 100644 --- a/rust-runtime/aws-smithy-json/src/deserialize/error.rs +++ b/rust-runtime/aws-smithy-json/src/deserialize/error.rs @@ -93,7 +93,7 @@ impl fmt::Display for DeserializeError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use DeserializeErrorKind::*; if let Some(offset) = self.offset { - write!(f, "Error at offset {}: ", offset)?; + write!(f, "Error at offset {offset}: ")?; } match &self.kind { Custom { message, .. } => write!(f, "failed to parse JSON: {message}"), diff --git a/rust-runtime/aws-smithy-json/src/deserialize/token.rs b/rust-runtime/aws-smithy-json/src/deserialize/token.rs index b0855376627..2f54b8c42c8 100644 --- a/rust-runtime/aws-smithy-json/src/deserialize/token.rs +++ b/rust-runtime/aws-smithy-json/src/deserialize/token.rs @@ -176,8 +176,7 @@ pub fn expect_number_or_null( .map_err(|_| { Error::custom( format!( - "only `Infinity`, `-Infinity`, `NaN` can represent a float as a string but found `{}`", - v + "only `Infinity`, `-Infinity`, `NaN` can represent a float as a string but found `{v}`" )).with_offset(offset.0) }), }, @@ -405,7 +404,7 @@ pub mod test { let err = result.err().expect("expected error"); let (actual_message, actual_offset) = match &err.kind { ErrorKind::Custom { message, .. } => (message.as_ref(), err.offset), - _ => panic!("expected ErrorKind::Custom, got {:?}", err), + _ => panic!("expected ErrorKind::Custom, got {err:?}"), }; assert_eq!((message, offset), (actual_message, actual_offset)); } @@ -567,7 +566,7 @@ pub mod test { // ok } not_ok => { - panic!("expected nan, found: {:?}", not_ok) + panic!("expected nan, found: {not_ok:?}") } } } @@ -702,8 +701,8 @@ pub mod test { #[test] fn test_document_recursion_limit() { let mut value = String::new(); - value.extend(std::iter::repeat('[').take(300)); - value.extend(std::iter::repeat(']').take(300)); + value.extend(std::iter::repeat_n('[', 300)); + value.extend(std::iter::repeat_n(']', 300)); expect_err_custom( "exceeded max recursion depth while parsing document", None, @@ -711,9 +710,9 @@ pub mod test { ); value = String::new(); - value.extend(std::iter::repeat("{\"t\":").take(300)); + value.extend(std::iter::repeat_n("{\"t\":", 300)); value.push('1'); - value.extend(std::iter::repeat('}').take(300)); + value.extend(std::iter::repeat_n('}', 300)); expect_err_custom( "exceeded max recursion depth while parsing document", None, diff --git a/rust-runtime/aws-smithy-json/src/escape.rs b/rust-runtime/aws-smithy-json/src/escape.rs index d87e57c6daa..7327c92c8c9 100644 --- a/rust-runtime/aws-smithy-json/src/escape.rs +++ b/rust-runtime/aws-smithy-json/src/escape.rs @@ -31,15 +31,14 @@ impl fmt::Display for EscapeError { ExpectedSurrogatePair(low) => { write!( f, - "expected a UTF-16 surrogate pair, but got {} as the low word", - low + "expected a UTF-16 surrogate pair, but got {low} as the low word" ) } - InvalidEscapeCharacter(chr) => write!(f, "invalid JSON escape: \\{}", chr), + InvalidEscapeCharacter(chr) => write!(f, "invalid JSON escape: \\{chr}"), InvalidSurrogatePair(high, low) => { - write!(f, "invalid surrogate pair: \\u{:04X}\\u{:04X}", high, low) + write!(f, "invalid surrogate pair: \\u{high:04X}\\u{low:04X}") } - InvalidUnicodeEscape(escape) => write!(f, "invalid JSON Unicode escape: \\u{}", escape), + InvalidUnicodeEscape(escape) => write!(f, "invalid JSON Unicode escape: \\u{escape}"), InvalidUtf8 => write!(f, "invalid UTF-8 codepoint in JSON string"), UnexpectedEndOfString => write!(f, "unexpected end of string"), } @@ -79,7 +78,7 @@ fn escape_string_inner(start: &[u8], rest: &[u8]) -> String { b'\n' => escaped.extend(b"\\n"), b'\r' => escaped.extend(b"\\r"), b'\t' => escaped.extend(b"\\t"), - 0..=0x1F => escaped.extend(format!("\\u{:04x}", byte).bytes()), + 0..=0x1F => escaped.extend(format!("\\u{byte:04x}").bytes()), _ => escaped.push(*byte), } } @@ -320,7 +319,7 @@ mod test { let escaped = format!("\\u{:04X}\\u{:04X}", codepoints[0], codepoints[1]); let unescaped = unescape_string(&escaped).unwrap(); - let expected = format!("{}", chr); + let expected = format!("{chr}"); assert_eq!(expected, unescaped); } } diff --git a/rust-runtime/aws-smithy-mocks/src/interceptor.rs b/rust-runtime/aws-smithy-mocks/src/interceptor.rs index 14481195b8d..935020d32e3 100644 --- a/rust-runtime/aws-smithy-mocks/src/interceptor.rs +++ b/rust-runtime/aws-smithy-mocks/src/interceptor.rs @@ -125,10 +125,7 @@ impl Intercept for MockResponseInterceptor { // Check if the rule matches if !(rule.matcher)(input) { // Rule doesn't match, this is an error in sequential mode - panic!( - "In order matching was enforced but rule did not match {:?}", - input - ); + panic!("In order matching was enforced but rule did not match {input:?}"); } // Rule matches and is not exhausted, get the response @@ -171,14 +168,13 @@ impl Intercept for MockResponseInterceptor { // store the response on the interceptor (because going // through interceptor context requires the type to impl Clone) let mut active_resp = self.active_response.lock().unwrap(); - let _ = std::mem::replace(&mut *active_resp, Some(response)); + let _ = (*active_resp).replace(response); } _ => { // No matching rule or no response if self.must_match { panic!( - "must_match was enabled but no rules matched or all rules were exhausted for {:?}", - input + "must_match was enabled but no rules matched or all rules were exhausted for {input:?}" ); } } @@ -216,7 +212,7 @@ impl Intercept for MockResponseInterceptor { } _ => { // put it back for modeled output/errors - let _ = std::mem::replace(&mut *state, Some(resp)); + let _ = (*state).replace(resp); } } } @@ -734,7 +730,7 @@ mod tests { let op = operation.clone(); let handle = task::spawn(async move { let result = op - .invoke(TestInput::new(&format!("bucket-{}", i), "test-key")) + .invoke(TestInput::new(&format!("bucket-{i}"), "test-key")) .await; result.unwrap() }); @@ -816,7 +812,7 @@ mod tests { let result = operation .invoke(TestInput::new("test-bucket", "test-key")) .await; - assert!(result.is_ok(), "Call {} should succeed", i); + assert!(result.is_ok(), "Call {i} should succeed"); assert_eq!(result.unwrap(), TestOutput::new("simple response")); } assert_eq!(rule.num_calls(), 5); @@ -878,7 +874,7 @@ mod tests { let result = operation .invoke(TestInput::new("test-bucket", "test-key")) .await; - assert!(result.is_ok(), "Call {} should succeed", i); + assert!(result.is_ok(), "Call {i} should succeed"); assert_eq!(result.unwrap(), TestOutput::new("repeated response")); } assert_eq!(rule.num_calls(), 11); diff --git a/rust-runtime/aws-smithy-mocks/src/rule.rs b/rust-runtime/aws-smithy-mocks/src/rule.rs index c923668a02b..6d8c3f2c675 100644 --- a/rust-runtime/aws-smithy-mocks/src/rule.rs +++ b/rust-runtime/aws-smithy-mocks/src/rule.rs @@ -21,6 +21,7 @@ use std::sync::Arc; /// - `Http`: An HTTP response /// #[derive(Debug)] +#[allow(clippy::large_enum_variant)] pub(crate) enum MockResponse { /// A successful modeled response. Output(O), diff --git a/rust-runtime/aws-smithy-protocol-test/Cargo.toml b/rust-runtime/aws-smithy-protocol-test/Cargo.toml index 2edcdeef9d6..79d5d043aff 100644 --- a/rust-runtime/aws-smithy-protocol-test/Cargo.toml +++ b/rust-runtime/aws-smithy-protocol-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-smithy-protocol-test" -version = "0.63.5" +version = "0.63.6" authors = ["AWS Rust SDK Team ", "Russell Cohen "] description = "A collection of library functions to validate HTTP requests against Smithy protocol tests." edition = "2021" diff --git a/rust-runtime/aws-smithy-protocol-test/src/lib.rs b/rust-runtime/aws-smithy-protocol-test/src/lib.rs index aab0b5c554c..6f8dd135282 100644 --- a/rust-runtime/aws-smithy-protocol-test/src/lib.rs +++ b/rust-runtime/aws-smithy-protocol-test/src/lib.rs @@ -107,7 +107,7 @@ pub fn assert_ok(inp: Result<(), ProtocolTestFailure>) { match inp { Ok(_) => (), Err(e) => { - eprintln!("{}", e); + eprintln!("{e}"); panic!("Protocol test failed"); } } @@ -144,9 +144,7 @@ pub fn assert_uris_match(left: impl AsRef, right: impl AsRef) { assert_eq!( extract_params(left), extract_params(right), - "Query parameters did not match. left: {}, right: {}", - left, - right + "Query parameters did not match. left: {left}, right: {right}" ); let left: Uri = left.parse().expect("left is not a valid URI"); let right: Uri = right.parse().expect("left is not a valid URI"); @@ -283,7 +281,7 @@ pub fn forbid_headers( if let Some(value) = headers.get_header(key) { return Err(ProtocolTestFailure::ForbiddenHeader { forbidden: key.to_string(), - found: format!("{}: {}", key, value), + found: format!("{key}: {value}"), }); } } @@ -361,7 +359,7 @@ pub fn validate_body + Debug>( if actual_body != expected_body { Err(ProtocolTestFailure::BodyDidNotMatch { comparison: pretty_comparison(expected_body, actual_body), - hint: format!("media type: {}", media_type), + hint: format!("media type: {media_type}"), }) } else { Ok(()) @@ -493,7 +491,7 @@ fn get_text_key_value( ciborium::value::Value::Text(key_str) => Ok((key_str, value)), _ => Err(ProtocolTestFailure::InvalidBodyFormat { expected: "a text key as map entry".to_string(), - found: format!("{:?}", key), + found: format!("{key:?}"), }), } } @@ -510,7 +508,7 @@ fn try_cbor_eq + Debug>( let actual_cbor_value: ciborium::value::Value = ciborium::de::from_reader(actual_body.as_ref()) .map_err(|e| ProtocolTestFailure::InvalidBodyFormat { expected: "cbor".to_owned(), - found: format!("{} {:?}", e, actual_body), + found: format!("{e} {actual_body:?}"), })?; let actual_body_base64 = base64_simd::STANDARD.encode_to_string(&actual_body); @@ -536,21 +534,16 @@ fn try_cbor_eq + Debug>( // The last newline is important because the panic message ends with a `.` hint: format!( "expected body in diagnostic format: -{} +{expected_body_diag} actual body in diagnostic format: -{} +{actual_body_diag} expected body in annotated hex: -{} +{expected_body_annotated_hex} actual body in annotated hex: -{} +{actual_body_annotated_hex} actual body in base64 (useful to update the protocol test): -{} +{actual_body_base64} ", - expected_body_diag, - actual_body_diag, - expected_body_annotated_hex, - actual_body_annotated_hex, - actual_body_base64, ), }) } else { diff --git a/rust-runtime/aws-smithy-protocol-test/src/xml.rs b/rust-runtime/aws-smithy-protocol-test/src/xml.rs index 054bf4b7c15..e75d5e72efd 100644 --- a/rust-runtime/aws-smithy-protocol-test/src/xml.rs +++ b/rust-runtime/aws-smithy-protocol-test/src/xml.rs @@ -18,12 +18,12 @@ pub(crate) fn try_xml_equivalent(expected: &str, actual: &str) -> Result<(), Pro let norm_expected = normalize_xml(expected).map_err(|e| ProtocolTestFailure::InvalidBodyFormat { expected: "expected document to be valid XML".to_string(), - found: format!("{}", e), + found: format!("{e}"), })?; let norm_actual = normalize_xml(actual).map_err(|e| ProtocolTestFailure::InvalidBodyFormat { expected: "actual document to be valid XML".to_string(), - found: format!("{}\n{}", e, actual), + found: format!("{e}\n{actual}"), })?; if norm_expected == norm_actual { Ok(()) @@ -108,7 +108,7 @@ fn unparse_start_element(n: Node<'_, '_>) -> String { for ns in n.namespaces() { out.push_str(" xmlns"); if let Some(ns_name) = ns.name() { - write!(&mut out, ":{}", ns_name).unwrap(); + write!(&mut out, ":{ns_name}").unwrap(); } write!(&mut out, "={}", ns.uri()).unwrap(); } @@ -117,7 +117,7 @@ fn unparse_start_element(n: Node<'_, '_>) -> String { for attribute in attributes { write!(&mut out, " ").unwrap(); if let Some(ns) = attribute.namespace() { - write!(&mut out, "{}:", ns).unwrap(); + write!(&mut out, "{ns}:").unwrap(); } write!(&mut out, "{}=\"{}\"", attribute.name(), attribute.value()).unwrap(); } diff --git a/rust-runtime/aws-smithy-runtime-api/Cargo.toml b/rust-runtime/aws-smithy-runtime-api/Cargo.toml index 95c0194e916..e7e39bb63be 100644 --- a/rust-runtime/aws-smithy-runtime-api/Cargo.toml +++ b/rust-runtime/aws-smithy-runtime-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-smithy-runtime-api" -version = "1.9.1" +version = "1.9.2" authors = ["AWS Rust SDK Team ", "Zelda Hessler "] description = "Smithy runtime types." edition = "2021" diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/connector_metadata.rs b/rust-runtime/aws-smithy-runtime-api/src/client/connector_metadata.rs index b7c8e066b23..84188dada18 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/connector_metadata.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/connector_metadata.rs @@ -42,7 +42,7 @@ impl fmt::Display for ConnectorMetadata { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "http#{}", self.name)?; if let Some(version) = self.version.as_deref() { - write!(f, "-{}", version)?; + write!(f, "-{version}")?; } Ok(()) diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/interceptors/context.rs b/rust-runtime/aws-smithy-runtime-api/src/client/interceptors/context.rs index d88bc6e12fb..b82d74caa1c 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/interceptors/context.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/interceptors/context.rs @@ -32,8 +32,8 @@ use crate::client::result::SdkError; use aws_smithy_types::config_bag::ConfigBag; use aws_smithy_types::type_erasure::{TypeErasedBox, TypeErasedError}; use phase::Phase; +use std::fmt; use std::fmt::Debug; -use std::{fmt, mem}; use tracing::{debug, error, trace}; macro_rules! new_type_box { @@ -416,6 +416,7 @@ where /// Convert this context into the final operation result that is returned in client's the public API. /// /// Note: This method is intended for internal use only. + #[allow(clippy::result_large_err)] pub fn finalize(mut self) -> Result> { let output_or_error = self .output_or_error @@ -427,6 +428,7 @@ where /// Convert the given output/error into a final operation result that is returned in the client's public API. /// /// Note: This method is intended for internal use only. + #[allow(clippy::result_large_err)] pub fn finalize_result( &mut self, result: Result>, @@ -446,7 +448,7 @@ where self.phase ); } - if let Some(Err(existing_err)) = mem::replace(&mut self.output_or_error, Some(Err(error))) { + if let Some(Err(existing_err)) = self.output_or_error.replace(Err(error)) { error!("orchestrator context received an error but one was already present; Throwing away previous error: {:?}", existing_err); } } diff --git a/rust-runtime/aws-smithy-runtime-api/src/http/request.rs b/rust-runtime/aws-smithy-runtime-api/src/http/request.rs index 701abbfce34..6133d17cb9e 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/http/request.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/http/request.rs @@ -147,7 +147,7 @@ fn merge_paths( let uri_path_no_slash = uri_path_and_query .strip_prefix('/') .unwrap_or(uri_path_and_query); - Cow::Owned(format!("{}/{}", ep_no_slash, uri_path_no_slash)) + Cow::Owned(format!("{ep_no_slash}/{uri_path_no_slash}")) } } diff --git a/rust-runtime/aws-smithy-runtime/src/client/dns.rs b/rust-runtime/aws-smithy-runtime/src/client/dns.rs index 643b72f5e8a..9fce779ef41 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/dns.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/dns.rs @@ -8,7 +8,7 @@ #[cfg(all(feature = "rt-tokio", not(target_family = "wasm")))] mod tokio { use aws_smithy_runtime_api::client::dns::{DnsFuture, ResolveDns, ResolveDnsError}; - use std::io::{Error as IoError, ErrorKind as IoErrorKind}; + use std::io::Error as IoError; use std::net::ToSocketAddrs; /// DNS resolver that uses `tokio::spawn_blocking` to resolve DNS using the standard library. @@ -31,10 +31,7 @@ mod tokio { DnsFuture::new(async move { let result = tokio::task::spawn_blocking(move || (name, 0).to_socket_addrs()).await; match result { - Err(join_failure) => Err(ResolveDnsError::new(IoError::new( - IoErrorKind::Other, - join_failure, - ))), + Err(join_failure) => Err(ResolveDnsError::new(IoError::other(join_failure))), Ok(Ok(dns_result)) => { Ok(dns_result.into_iter().map(|addr| addr.ip()).collect()) } diff --git a/rust-runtime/aws-smithy-runtime/src/client/endpoint.rs b/rust-runtime/aws-smithy-runtime/src/client/endpoint.rs index 4fb90bc9ad5..634d3773e9a 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/endpoint.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/endpoint.rs @@ -29,7 +29,7 @@ pub fn apply_endpoint( .map(|auth| auth.as_str()) .unwrap_or(""); let authority = if !prefix.is_empty() { - Cow::Owned(format!("{}{}", prefix, authority)) + Cow::Owned(format!("{prefix}{authority}")) } else { Cow::Borrowed(authority) }; @@ -63,6 +63,6 @@ fn merge_paths<'a>(endpoint: &'a http_02x::Uri, uri: &'a http_02x::Uri) -> Cow<' let uri_path_no_slash = uri_path_and_query .strip_prefix('/') .unwrap_or(uri_path_and_query); - Cow::Owned(format!("{}/{}", ep_no_slash, uri_path_no_slash)) + Cow::Owned(format!("{ep_no_slash}/{uri_path_no_slash}")) } } diff --git a/rust-runtime/aws-smithy-runtime/src/client/orchestrator/auth.rs b/rust-runtime/aws-smithy-runtime/src/client/orchestrator/auth.rs index 39d66eeea6f..2b4ced7f656 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/orchestrator/auth.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/orchestrator/auth.rs @@ -107,7 +107,7 @@ impl fmt::Display for AuthOrchestrationError { Self::MissingEndpointConfig => f.write_str("missing endpoint config"), Self::BadAuthSchemeEndpointConfig(message) => f.write_str(message), Self::FailedToResolveEndpoint(source) => { - write!(f, "failed to resolve endpoint: {}", source) + write!(f, "failed to resolve endpoint: {source}") } } } diff --git a/rust-runtime/aws-smithy-runtime/src/client/orchestrator/endpoints.rs b/rust-runtime/aws-smithy-runtime/src/client/orchestrator/endpoints.rs index f8df38617e4..48d308eb32b 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/orchestrator/endpoints.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/orchestrator/endpoints.rs @@ -135,8 +135,7 @@ fn apply_endpoint_to_request( .set_endpoint(&endpoint_url) .map_err(|err| { ResolveEndpointError::message(format!( - "failed to apply endpoint `{}` to request `{:?}`", - endpoint_url, request, + "failed to apply endpoint `{endpoint_url}` to request `{request:?}`", )) .with_source(Some(err.into())) })?; diff --git a/rust-runtime/aws-smithy-runtime/src/client/timeout.rs b/rust-runtime/aws-smithy-runtime/src/client/timeout.rs index 14e3fa91898..98c2fd0baed 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/timeout.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/timeout.rs @@ -238,7 +238,7 @@ mod tests { let result = underlying_future.maybe_timeout(maybe_timeout).await; let err = result.expect_err("should have timed out"); - assert_eq!(format!("{:?}", err), "TimeoutError(TimeoutError { source: MaybeTimeoutError { kind: Operation, duration: 250ms } })"); + assert_eq!(format!("{err:?}"), "TimeoutError(TimeoutError { source: MaybeTimeoutError { kind: Operation, duration: 250ms } })"); assert_elapsed!(now, Duration::from_secs_f32(0.25)); } } diff --git a/rust-runtime/aws-smithy-types/Cargo.toml b/rust-runtime/aws-smithy-types/Cargo.toml index f2818d129ba..5625b1882b8 100644 --- a/rust-runtime/aws-smithy-types/Cargo.toml +++ b/rust-runtime/aws-smithy-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-smithy-types" -version = "1.3.3" +version = "1.3.4" authors = [ "AWS Rust SDK Team ", "Russell Cohen ", diff --git a/rust-runtime/aws-smithy-types/benches/base64.rs b/rust-runtime/aws-smithy-types/benches/base64.rs index 0539c190ff2..43648f388ad 100644 --- a/rust-runtime/aws-smithy-types/benches/base64.rs +++ b/rust-runtime/aws-smithy-types/benches/base64.rs @@ -123,7 +123,7 @@ mod handrolled_base64 { fn encode_inner(inp: &[u8]) -> String { // Base 64 encodes groups of 6 bits into characters—this means that each // 3 byte group (24 bits) is encoded into 4 base64 characters. - let char_ct = ((inp.len() + 2) / 3) * 4; + let char_ct = inp.len().div_ceil(3) * 4; let mut output = String::with_capacity(char_ct); for chunk in inp.chunks(3) { let mut block: i32 = 0; @@ -131,7 +131,7 @@ mod handrolled_base64 { for (idx, chunk) in chunk.iter().enumerate() { block |= (*chunk as i32) << ((3 - idx) * 8); } - let num_sextets = ((chunk.len() * 8) + 5) / 6; + let num_sextets = (chunk.len() * 8).div_ceil(6); for idx in 0..num_sextets { let slice = block >> (26 - (6 * idx)); let idx = (slice as u8) & 0b0011_1111; @@ -187,7 +187,7 @@ mod handrolled_base64 { // when there's padding, we might slightly over allocate but it significantly simplifies // the code to just ignore it. - let mut ret = Vec::with_capacity((inp.len() + 3) / 4 * 3); + let mut ret = Vec::with_capacity(inp.len().div_ceil(4) * 3); // 4 base-64 characters = 3 bytes // 1. Break the input into 4 character segments @@ -227,6 +227,6 @@ mod handrolled_base64 { /// Given the length of some data in bytes, return how many bytes it would take to base64 encode /// that data. pub fn encoded_length(length: u64) -> u64 { - (length + 2) / 3 * 4 + length.div_ceil(3) * 4 } } diff --git a/rust-runtime/aws-smithy-types/src/body.rs b/rust-runtime/aws-smithy-types/src/body.rs index f4e4285a8c8..e55fcd2bd7e 100644 --- a/rust-runtime/aws-smithy-types/src/body.rs +++ b/rust-runtime/aws-smithy-types/src/body.rs @@ -402,7 +402,7 @@ mod test { #[test] fn sdkbody_debug_once() { let body = SdkBody::from("123"); - assert!(format!("{:?}", body).contains("Once")); + assert!(format!("{body:?}").contains("Once")); } #[test] diff --git a/rust-runtime/aws-smithy-types/src/body/http_body_0_4_x.rs b/rust-runtime/aws-smithy-types/src/body/http_body_0_4_x.rs index 54def0c27d4..bd867dfd534 100644 --- a/rust-runtime/aws-smithy-types/src/body/http_body_0_4_x.rs +++ b/rust-runtime/aws-smithy-types/src/body/http_body_0_4_x.rs @@ -81,6 +81,6 @@ mod tests { fn sdkbody_debug_dyn() { let hyper_body = hyper_0_14::Body::channel().1; let body = SdkBody::from_body_0_4(hyper_body); - assert!(format!("{:?}", body).contains("BoxBody")); + assert!(format!("{body:?}").contains("BoxBody")); } } diff --git a/rust-runtime/aws-smithy-types/src/body/http_body_1_x.rs b/rust-runtime/aws-smithy-types/src/body/http_body_1_x.rs index 2f777f4207e..7e9d8ee6c33 100644 --- a/rust-runtime/aws-smithy-types/src/body/http_body_1_x.rs +++ b/rust-runtime/aws-smithy-types/src/body/http_body_1_x.rs @@ -376,6 +376,6 @@ mod test { .into(), }; let body = SdkBody::from_body_1_x(body); - assert!(format!("{:?}", body).contains("BoxBody")); + assert!(format!("{body:?}").contains("BoxBody")); } } diff --git a/rust-runtime/aws-smithy-types/src/byte_stream/bytestream_util/http_body_0_4_x.rs b/rust-runtime/aws-smithy-types/src/byte_stream/bytestream_util/http_body_0_4_x.rs index 76488b35003..2b6515b6652 100644 --- a/rust-runtime/aws-smithy-types/src/byte_stream/bytestream_util/http_body_0_4_x.rs +++ b/rust-runtime/aws-smithy-types/src/byte_stream/bytestream_util/http_body_0_4_x.rs @@ -99,7 +99,7 @@ mod test { let mut file = NamedTempFile::new().unwrap(); for i in 0..10000 { - writeln!(file, "Brian was here. Briefly. {}", i).unwrap(); + writeln!(file, "Brian was here. Briefly. {i}").unwrap(); } let file_length = file .as_file() @@ -187,8 +187,8 @@ mod test { let line_0 = "Line 0\n"; let line_1 = "Line 1\n"; - write!(file, "{}", line_0).unwrap(); - write!(file, "{}", line_1).unwrap(); + write!(file, "{line_0}").unwrap(); + write!(file, "{line_1}").unwrap(); // Ensure that the file was written to file.flush().expect("flushing is OK"); @@ -212,7 +212,7 @@ mod test { let mut file = NamedTempFile::new().unwrap(); let test_sentence = "This sentence is 30 bytes long"; assert_eq!(test_sentence.len(), 30); - write!(file, "{}", test_sentence).unwrap(); + write!(file, "{test_sentence}").unwrap(); // Ensure that the file was written to file.flush().expect("flushing is OK"); @@ -248,8 +248,8 @@ mod test { let line_0 = "Line 0\n"; let line_1 = "Line 1\n"; - write!(file, "{}", line_0).unwrap(); - write!(file, "{}", line_1).unwrap(); + write!(file, "{line_0}").unwrap(); + write!(file, "{line_1}").unwrap(); // Ensure that the file was written to file.flush().expect("flushing is OK"); @@ -275,9 +275,9 @@ mod test { let line_1 = "Line 1\n"; let line_2 = "Line 2\n"; - write!(file, "{}", line_0).unwrap(); - write!(file, "{}", line_1).unwrap(); - write!(file, "{}", line_2).unwrap(); + write!(file, "{line_0}").unwrap(); + write!(file, "{line_1}").unwrap(); + write!(file, "{line_2}").unwrap(); // Ensure that the file was written to file.flush().expect("flushing is OK"); @@ -304,8 +304,8 @@ mod test { let line_0 = "Line 0\n"; let line_1 = "Line 1\n"; - write!(file, "{}", line_0).unwrap(); - write!(file, "{}", line_1).unwrap(); + write!(file, "{line_0}").unwrap(); + write!(file, "{line_1}").unwrap(); // Ensure that the file was written to file.flush().expect("flushing is OK"); @@ -330,8 +330,8 @@ mod test { let line_0 = "Line 0\n"; let line_1 = "Line 1\n"; - write!(file, "{}", line_0).unwrap(); - write!(file, "{}", line_1).unwrap(); + write!(file, "{line_0}").unwrap(); + write!(file, "{line_1}").unwrap(); // Ensure that the file was written to file.flush().expect("flushing is OK"); @@ -346,7 +346,7 @@ mod test { let data = body.collect().await.unwrap().into_bytes(); let data_str = String::from_utf8(data.to_vec()).unwrap(); - assert_eq!(data_str, format!("{}{}", line_0, line_1)); + assert_eq!(data_str, format!("{line_0}{line_1}")); } #[tokio::test] @@ -357,14 +357,14 @@ mod test { { use std::io::Write; for i in 0..1000 { - writeln!(file, "Line {:04}", i).unwrap(); + writeln!(file, "Line {i:04}").unwrap(); } } { use std::fmt::Write; for i in 0..1000 { - writeln!(in_memory_copy_of_file_contents, "Line {:04}", i).unwrap(); + writeln!(in_memory_copy_of_file_contents, "Line {i:04}").unwrap(); } // Check we wrote the lines assert!(!in_memory_copy_of_file_contents.is_empty()); diff --git a/rust-runtime/aws-smithy-types/src/byte_stream/bytestream_util/http_body_1_x.rs b/rust-runtime/aws-smithy-types/src/byte_stream/bytestream_util/http_body_1_x.rs index a6f7be4dc23..ae8f13da055 100644 --- a/rust-runtime/aws-smithy-types/src/byte_stream/bytestream_util/http_body_1_x.rs +++ b/rust-runtime/aws-smithy-types/src/byte_stream/bytestream_util/http_body_1_x.rs @@ -92,7 +92,7 @@ mod test { let mut file = NamedTempFile::new().unwrap(); for i in 0..10000 { - writeln!(file, "Brian was here. Briefly. {}", i).unwrap(); + writeln!(file, "Brian was here. Briefly. {i}").unwrap(); } let file_length = file .as_file() @@ -178,8 +178,8 @@ mod test { let line_0 = "Line 0\n"; let line_1 = "Line 1\n"; - write!(file, "{}", line_0).unwrap(); - write!(file, "{}", line_1).unwrap(); + write!(file, "{line_0}").unwrap(); + write!(file, "{line_1}").unwrap(); // Ensure that the file was written to file.flush().expect("flushing is OK"); @@ -203,7 +203,7 @@ mod test { let mut file = NamedTempFile::new().unwrap(); let test_sentence = "This sentence is 30 bytes long"; assert_eq!(test_sentence.len(), 30); - write!(file, "{}", test_sentence).unwrap(); + write!(file, "{test_sentence}").unwrap(); // Ensure that the file was written to file.flush().expect("flushing is OK"); @@ -239,8 +239,8 @@ mod test { let line_0 = "Line 0\n"; let line_1 = "Line 1\n"; - write!(file, "{}", line_0).unwrap(); - write!(file, "{}", line_1).unwrap(); + write!(file, "{line_0}").unwrap(); + write!(file, "{line_1}").unwrap(); // Ensure that the file was written to file.flush().expect("flushing is OK"); @@ -266,9 +266,9 @@ mod test { let line_1 = "Line 1\n"; let line_2 = "Line 2\n"; - write!(file, "{}", line_0).unwrap(); - write!(file, "{}", line_1).unwrap(); - write!(file, "{}", line_2).unwrap(); + write!(file, "{line_0}").unwrap(); + write!(file, "{line_1}").unwrap(); + write!(file, "{line_2}").unwrap(); // Ensure that the file was written to file.flush().expect("flushing is OK"); @@ -295,8 +295,8 @@ mod test { let line_0 = "Line 0\n"; let line_1 = "Line 1\n"; - write!(file, "{}", line_0).unwrap(); - write!(file, "{}", line_1).unwrap(); + write!(file, "{line_0}").unwrap(); + write!(file, "{line_1}").unwrap(); // Ensure that the file was written to file.flush().expect("flushing is OK"); @@ -321,8 +321,8 @@ mod test { let line_0 = "Line 0\n"; let line_1 = "Line 1\n"; - write!(file, "{}", line_0).unwrap(); - write!(file, "{}", line_1).unwrap(); + write!(file, "{line_0}").unwrap(); + write!(file, "{line_1}").unwrap(); // Ensure that the file was written to file.flush().expect("flushing is OK"); @@ -337,7 +337,7 @@ mod test { let data = body.collect().await.unwrap().into_bytes(); let data_str = String::from_utf8(data.to_vec()).unwrap(); - assert_eq!(data_str, format!("{}{}", line_0, line_1)); + assert_eq!(data_str, format!("{line_0}{line_1}")); } #[tokio::test] @@ -348,14 +348,14 @@ mod test { { use std::io::Write; for i in 0..1000 { - writeln!(file, "Line {:04}", i).unwrap(); + writeln!(file, "Line {i:04}").unwrap(); } } { use std::fmt::Write; for i in 0..1000 { - writeln!(in_memory_copy_of_file_contents, "Line {:04}", i).unwrap(); + writeln!(in_memory_copy_of_file_contents, "Line {i:04}").unwrap(); } // Check we wrote the lines assert!(!in_memory_copy_of_file_contents.is_empty()); diff --git a/rust-runtime/aws-smithy-types/src/byte_stream/error.rs b/rust-runtime/aws-smithy-types/src/byte_stream/error.rs index b0e29af6e6a..2ba18ed0033 100644 --- a/rust-runtime/aws-smithy-types/src/byte_stream/error.rs +++ b/rust-runtime/aws-smithy-types/src/byte_stream/error.rs @@ -7,7 +7,7 @@ use std::error::Error as StdError; use std::fmt; -use std::io::{Error as IoError, ErrorKind as IoErrorKind}; +use std::io::Error as IoError; #[derive(Debug)] pub(super) enum ErrorKind { @@ -76,6 +76,6 @@ impl StdError for Error { impl From for IoError { fn from(err: Error) -> Self { - IoError::new(IoErrorKind::Other, err) + IoError::other(err) } } diff --git a/rust-runtime/aws-smithy-types/src/byte_stream/http_body_0_4_x.rs b/rust-runtime/aws-smithy-types/src/byte_stream/http_body_0_4_x.rs index fabe4737e0f..93bc3b73eb2 100644 --- a/rust-runtime/aws-smithy-types/src/byte_stream/http_body_0_4_x.rs +++ b/rust-runtime/aws-smithy-types/src/byte_stream/http_body_0_4_x.rs @@ -59,7 +59,7 @@ mod tests { let mut file = NamedTempFile::new()?; for i in 0..10000 { - writeln!(file, "Brian was here. Briefly. {}", i)?; + writeln!(file, "Brian was here. Briefly. {i}")?; } let body = ByteStream::from_path(&file).await?.into_inner(); // assert that a valid size hint is immediately ready diff --git a/rust-runtime/aws-smithy-types/src/config_bag.rs b/rust-runtime/aws-smithy-types/src/config_bag.rs index 5b8c82132c6..cd8f08c94d8 100644 --- a/rust-runtime/aws-smithy-types/src/config_bag.rs +++ b/rust-runtime/aws-smithy-types/src/config_bag.rs @@ -833,7 +833,7 @@ mod test { assert!(final_bag.load::().is_some()); // we unset prop3 assert!(final_bag.load::().is_none()); - println!("{:#?}", final_bag); + println!("{final_bag:#?}"); } #[test] @@ -916,7 +916,7 @@ mod test { let mut expected = vec![]; let mut bag = ConfigBag::base(); for layer_idx in 0..100 { - let mut layer = Layer::new(format!("{}", layer_idx)); + let mut layer = Layer::new(format!("{layer_idx}")); for item in 0..100 { expected.push(TestItem(layer_idx, item)); layer.store_append(TestItem(layer_idx, item)); diff --git a/rust-runtime/aws-smithy-types/src/date_time/format.rs b/rust-runtime/aws-smithy-types/src/date_time/format.rs index 33e27f53691..011d81d2e7e 100644 --- a/rust-runtime/aws-smithy-types/src/date_time/format.rs +++ b/rust-runtime/aws-smithy-types/src/date_time/format.rs @@ -29,7 +29,7 @@ impl fmt::Display for DateTimeParseError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { use DateTimeParseErrorKind::*; match &self.kind { - Invalid(msg) => write!(f, "invalid date-time: {}", msg), + Invalid(msg) => write!(f, "invalid date-time: {msg}"), IntParseError => write!(f, "failed to parse int"), } } @@ -60,8 +60,7 @@ impl fmt::Display for DateTimeFormatError { match &self.kind { DateTimeFormatErrorKind::OutOfRange(msg) => write!( f, - "date-time cannot be formatted since it is out of range: {}", - msg + "date-time cannot be formatted since it is out of range: {msg}" ), } } @@ -154,8 +153,7 @@ pub(crate) mod http_date { DateTimeFormatErrorKind::OutOfRange( format!( "HTTP dates support dates between Mon, 01 Jan 0001 00:00:00 GMT \ - and Fri, 31 Dec 9999 23:59:59.999 GMT. {}", - cause + and Fri, 31 Dec 9999 23:59:59.999 GMT. {cause}" ) .into(), ) @@ -324,7 +322,7 @@ pub(crate) mod http_date { let seconds = parse_slice(&s[23..25])?; let time = Time::from_hms_nano(hours, minutes, seconds, nanos).map_err(|err| { DateTimeParseErrorKind::Invalid( - format!("time components are out of range: {}", err).into(), + format!("time components are out of range: {err}").into(), ) })?; @@ -356,7 +354,7 @@ pub(crate) mod http_date { let day = parse_slice(&s[5..7])?; let date = Date::from_calendar_date(year, month, day).map_err(|err| { DateTimeParseErrorKind::Invalid( - format!("date components are out of range: {}", err).into(), + format!("date components are out of range: {err}").into(), ) })?; let date_time = PrimitiveDateTime::new(date, time).assume_offset(UtcOffset::UTC); @@ -414,7 +412,7 @@ pub(crate) mod rfc3339 { .into()); } let date_time = OffsetDateTime::parse(s, &Rfc3339).map_err(|err| { - DateTimeParseErrorKind::Invalid(format!("invalid RFC-3339 date-time: {}", err).into()) + DateTimeParseErrorKind::Invalid(format!("invalid RFC-3339 date-time: {err}").into()) })?; Ok(DateTime::from_nanos(date_time.unix_timestamp_nanos()) .expect("this date format cannot produce out of range date-times")) @@ -437,8 +435,7 @@ pub(crate) mod rfc3339 { DateTimeFormatErrorKind::OutOfRange( format!( "RFC-3339 timestamps support dates between 0001-01-01T00:00:00.000Z \ - and 9999-12-31T23:59:59.999Z. {}", - cause + and 9999-12-31T23:59:59.999Z. {cause}" ) .into(), ) @@ -467,8 +464,7 @@ pub(crate) mod rfc3339 { let mut out = String::with_capacity(33); write!( out, - "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}", - year, month, day, hour, minute, second + "{year:04}-{month:02}-{day:02}T{hour:02}:{minute:02}:{second:02}" ) .unwrap(); format_subsecond_fraction(&mut out, micros); @@ -551,7 +547,7 @@ mod tests { for test_case in test_cases { if let Some(expected) = test_case.smithy_format_value.as_ref() { let actual = format(&test_case.time()).expect("failed to format"); - assert_eq!(expected, &actual, "Additional context:\n{:#?}", test_case); + assert_eq!(expected, &actual, "Additional context:\n{test_case:#?}"); } else { format(&test_case.time()).expect_err("date should fail to format"); } @@ -580,8 +576,7 @@ mod tests { assert_eq!( expected, actual.unwrap(), - "Additional context:\n{:#?}", - test_case + "Additional context:\n{test_case:#?}" ); } } @@ -757,7 +752,7 @@ mod tests { let parsed = http_date::parse(&formatted); let read = http_date::read(&formatted); match parsed { - Err(failure) => panic!("Date failed to parse {:?}", failure), + Err(failure) => panic!("Date failed to parse {failure:?}"), Ok(date) => { assert!(read.is_ok()); if date.subsecond_nanos != subsecond_nanos { diff --git a/rust-runtime/aws-smithy-types/src/date_time/mod.rs b/rust-runtime/aws-smithy-types/src/date_time/mod.rs index 22fafdc2c18..c0db26ff114 100644 --- a/rust-runtime/aws-smithy-types/src/date_time/mod.rs +++ b/rust-runtime/aws-smithy-types/src/date_time/mod.rs @@ -134,7 +134,7 @@ impl DateTime { /// ``` pub fn from_secs_and_nanos(seconds: i64, subsecond_nanos: u32) -> Self { if subsecond_nanos >= 1_000_000_000 { - panic!("{} is > 1_000_000_000", subsecond_nanos) + panic!("{subsecond_nanos} is > 1_000_000_000") } DateTime { seconds, @@ -345,7 +345,7 @@ impl Display for DateTime { Ok(date) => date, Err(_err) => format::epoch_seconds::format(self), }; - write!(f, "{}", date) + write!(f, "{date}") } } @@ -399,31 +399,31 @@ mod test { #[test] fn test_display_date_time() { let date_time = DateTime::from_secs(1576540098); - assert_eq!(format!("{}", date_time), "2019-12-16T23:48:18Z"); + assert_eq!(format!("{date_time}"), "2019-12-16T23:48:18Z"); let date_time = DateTime::from_fractional_secs(1576540098, 0.52); - assert_eq!(format!("{}", date_time), "2019-12-16T23:48:18.52Z"); + assert_eq!(format!("{date_time}"), "2019-12-16T23:48:18.52Z"); let date_time = DateTime::from_secs(1699942527); - assert_eq!(format!("{}", date_time), "2023-11-14T06:15:27Z"); + assert_eq!(format!("{date_time}"), "2023-11-14T06:15:27Z"); let date_time = DateTime::from_secs(16995123); - assert_eq!(format!("{}", date_time), "1970-07-16T16:52:03Z"); + assert_eq!(format!("{date_time}"), "1970-07-16T16:52:03Z"); } #[test] fn test_debug_date_time() { let date_time = DateTime::from_secs(1576540098); - assert_eq!(format!("{:?}", date_time), "2019-12-16T23:48:18Z"); + assert_eq!(format!("{date_time:?}"), "2019-12-16T23:48:18Z"); let date_time = DateTime::from_fractional_secs(1576540098, 0.52); - assert_eq!(format!("{:?}", date_time), "2019-12-16T23:48:18.52Z"); + assert_eq!(format!("{date_time:?}"), "2019-12-16T23:48:18.52Z"); let date_time = DateTime::from_secs(1699942527); - assert_eq!(format!("{:?}", date_time), "2023-11-14T06:15:27Z"); + assert_eq!(format!("{date_time:?}"), "2023-11-14T06:15:27Z"); let date_time = DateTime::from_secs(16995123); - assert_eq!(format!("{:?}", date_time), "1970-07-16T16:52:03Z"); + assert_eq!(format!("{date_time:?}"), "1970-07-16T16:52:03Z"); } #[test] @@ -541,7 +541,7 @@ mod test { #[test] fn to_millis() { for test_case in EPOCH_MILLIS_TEST_CASES { - println!("Test case: {:?}", test_case); + println!("Test case: {test_case:?}"); let date_time = DateTime::from_secs_and_nanos( test_case.epoch_seconds, test_case.epoch_subsec_nanos, @@ -559,7 +559,7 @@ mod test { #[test] fn from_millis() { for test_case in EPOCH_MILLIS_TEST_CASES { - println!("Test case: {:?}", test_case); + println!("Test case: {test_case:?}"); let date_time = DateTime::from_millis(test_case.epoch_millis); assert_eq!(test_case.epoch_seconds, date_time.secs()); assert_eq!(test_case.epoch_subsec_nanos, date_time.subsec_nanos()); @@ -644,7 +644,7 @@ mod test { fn formatting_of_early_dates() { let date: DateTime = DateTime::from_str("Mon, 16 Dec -019 23:48:18 GMT", Format::HttpDate).unwrap(); - assert_eq!(format!("{}", date), "-62736509502"); + assert_eq!(format!("{date}"), "-62736509502"); } #[test] diff --git a/rust-runtime/aws-smithy-types/src/error/display.rs b/rust-runtime/aws-smithy-types/src/error/display.rs index f82d3baeaf5..db6b3182b75 100644 --- a/rust-runtime/aws-smithy-types/src/error/display.rs +++ b/rust-runtime/aws-smithy-types/src/error/display.rs @@ -39,7 +39,7 @@ impl fmt::Display for DisplayErrorContext { } fn write_err(f: &mut fmt::Formatter<'_>, err: &dyn Error) -> fmt::Result { - write!(f, "{}", err)?; + write!(f, "{err}")?; if let Some(source) = err.source() { write!(f, ": ")?; write_err(f, source)?; diff --git a/rust-runtime/aws-smithy-types/src/primitive.rs b/rust-runtime/aws-smithy-types/src/primitive.rs index 91e4d8e153f..74a3f962b7d 100644 --- a/rust-runtime/aws-smithy-types/src/primitive.rs +++ b/rust-runtime/aws-smithy-types/src/primitive.rs @@ -117,14 +117,14 @@ enum Inner { impl fmt::Debug for Inner { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - Self::Bool(v) => write!(f, "Bool({})", v), - Self::I8(v, _) => write!(f, "I8({})", v), - Self::I16(v, _) => write!(f, "I16({})", v), - Self::I32(v, _) => write!(f, "I32({})", v), - Self::I64(v, _) => write!(f, "I64({})", v), - Self::U64(v, _) => write!(f, "U64({})", v), - Self::F32(v, _) => write!(f, "F32({})", v), - Self::F64(v, _) => write!(f, "F64({})", v), + Self::Bool(v) => write!(f, "Bool({v})"), + Self::I8(v, _) => write!(f, "I8({v})"), + Self::I16(v, _) => write!(f, "I16({v})"), + Self::I32(v, _) => write!(f, "I32({v})"), + Self::I64(v, _) => write!(f, "I64({v})"), + Self::U64(v, _) => write!(f, "U64({v})"), + Self::F32(v, _) => write!(f, "F32({v})"), + Self::F64(v, _) => write!(f, "F64({v})"), } } } diff --git a/rust-runtime/aws-smithy-xml/Cargo.toml b/rust-runtime/aws-smithy-xml/Cargo.toml index 2ddb5bb1f99..64263d44ce8 100644 --- a/rust-runtime/aws-smithy-xml/Cargo.toml +++ b/rust-runtime/aws-smithy-xml/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aws-smithy-xml" -version = "0.60.11" +version = "0.60.12" authors = ["AWS Rust SDK Team ", "Russell Cohen "] description = "XML parsing logic for Smithy protocols." edition = "2021" diff --git a/rust-runtime/aws-smithy-xml/src/decode.rs b/rust-runtime/aws-smithy-xml/src/decode.rs index 7bf5c430008..14537470bdc 100644 --- a/rust-runtime/aws-smithy-xml/src/decode.rs +++ b/rust-runtime/aws-smithy-xml/src/decode.rs @@ -31,8 +31,8 @@ impl Display for XmlDecodeError { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match &self.kind { XmlDecodeErrorKind::InvalidXml(_) => write!(f, "XML parse error"), - XmlDecodeErrorKind::InvalidEscape { esc } => write!(f, "invalid XML escape: {}", esc), - XmlDecodeErrorKind::Custom(msg) => write!(f, "error parsing XML: {}", msg), + XmlDecodeErrorKind::InvalidEscape { esc } => write!(f, "invalid XML escape: {esc}"), + XmlDecodeErrorKind::Custom(msg) => write!(f, "error parsing XML: {msg}"), XmlDecodeErrorKind::Unhandled(_) => write!(f, "error parsing XML"), } } @@ -441,8 +441,7 @@ pub fn try_data<'a, 'inp>( Some(Ok(XmlToken(Token::Text { text }))) => return unescape(text.as_str()), Some(Ok(e @ XmlToken(Token::ElementStart { .. }))) => { return Err(XmlDecodeError::custom(format!( - "looking for a data element, found: {:?}", - e + "looking for a data element, found: {e:?}" ))) } Some(Err(e)) => return Err(e), diff --git a/rust-runtime/aws-smithy-xml/src/encode.rs b/rust-runtime/aws-smithy-xml/src/encode.rs index 80072334a65..132c5410e89 100644 --- a/rust-runtime/aws-smithy-xml/src/encode.rs +++ b/rust-runtime/aws-smithy-xml/src/encode.rs @@ -62,7 +62,7 @@ impl<'a> XmlWriter<'a> { impl XmlWriter<'_> { pub fn start_el<'b, 'c>(&'c mut self, tag: &'b str) -> ElWriter<'c, 'b> { - write!(self.doc, "<{}", tag).unwrap(); + write!(self.doc, "<{tag}").unwrap(); ElWriter::new(self.doc, tag) } } @@ -159,7 +159,7 @@ impl ScopeWriter<'_, '_> { } pub fn start_el<'b, 'c>(&'c mut self, tag: &'b str) -> ElWriter<'c, 'b> { - write!(self.doc, "<{}", tag).unwrap(); + write!(self.doc, "<{tag}").unwrap(); ElWriter::new(self.doc, tag) } } diff --git a/rust-runtime/aws-smithy-xml/src/unescape.rs b/rust-runtime/aws-smithy-xml/src/unescape.rs index 5d9f71383f7..2492bb9eb9b 100644 --- a/rust-runtime/aws-smithy-xml/src/unescape.rs +++ b/rust-runtime/aws-smithy-xml/src/unescape.rs @@ -57,8 +57,7 @@ pub(crate) fn unescape(s: &str) -> Result, XmlDecodeError> { })?; let chr = std::char::from_u32(char_code).ok_or_else(|| { XmlDecodeError::invalid_escape(format!( - "invalid char code: {}", - char_code + "invalid char code: {char_code}" )) })?; res.push(chr); diff --git a/rust-runtime/inlineable/src/endpoint_lib/parse_url.rs b/rust-runtime/inlineable/src/endpoint_lib/parse_url.rs index c661768e520..24f1e795fab 100644 --- a/rust-runtime/inlineable/src/endpoint_lib/parse_url.rs +++ b/rust-runtime/inlineable/src/endpoint_lib/parse_url.rs @@ -50,10 +50,7 @@ pub(crate) fn parse_url<'a>(url: &'a str, e: &mut DiagnosticCollector) -> Option let uri: Uri = e.capture(url.parse())?; let url: ParsedUrl = e.capture(url.parse())?; if let Some(query) = uri.query() { - e.report_error(format!( - "URL cannot have a query component (found {})", - query - )); + e.report_error(format!("URL cannot have a query component (found {query})")); return None; } if !["http", "https"].contains(&url.scheme()) { diff --git a/rust-runtime/inlineable/src/endpoint_lib/partition.rs b/rust-runtime/inlineable/src/endpoint_lib/partition.rs index 0f6b859b0ed..ab838c3cb2d 100644 --- a/rust-runtime/inlineable/src/endpoint_lib/partition.rs +++ b/rust-runtime/inlineable/src/endpoint_lib/partition.rs @@ -287,8 +287,7 @@ mod deser { }, other => { return Err(DeserializeError::custom(format!( - "expected object key or end object, found: {:?}", - other + "expected object key or end object, found: {other:?}", ))) } } @@ -359,8 +358,7 @@ mod deser { }, other => { return Err(DeserializeError::custom(format!( - "expected object key or end object, found: {:?}", - other + "expected object key or end object, found: {other:?}" ))) } } @@ -393,8 +391,7 @@ mod deser { } other => { return Err(DeserializeError::custom(format!( - "expected object key or end object, found: {:?}", - other + "expected object key or end object, found: {other:?}" ))) } } @@ -451,8 +448,7 @@ mod deser { }, other => { return Err(DeserializeError::custom(format!( - "expected object key or end object, found: {:?}", - other + "expected object key or end object, found: {other:?}", ))) } } diff --git a/rust-runtime/inlineable/src/lib.rs b/rust-runtime/inlineable/src/lib.rs index aa37eeac191..55cc0966972 100644 --- a/rust-runtime/inlineable/src/lib.rs +++ b/rust-runtime/inlineable/src/lib.rs @@ -79,8 +79,7 @@ mod test { ) .unwrap() .is_match(&token), - "token {} wasn't a valid random UUID", - token + "token {token} wasn't a valid random UUID" ); } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index cf6d0f556a3..e88baf106b9 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.86.0" +channel = "1.88.0" diff --git a/tools/ci-build/Dockerfile b/tools/ci-build/Dockerfile index 1491eea9e29..d867cc9fe03 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:2023 -ARG rust_stable_version=1.86.0 +ARG rust_stable_version=1.88.0 ARG rust_nightly_version=nightly-2025-08-06 FROM ${base_image} AS bare_base_image diff --git a/tools/ci-build/changelogger/Cargo.toml b/tools/ci-build/changelogger/Cargo.toml index a163c2e123b..3448dd0b2f6 100644 --- a/tools/ci-build/changelogger/Cargo.toml +++ b/tools/ci-build/changelogger/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "changelogger" -version = "0.3.1" +version = "0.3.2" authors = ["AWS Rust SDK Team "] description = "A CLI tool render and update changelogs from changelog files" edition = "2021" diff --git a/tools/ci-build/changelogger/src/render.rs b/tools/ci-build/changelogger/src/render.rs index a0183dc2027..d7c99680a59 100644 --- a/tools/ci-build/changelogger/src/render.rs +++ b/tools/ci-build/changelogger/src/render.rs @@ -46,7 +46,7 @@ static MAINTAINERS: LazyLock> = LazyLock::new(|| { fn is_maintainer(name: &str) -> bool { let name_lower = name.to_ascii_lowercase(); - MAINTAINERS.iter().any(|name| *name == name_lower) + MAINTAINERS.contains(&name_lower) } #[derive(Parser, Debug, Eq, PartialEq)] @@ -387,11 +387,11 @@ fn update_changelogs( if let Some(source_to_truncate) = &args.source_to_truncate { fs::remove_dir_all(source_to_truncate) .and_then(|_| fs::create_dir(source_to_truncate)) - .with_context(|| format!("failed to empty directory {:?}", source_to_truncate)) + .with_context(|| format!("failed to empty directory {source_to_truncate:?}")) .and_then(|_| { let dot_example = source_to_truncate.join(".example"); fs::write(dot_example.clone(), EXAMPLE_ENTRY) - .with_context(|| format!("failed to create {:?}", dot_example)) + .with_context(|| format!("failed to create {dot_example:?}")) })?; } eprintln!("Changelogs updated!"); @@ -487,7 +487,7 @@ fn render_external_contributors(entries: &[ChangelogEntry], out: &mut String) { out.push_str("- @"); out.push_str(contributor_handle); if !contribution_references.is_empty() { - write!(out, " ({})", contribution_references) + write!(out, " ({contribution_references})") // The `Write` implementation for `String` is infallible, // see https://doc.rust-lang.org/src/alloc/string.rs.html#2815 .unwrap() @@ -500,7 +500,7 @@ fn render_external_contributors(entries: &[ChangelogEntry], out: &mut String) { fn render_details(summary: &str, body: &str, out: &mut String) { out.push_str("
"); out.push('\n'); - write!(out, "{}", summary).unwrap(); + write!(out, "{summary}").unwrap(); out.push('\n'); // A blank line is required for the body to be rendered properly out.push('\n'); diff --git a/tools/ci-build/changelogger/src/split.rs b/tools/ci-build/changelogger/src/split.rs index a98649a015d..fdffa7831c4 100644 --- a/tools/ci-build/changelogger/src/split.rs +++ b/tools/ci-build/changelogger/src/split.rs @@ -46,15 +46,13 @@ pub fn subcommand_split(args: &SplitArgs) -> Result<()> { } .map_err(|errs| { anyhow::Error::msg(format!( - "cannot split changelogs with changelog errors: {:#?}", - errs + "cannot split changelogs with changelog errors: {errs:#?}" )) })?; let current_sdk_changelog = if args.destination.exists() { loader.load_from_file(&args.destination).map_err(|errs| { anyhow::Error::msg(format!( - "failed to load existing SDK changelog entries: {:#?}", - errs + "failed to load existing SDK changelog entries: {errs:#?}" )) })? } else { diff --git a/tools/ci-build/publisher/Cargo.toml b/tools/ci-build/publisher/Cargo.toml index 02ccb41a74d..4612a952271 100644 --- a/tools/ci-build/publisher/Cargo.toml +++ b/tools/ci-build/publisher/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "publisher" -version = "0.4.2" +version = "0.4.3" authors = ["AWS Rust SDK Team "] description = "Tool used to publish the AWS SDK to crates.io" edition = "2021" diff --git a/tools/ci-build/publisher/src/cargo/get_owners.rs b/tools/ci-build/publisher/src/cargo/get_owners.rs index 9b60dbfd7e8..a6e91bdfa15 100644 --- a/tools/ci-build/publisher/src/cargo/get_owners.rs +++ b/tools/ci-build/publisher/src/cargo/get_owners.rs @@ -43,8 +43,7 @@ impl ShellOperation for GetOwners { result.push(user_id.to_string()); } else { return Err(anyhow::Error::msg(format!( - "unrecognized line in `cargo owner` output: {}", - line + "unrecognized line in `cargo owner` output: {line}" ))); } } diff --git a/tools/ci-build/publisher/src/fs.rs b/tools/ci-build/publisher/src/fs.rs index 1ab53fa778d..4e6f8970e3e 100644 --- a/tools/ci-build/publisher/src/fs.rs +++ b/tools/ci-build/publisher/src/fs.rs @@ -46,20 +46,20 @@ async fn tokio_read_file(path: &Path) -> Result> { let mut contents = Vec::new(); let mut file = File::open(path) .await - .with_context(|| format!("failed to open {:?}", path))?; + .with_context(|| format!("failed to open {path:?}"))?; file.read_to_end(&mut contents) .await - .with_context(|| format!("failed to read {:?}", path))?; + .with_context(|| format!("failed to read {path:?}"))?; Ok(contents) } async fn tokio_write_file(path: &Path, contents: &[u8]) -> Result<()> { let mut file = File::create(path) .await - .with_context(|| format!("failed to create {:?}", path))?; + .with_context(|| format!("failed to create {path:?}"))?; file.write_all(contents) .await - .with_context(|| format!("failed to write {:?}", path))?; + .with_context(|| format!("failed to write {path:?}"))?; file.flush().await?; Ok(()) } diff --git a/tools/ci-build/publisher/src/publish.rs b/tools/ci-build/publisher/src/publish.rs index 6fc8ad12397..32e9677b61f 100644 --- a/tools/ci-build/publisher/src/publish.rs +++ b/tools/ci-build/publisher/src/publish.rs @@ -25,7 +25,7 @@ pub async fn is_published(index: Arc, crate_name: &str) -> Result Result<()> { info!("Publishing `{}`...", handle); run_with_retry( - &format!("Publishing `{}`", handle), + &format!("Publishing `{handle}`"), 5, Duration::from_secs(60), || async { diff --git a/tools/ci-build/publisher/src/subcommand/claim_crate_names.rs b/tools/ci-build/publisher/src/subcommand/claim_crate_names.rs index caef6abb22a..3d96fd6b0d5 100644 --- a/tools/ci-build/publisher/src/subcommand/claim_crate_names.rs +++ b/tools/ci-build/publisher/src/subcommand/claim_crate_names.rs @@ -84,7 +84,7 @@ async fn load_publishable_crate_names(path: &Path) -> Result> { let content = fs::read(manifest_path).with_context(|| format!("failed to read {path:?}"))?; let manifest = Manifest::from_slice(&content) - .with_context(|| format!("failed to load crate manifest for {:?}", path))?; + .with_context(|| format!("failed to load crate manifest for {path:?}"))?; if let Some(package) = manifest.package { let crate_name = package.name(); if matches!(package.publish(), cargo_toml::Publish::Flag(true)) { @@ -113,13 +113,12 @@ async fn discover_publishable_crate_names(repository_root: &Path) -> Result Result<()> { let cargo_toml = format!( r#"[package] -name = "{}" +name = "{package_name}" version = "0.0.1" edition = "2021" description = "Placeholder ahead of the next smithy-rs release" license = "Apache-2.0" -repository = "https://github.com/smithy-lang/smithy-rs""#, - package_name +repository = "https://github.com/smithy-lang/smithy-rs""# ); fs.write_file(directory_path.join("Cargo.toml"), cargo_toml.as_bytes()) .await?; diff --git a/tools/ci-build/publisher/src/subcommand/hydrate_readme.rs b/tools/ci-build/publisher/src/subcommand/hydrate_readme.rs index 294bc951967..9464adb35fa 100644 --- a/tools/ci-build/publisher/src/subcommand/hydrate_readme.rs +++ b/tools/ci-build/publisher/src/subcommand/hydrate_readme.rs @@ -44,7 +44,7 @@ pub fn subcommand_hydrate_readme( let context = make_context(msrv, &versions_manifest); let hydrated = hydrate_template(&template, &context)?; fs::write(output, hydrated.as_bytes()) - .with_context(|| format!("Failed to write hydrated README to {:?}", output))?; + .with_context(|| format!("Failed to write hydrated README to {output:?}"))?; Ok(()) } diff --git a/tools/ci-build/publisher/src/subcommand/publish.rs b/tools/ci-build/publisher/src/subcommand/publish.rs index 41fc762c73e..70fd93544b9 100644 --- a/tools/ci-build/publisher/src/subcommand/publish.rs +++ b/tools/ci-build/publisher/src/subcommand/publish.rs @@ -130,8 +130,7 @@ async fn wait_for_eventual_consistency(index: Arc, package: &Packag } if !is_published(index.clone(), &package.handle).await? { return Err(anyhow::Error::msg(format!( - "package wasn't found on crates.io {} seconds after publish", - max_wait_time + "package wasn't found on crates.io {max_wait_time} seconds after publish" ))); } Ok(()) @@ -177,7 +176,7 @@ pub async fn correct_owner(handle: &PackageHandle) -> Result<()> { cargo::RemoveOwner::new(&handle.name, crate_owner) .spawn() .await - .with_context(|| format!("remove incorrect owner `{}` from crate `{}`", crate_owner, handle))?; + .with_context(|| format!("remove incorrect owner `{crate_owner}` from crate `{handle}`"))?; info!( "Removed incorrect owner `{}` from crate `{}`", crate_owner, handle @@ -213,7 +212,7 @@ fn confirm_plan( info!("Publish plan:"); for item in full_plan { - println!(" {}", item); + println!(" {item}"); } info!( "Will publish {} crates total ({} Smithy runtime, {} AWS runtime, {} AWS SDK).", diff --git a/tools/ci-build/publisher/src/yank.rs b/tools/ci-build/publisher/src/yank.rs index 8535c5384a0..0eee53c2b8c 100644 --- a/tools/ci-build/publisher/src/yank.rs +++ b/tools/ci-build/publisher/src/yank.rs @@ -13,7 +13,7 @@ use tracing::info; pub async fn yank(crate_name: &str, crate_version: &str) -> anyhow::Result<()> { info!("Yanking `{}-{}`...", crate_name, crate_version); run_with_retry( - &format!("Yanking `{}-{}`", crate_name, crate_version), + &format!("Yanking `{crate_name}-{crate_version}`"), 5, Duration::from_secs(60), || async { diff --git a/tools/ci-build/runtime-versioner/Cargo.lock b/tools/ci-build/runtime-versioner/Cargo.lock index 113fbdc73b8..6c300247dbe 100644 --- a/tools/ci-build/runtime-versioner/Cargo.lock +++ b/tools/ci-build/runtime-versioner/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -904,7 +904,7 @@ dependencies = [ [[package]] name = "runtime-versioner" -version = "0.1.1" +version = "0.1.2" dependencies = [ "anyhow", "camino", @@ -1091,7 +1091,7 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smithy-rs-tool-common" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "async-trait", diff --git a/tools/ci-build/runtime-versioner/Cargo.toml b/tools/ci-build/runtime-versioner/Cargo.toml index 9049656c44c..4ac495cdae9 100644 --- a/tools/ci-build/runtime-versioner/Cargo.toml +++ b/tools/ci-build/runtime-versioner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-versioner" -version = "0.1.1" +version = "0.1.2" authors = ["AWS Rust SDK Team "] description = "Tool that manages runtime crate versions." edition = "2021" diff --git a/tools/ci-build/runtime-versioner/src/command/audit.rs b/tools/ci-build/runtime-versioner/src/command/audit.rs index ea4703be515..4003868eb05 100644 --- a/tools/ci-build/runtime-versioner/src/command/audit.rs +++ b/tools/ci-build/runtime-versioner/src/command/audit.rs @@ -122,9 +122,7 @@ struct RuntimeCrate { impl RuntimeCrate { /// True if the runtime crate's next version exists in crates.io fn next_version_is_published(&self) -> bool { - self.published_versions - .iter() - .any(|version| self.next_release_version == *version) + self.published_versions.contains(&self.next_release_version) } /// True if this runtime crate changed since the given release tag. diff --git a/tools/ci-build/runtime-versioner/src/command/patch.rs b/tools/ci-build/runtime-versioner/src/command/patch.rs index 649675385b4..681a96ea982 100644 --- a/tools/ci-build/runtime-versioner/src/command/patch.rs +++ b/tools/ci-build/runtime-versioner/src/command/patch.rs @@ -118,8 +118,7 @@ fn crate_version_has_changed(runtime_crate: &Package, aws_sdk_rust: &Repo) -> Re } assert!( to_patch_cargo_toml.exists(), - "{:?} did not exist!", - to_patch_cargo_toml + "{to_patch_cargo_toml:?} did not exist!" ); let sdk_cargo_toml = Manifest::from_path(&sdk_cargo_toml) .context("could not parse SDK Cargo.toml") diff --git a/tools/ci-build/runtime-versioner/src/util.rs b/tools/ci-build/runtime-versioner/src/util.rs index 61426ab9e37..9cf3da772ca 100644 --- a/tools/ci-build/runtime-versioner/src/util.rs +++ b/tools/ci-build/runtime-versioner/src/util.rs @@ -10,7 +10,7 @@ use std::path::Path; pub fn utf8_path_buf(path: impl AsRef) -> Utf8PathBuf { let path: &Path = path.as_ref(); <&Utf8Path>::try_from(path) - .with_context(|| format!("gross path_buf: {:?}", path)) + .with_context(|| format!("gross path_buf: {path:?}")) .unwrap() .into() } diff --git a/tools/ci-build/sdk-lints/Cargo.lock b/tools/ci-build/sdk-lints/Cargo.lock index 584693207fe..bcd0bb6b891 100644 --- a/tools/ci-build/sdk-lints/Cargo.lock +++ b/tools/ci-build/sdk-lints/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -838,7 +838,7 @@ dependencies = [ [[package]] name = "sdk-lints" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "cargo_toml 0.18.0", @@ -954,7 +954,7 @@ dependencies = [ [[package]] name = "smithy-rs-tool-common" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "async-trait", diff --git a/tools/ci-build/sdk-lints/Cargo.toml b/tools/ci-build/sdk-lints/Cargo.toml index c1fd1e1599f..e59d1228f8e 100644 --- a/tools/ci-build/sdk-lints/Cargo.toml +++ b/tools/ci-build/sdk-lints/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sdk-lints" -version = "0.1.0" +version = "0.1.1" edition = "2021" publish = false diff --git a/tools/ci-build/sdk-lints/src/anchor.rs b/tools/ci-build/sdk-lints/src/anchor.rs index d542fc2986f..af896ab830f 100644 --- a/tools/ci-build/sdk-lints/src/anchor.rs +++ b/tools/ci-build/sdk-lints/src/anchor.rs @@ -7,8 +7,8 @@ use anyhow::bail; pub fn anchors(name: &str) -> (String, String) { ( - format!("{}{} -->", ANCHOR_START, name), - format!("{}{} -->", ANCHOR_END, name), + format!("{ANCHOR_START}{name} -->"), + format!("{ANCHOR_END}{name} -->"), ) } diff --git a/tools/ci-build/sdk-lints/src/copyright.rs b/tools/ci-build/sdk-lints/src/copyright.rs index 5645fb6590b..66f94f4c837 100644 --- a/tools/ci-build/sdk-lints/src/copyright.rs +++ b/tools/ci-build/sdk-lints/src/copyright.rs @@ -43,7 +43,7 @@ fn check_copyright_header(path: impl AsRef) -> Vec { } let contents = match fs::read_to_string(path.as_ref()) { Ok(contents) => contents, - Err(err) if format!("{}", err).contains("No such file or directory") => { + Err(err) if format!("{err}").contains("No such file or directory") => { eprintln!("Note: {} does not exist", path.as_ref().display()); return vec![]; } diff --git a/tools/ci-build/sdk-lints/src/lint.rs b/tools/ci-build/sdk-lints/src/lint.rs index 8c773c12c64..ce43f9af71f 100644 --- a/tools/ci-build/sdk-lints/src/lint.rs +++ b/tools/ci-build/sdk-lints/src/lint.rs @@ -19,7 +19,7 @@ pub struct LintError { impl LintError { pub(crate) fn via_display(t: T) -> Self { - LintError::new(format!("{}", t)) + LintError::new(format!("{t}")) } pub(crate) fn new(message: impl Into>) -> Self { LintError { @@ -40,7 +40,7 @@ impl Display for LintError { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.message)?; if let Some(ctx) = &self.context { - write!(f, "({})", ctx)?; + write!(f, "({ctx})")?; } if let Some(path) = &self.location { write!(f, "({})", path.display())?; @@ -73,7 +73,7 @@ pub(crate) trait Lint { } else { eprintln!("Errors for {}:", self.name()); for error in &errors { - eprintln!(" {}", error) + eprintln!(" {error}") } } Ok(errors) @@ -95,7 +95,7 @@ pub(crate) trait Lint { if !errs.is_empty() { eprintln!("Errors for {}:", path.display()); for error in &errs { - eprintln!(" {}", error) + eprintln!(" {error}") } } if new_content != current_content { diff --git a/tools/ci-build/sdk-lints/src/lint_cargo_toml.rs b/tools/ci-build/sdk-lints/src/lint_cargo_toml.rs index 9bf5db06295..d0ca61b3291 100644 --- a/tools/ci-build/sdk-lints/src/lint_cargo_toml.rs +++ b/tools/ci-build/sdk-lints/src/lint_cargo_toml.rs @@ -91,8 +91,7 @@ fn check_crate_license(package: Package, path: impl AsRef) -> Result {} incorrect_license => errors.push(LintError::new(format!( - "invalid license: {:?}", - incorrect_license + "invalid license: {incorrect_license:?}" ))), }; if !path @@ -182,7 +181,7 @@ impl Fix for DocsRs { let package = match package(path) { Ok(Ok(package)) => package, Ok(Err(errs)) => return Ok((errs, updated)), - Err(errs) => return Ok((vec![LintError::new(format!("{}", errs))], updated)), + Err(errs) => return Ok((vec![LintError::new(format!("{errs}"))], updated)), }; let lint_errors = check_docs_rs(&package); Ok((lint_errors, updated)) diff --git a/tools/ci-build/sdk-lints/src/todos.rs b/tools/ci-build/sdk-lints/src/todos.rs index c6f9affa8fc..d38046f3129 100644 --- a/tools/ci-build/sdk-lints/src/todos.rs +++ b/tools/ci-build/sdk-lints/src/todos.rs @@ -48,7 +48,7 @@ impl Check for TodosHaveContext { fn check(&self, path: impl AsRef) -> anyhow::Result> { let contents = match fs::read_to_string(path.as_ref()) { Ok(contents) => contents, - Err(err) if format!("{}", err).contains("No such file or directory") => { + Err(err) if format!("{err}").contains("No such file or directory") => { eprintln!("Note: {} does not exist", path.as_ref().display()); return Ok(vec![]); } @@ -59,8 +59,7 @@ impl Check for TodosHaveContext { if !todo.starts_with('(') { let todo_line = todo.lines().next().unwrap_or_default(); errs.push(LintError::new(format!( - "TODO without context: `TODO{}`", - todo_line + "TODO without context: `TODO{todo_line}`" ))) } } diff --git a/tools/ci-build/sdk-lockfiles/Cargo.lock b/tools/ci-build/sdk-lockfiles/Cargo.lock index 64725689ab0..f5be7884ce1 100644 --- a/tools/ci-build/sdk-lockfiles/Cargo.lock +++ b/tools/ci-build/sdk-lockfiles/Cargo.lock @@ -933,7 +933,7 @@ dependencies = [ [[package]] name = "sdk-lockfiles" -version = "0.1.3" +version = "0.1.4" dependencies = [ "anyhow", "cargo-lock", diff --git a/tools/ci-build/sdk-lockfiles/Cargo.toml b/tools/ci-build/sdk-lockfiles/Cargo.toml index 63e76831525..326c963d09c 100644 --- a/tools/ci-build/sdk-lockfiles/Cargo.toml +++ b/tools/ci-build/sdk-lockfiles/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sdk-lockfiles" -version = "0.1.4" +version = "0.1.5" authors = ["AWS Rust SDK Team "] description = """ A CLI tool to audit lockfiles for Smithy runtime crates, AWS runtime crates, `aws-config`, and the workspace containing diff --git a/tools/ci-build/sdk-lockfiles/src/audit.rs b/tools/ci-build/sdk-lockfiles/src/audit.rs index 681fe767abe..3e9574c7071 100644 --- a/tools/ci-build/sdk-lockfiles/src/audit.rs +++ b/tools/ci-build/sdk-lockfiles/src/audit.rs @@ -252,10 +252,7 @@ fn lockfile_for( lockfile.push(relative_path_to_lockfile); Ok(( Lockfile::load(lockfile).with_context(|| { - format!( - "failed to crate a `Lockfile` for {}", - relative_path_to_lockfile - ) + format!("failed to crate a `Lockfile` for {relative_path_to_lockfile}") })?, relative_path_to_lockfile, )) diff --git a/tools/ci-build/sdk-versioner/Cargo.toml b/tools/ci-build/sdk-versioner/Cargo.toml index 4403b03dbda..91df37d1580 100644 --- a/tools/ci-build/sdk-versioner/Cargo.toml +++ b/tools/ci-build/sdk-versioner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sdk-versioner" -version = "0.1.0" +version = "0.1.1" authors = ["AWS Rust SDK Team "] edition = "2021" license = "Apache-2.0" diff --git a/tools/ci-build/sdk-versioner/src/main.rs b/tools/ci-build/sdk-versioner/src/main.rs index 1a3bb4e98f9..fbf90d077a9 100644 --- a/tools/ci-build/sdk-versioner/src/main.rs +++ b/tools/ci-build/sdk-versioner/src/main.rs @@ -140,7 +140,7 @@ fn update_manifest( manifest_path: &Path, dependency_context: &DependencyContext, ) -> anyhow::Result<()> { - println!("Updating {:?}...", manifest_path); + println!("Updating {manifest_path:?}..."); let crate_path = manifest_path.parent().expect("manifest has a parent"); let mut metadata: DocumentMut = String::from_utf8( diff --git a/tools/ci-build/smithy-rs-tool-common/Cargo.toml b/tools/ci-build/smithy-rs-tool-common/Cargo.toml index 1aace74e3db..7e482da5de6 100644 --- a/tools/ci-build/smithy-rs-tool-common/Cargo.toml +++ b/tools/ci-build/smithy-rs-tool-common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "smithy-rs-tool-common" -version = "0.1.0" +version = "0.1.1" authors = ["AWS Rust SDK Team "] edition = "2021" license = "Apache-2.0" diff --git a/tools/ci-build/smithy-rs-tool-common/src/changelog.rs b/tools/ci-build/smithy-rs-tool-common/src/changelog.rs index f5f3ef7807a..c4399f3f231 100644 --- a/tools/ci-build/smithy-rs-tool-common/src/changelog.rs +++ b/tools/ci-build/smithy-rs-tool-common/src/changelog.rs @@ -318,7 +318,7 @@ impl Changelog { .map(validate_aws_handauthored) .chain(self.smithy_rs.iter().map(validate_smithyrs_handauthored)) .filter_map(Result::err) - .map(|e| format!("{}", e)) + .map(|e| format!("{e}")) .collect(); if errors.is_empty() { Ok(()) diff --git a/tools/ci-build/smithy-rs-tool-common/src/command.rs b/tools/ci-build/smithy-rs-tool-common/src/command.rs index 113014240a2..56213ab402f 100644 --- a/tools/ci-build/smithy-rs-tool-common/src/command.rs +++ b/tools/ci-build/smithy-rs-tool-common/src/command.rs @@ -33,9 +33,9 @@ pub mod sync { fn expect_success_output(&mut self, context: &str) -> Result { let output = self .output() - .with_context(|| format!("failed to invoke {:?}", self))?; + .with_context(|| format!("failed to invoke {self:?}"))?; let stdout = String::from_utf8(output.stdout) - .with_context(|| format!("command: {:?}", self)) + .with_context(|| format!("command: {self:?}")) .context("output had invalid utf-8")?; if !output.status.success() { bail!( @@ -55,7 +55,7 @@ pub mod sync { ) -> Result { let output = self .output() - .with_context(|| format!("failed to invoke {:?}", self))?; + .with_context(|| format!("failed to invoke {self:?}"))?; let expected: Vec<_> = statuses.into_iter().collect(); let actual = output.status.code().unwrap(); if expected.contains(&actual) { diff --git a/tools/ci-build/smithy-rs-tool-common/src/git.rs b/tools/ci-build/smithy-rs-tool-common/src/git.rs index bee033b199c..5a0146739eb 100644 --- a/tools/ci-build/smithy-rs-tool-common/src/git.rs +++ b/tools/ci-build/smithy-rs-tool-common/src/git.rs @@ -246,14 +246,14 @@ impl Git for GitCLI { ) -> Result<()> { let mut command = Command::new(&self.binary_name); command.arg("-c"); - command.arg(format!("user.name={}", bot_name)); + command.arg(format!("user.name={bot_name}")); command.arg("-c"); - command.arg(format!("user.email={}", bot_email)); + command.arg(format!("user.email={bot_email}")); command.arg("commit"); command.arg("-m"); command.arg(message); command.arg("--author"); - command.arg(format!("{} <{}>", author_name, author_email)); + command.arg(format!("{author_name} <{author_email}>")); command.current_dir(&self.repo_path); let output = log_command(command).output()?; @@ -264,9 +264,9 @@ impl Git for GitCLI { fn commit(&self, name: &str, email: &str, message: &str) -> Result<()> { let mut command = Command::new(&self.binary_name); command.arg("-c"); - command.arg(format!("user.name={}", name)); + command.arg(format!("user.name={name}")); command.arg("-c"); - command.arg(format!("user.email={}", email)); + command.arg(format!("user.email={email}")); command.arg("commit"); command.arg("-m"); command.arg(message); @@ -286,8 +286,7 @@ impl Git for GitCLI { let mut command = Command::new(&self.binary_name); command.arg("rev-list"); command.arg(format!( - "{}..{}", - end_exclusive_revision, start_inclusive_revision + "{end_exclusive_revision}..{start_inclusive_revision}" )); if let Some(path) = path { command.arg("--"); @@ -366,9 +365,9 @@ impl Git for GitCLI { fn squash_merge(&self, author_name: &str, author_email: &str, branch_name: &str) -> Result<()> { let mut command = Command::new(&self.binary_name); command.arg("-c"); - command.arg(format!("user.name={}", author_name)); + command.arg(format!("user.name={author_name}")); command.arg("-c"); - command.arg(format!("user.email={}", author_email)); + command.arg(format!("user.email={author_email}")); command.arg("merge"); command.arg("--squash"); command.arg(branch_name); @@ -432,7 +431,7 @@ fn split_file_names(value: &str) -> Vec { fn log_command(command: Command) -> Command { let mut message = String::new(); if let Some(cwd) = command.get_current_dir() { - write!(&mut message, "[in {:?}]: ", cwd).unwrap(); + write!(&mut message, "[in {cwd:?}]: ").unwrap(); } message.push_str(command.get_program().to_str().expect("valid str")); for arg in command.get_args() { diff --git a/tools/ci-build/smithy-rs-tool-common/src/package.rs b/tools/ci-build/smithy-rs-tool-common/src/package.rs index e6f6a8d239b..ab0580e061f 100644 --- a/tools/ci-build/smithy-rs-tool-common/src/package.rs +++ b/tools/ci-build/smithy-rs-tool-common/src/package.rs @@ -158,7 +158,7 @@ impl Package { ) -> Result> { let manifest_path = manifest_path.as_ref(); let mut manifest = Manifest::from_slice(manifest) - .with_context(|| format!("failed to load package manifest for {:?}", manifest_path))?; + .with_context(|| format!("failed to load package manifest for {manifest_path:?}"))?; manifest.complete_from_path(manifest_path)?; if let Some(package) = manifest.package { let name = package.name; diff --git a/tools/ci-build/smithy-rs-tool-common/src/shell.rs b/tools/ci-build/smithy-rs-tool-common/src/shell.rs index d67604c2084..834cf3ee26d 100644 --- a/tools/ci-build/smithy-rs-tool-common/src/shell.rs +++ b/tools/ci-build/smithy-rs-tool-common/src/shell.rs @@ -52,7 +52,7 @@ pub fn capture_error(operation_name: &str, output: &Output) -> anyhow::Error { "Failed to {name}:\nStatus: {status}\nStdout: {stdout}\nStderr: {stderr}\n", name = operation_name, status = if let Some(code) = output.status.code() { - format!("{}", code) + format!("{code}") } else { "Killed by signal".to_string() }, diff --git a/tools/ci-build/smithy-rs-tool-common/src/versions_manifest.rs b/tools/ci-build/smithy-rs-tool-common/src/versions_manifest.rs index 6e5c96a8be3..69a134e6142 100644 --- a/tools/ci-build/smithy-rs-tool-common/src/versions_manifest.rs +++ b/tools/ci-build/smithy-rs-tool-common/src/versions_manifest.rs @@ -55,10 +55,8 @@ impl VersionsManifest { } pub async fn from_github_tag(tag: &ReleaseTag) -> Result { - let manifest_url = format!( - "https://raw.githubusercontent.com/awslabs/aws-sdk-rust/{}/versions.toml", - tag - ); + let manifest_url = + format!("https://raw.githubusercontent.com/awslabs/aws-sdk-rust/{tag}/versions.toml"); let manifest_contents = reqwest::get(manifest_url) .await .context("failed to download release manifest")? diff --git a/tools/ci-cdk/canary-lambda/src/latest/paginator_canary.rs b/tools/ci-cdk/canary-lambda/src/latest/paginator_canary.rs index 744b6614654..c189bac0ae2 100644 --- a/tools/ci-cdk/canary-lambda/src/latest/paginator_canary.rs +++ b/tools/ci-cdk/canary-lambda/src/latest/paginator_canary.rs @@ -31,18 +31,13 @@ pub async fn paginator_canary(client: ec2::Client, page_size: usize) -> anyhow:: let items_in_page = page.spot_price_history.unwrap_or_default().len(); if items_in_page > page_size { bail!( - "failed to retrieve results of correct page size (expected {}, got {})", - page_size, - items_in_page + "failed to retrieve results of correct page size (expected {page_size}, got {items_in_page})", ) } num_pages += 1; } if num_pages < 2 { - bail!( - "expected 3+ pages containing ~60 results but got {} pages", - num_pages - ) + bail!("expected 3+ pages containing ~60 results but got {num_pages} pages",) } // https://github.com/awslabs/aws-sdk-rust/issues/405 diff --git a/tools/ci-cdk/canary-lambda/src/latest/s3_canary.rs b/tools/ci-cdk/canary-lambda/src/latest/s3_canary.rs index 06ba9500fab..5e1fa70814d 100644 --- a/tools/ci-cdk/canary-lambda/src/latest/s3_canary.rs +++ b/tools/ci-cdk/canary-lambda/src/latest/s3_canary.rs @@ -46,7 +46,7 @@ pub async fn s3_canary(client: s3::Client, s3_bucket_name: String) -> anyhow::Re { Ok(_) => { return Err( - CanaryError(format!("Expected object {} to not exist in S3", test_key)).into(), + CanaryError(format!("Expected object {test_key} to not exist in S3")).into(), ); } Err(err) => { @@ -112,7 +112,7 @@ pub async fn s3_canary(client: s3::Client, s3_bucket_name: String) -> anyhow::Re .text() .await?; if get_resp != "presigned_test" { - return Err(CanaryError(format!("presigned URL returned bad data: {:?}", get_resp)).into()); + return Err(CanaryError(format!("presigned URL returned bad data: {get_resp:?}")).into()); } let metadata_value = output @@ -135,8 +135,7 @@ pub async fn s3_canary(client: s3::Client, s3_bucket_name: String) -> anyhow::Re } } else { Err(CanaryError(format!( - "S3 metadata was incorrect. Expected `{}` but got `{}`.", - METADATA_TEST_VALUE, value + "S3 metadata was incorrect. Expected `{METADATA_TEST_VALUE}` but got `{value}`.", )) .into()) } @@ -201,8 +200,7 @@ pub async fn s3_mrap_canary(client: s3::Client, s3_mrap_bucket_arn: String) -> a Ok(()) } else { Err(CanaryError(format!( - "S3 metadata was incorrect. Expected `{}` but got `{}`.", - METADATA_TEST_VALUE, value + "S3 metadata was incorrect. Expected `{METADATA_TEST_VALUE}` but got `{value}`.", )) .into()) } @@ -294,7 +292,7 @@ pub async fn s3_express_canary( .text() .await?; if response != "test" { - return Err(CanaryError(format!("presigned URL returned bad data: {:?}", response)).into()); + return Err(CanaryError(format!("presigned URL returned bad data: {response:?}")).into()); } let metadata_value = output @@ -317,8 +315,7 @@ pub async fn s3_express_canary( } } else { Err(CanaryError(format!( - "S3 metadata was incorrect. Expected `{}` but got `{}`.", - METADATA_TEST_VALUE, value + "S3 metadata was incorrect. Expected `{METADATA_TEST_VALUE}` but got `{value}`.", )) .into()) } diff --git a/tools/ci-cdk/canary-lambda/src/latest/transcribe_canary.rs b/tools/ci-cdk/canary-lambda/src/latest/transcribe_canary.rs index 065539b97fd..6ce0c03e4ea 100644 --- a/tools/ci-cdk/canary-lambda/src/latest/transcribe_canary.rs +++ b/tools/ci-cdk/canary-lambda/src/latest/transcribe_canary.rs @@ -61,7 +61,7 @@ pub async fn transcribe_canary( } } } - otherwise => panic!("received unexpected event type: {:?}", otherwise), + otherwise => panic!("received unexpected event type: {otherwise:?}"), } } diff --git a/tools/ci-cdk/canary-lambda/src/main.rs b/tools/ci-cdk/canary-lambda/src/main.rs index df6a3d5c6a4..fdebfd7cd5c 100644 --- a/tools/ci-cdk/canary-lambda/src/main.rs +++ b/tools/ci-cdk/canary-lambda/src/main.rs @@ -61,7 +61,7 @@ async fn main() -> Result<(), Error> { { Ok(()) } else { - Err(format!("canary failed: {:?}", result).into()) + Err(format!("canary failed: {result:?}").into()) } } else { lambda_runtime::run(main_handler).await?; @@ -127,7 +127,7 @@ async fn canary_result(handle: JoinHandle>) -> Result<(), Str Err(_timeout) => Err("canary timed out".into()), Ok(Ok(result)) => match result { Ok(_) => Ok(()), - Err(err) => Err(format!("{:?}", err)), + Err(err) => Err(format!("{err:?}")), }, Ok(Err(err)) => Err(err.to_string()), }