diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92f145542f..d84e48b715 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: workflow_call: env: - rust_version: 1.61.0 + rust_version: 1.62.0 rust_toolchain_components: clippy,rustfmt jobs: diff --git a/.github/workflows/pull-request-bot.yml b/.github/workflows/pull-request-bot.yml index 2e9125340b..75f294e91c 100644 --- a/.github/workflows/pull-request-bot.yml +++ b/.github/workflows/pull-request-bot.yml @@ -28,7 +28,7 @@ concurrency: env: java_version: 11 - rust_version: 1.61.0 + rust_version: 1.62.0 rust_toolchain_components: clippy,rustfmt apt_dependencies: libssl-dev gnuplot jq diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e25b551059..fc5f8590a8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ concurrency: cancel-in-progress: true env: - rust_version: 1.61.0 + rust_version: 1.62.0 name: Release smithy-rs run-name: ${{ github.workflow }} - ${{ inputs.dry_run && 'Dry run' || 'Production run' }} diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index 781d528fc4..c3272671a7 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -11,6 +11,25 @@ # meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client | server | all"} # author = "rcoh" + +[[smithy-rs]] +message = "Bump MSRV to be 1.62.0." +references = ["smithy-rs#1825"] +meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "all" } +author = "LukeMathWalker" + +[[smithy-rs]] +message = "Bump pyo3 and pyo3-asyncio from 0.16.x to 0.17.0 for aws-smithy-http-server-python." +references = ["smithy-rs#1825"] +meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "server" } +author = "LukeMathWalker" + +[[aws-sdk-rust]] +message = "Bump MSRV to be 1.62.0." +references = ["smithy-rs#1825"] +meta = { "breaking" = true, "tada" = false, "bug" = false } +author = "LukeMathWalker" + [[smithy-rs]] message = """ Replace all usages of `AtomicU64` with `AtomicUsize` to support 32bit targets. diff --git a/aws/rust-runtime/aws-endpoint/src/lib.rs b/aws/rust-runtime/aws-endpoint/src/lib.rs index ab3e954911..fbf81a7fea 100644 --- a/aws/rust-runtime/aws-endpoint/src/lib.rs +++ b/aws/rust-runtime/aws-endpoint/src/lib.rs @@ -283,8 +283,7 @@ mod test { props.insert(region.clone()); props.insert(SigningService::from_static("qldb")); props.insert( - EndpointShim::from_arc(provider) - .resolve_endpoint(&Params::new(Some(region.clone()))), + EndpointShim::from_arc(provider).resolve_endpoint(&Params::new(Some(region))), ); }; let req = AwsEndpointStage.apply(req).expect("should succeed"); @@ -314,8 +313,7 @@ mod test { props.insert(region.clone()); props.insert(SigningService::from_static("qldb")); props.insert( - EndpointShim::from_arc(provider) - .resolve_endpoint(&Params::new(Some(region.clone()))), + EndpointShim::from_arc(provider).resolve_endpoint(&Params::new(Some(region))), ); }; let req = AwsEndpointStage.apply(req).expect("should succeed"); diff --git a/aws/rust-runtime/aws-http/src/content_encoding.rs b/aws/rust-runtime/aws-http/src/content_encoding.rs index e25b2c8b5c..6b900ab750 100644 --- a/aws/rust-runtime/aws-http/src/content_encoding.rs +++ b/aws/rust-runtime/aws-http/src/content_encoding.rs @@ -376,7 +376,7 @@ mod tests { impl SputteringBody { fn len(&self) -> usize { - self.parts.iter().flat_map(|b| b).map(|b| b.len()).sum() + self.parts.iter().flatten().map(|b| b.len()).sum() } } @@ -462,7 +462,10 @@ mod tests { }; let timeout_duration = Duration::from_secs(3); - if let Err(_) = tokio::time::timeout(timeout_duration, test_fut).await { + if tokio::time::timeout(timeout_duration, test_fut) + .await + .is_err() + { panic!("test_aws_chunked_encoding timed out after {timeout_duration:?}"); } } @@ -513,7 +516,10 @@ mod tests { }; let timeout_duration = Duration::from_secs(3); - if let Err(_) = tokio::time::timeout(timeout_duration, test_fut).await { + if tokio::time::timeout(timeout_duration, test_fut) + .await + .is_err() + { panic!( "test_aws_chunked_encoding_sputtering_body timed out after {timeout_duration:?}" ); diff --git a/aws/rust-runtime/aws-http/src/recursion_detection.rs b/aws/rust-runtime/aws-http/src/recursion_detection.rs index 37805a534e..5e849598b4 100644 --- a/aws/rust-runtime/aws-http/src/recursion_detection.rs +++ b/aws/rust-runtime/aws-http/src/recursion_detection.rs @@ -160,7 +160,7 @@ mod test { ) } assert_ok(validate_headers( - &augmented_req.http().headers(), + augmented_req.http().headers(), test_case.request_headers_after(), )) } diff --git a/aws/rust-runtime/aws-http/src/retry.rs b/aws/rust-runtime/aws-http/src/retry.rs index 4ee9a3c792..0ce9d368f8 100644 --- a/aws/rust-runtime/aws-http/src/retry.rs +++ b/aws/rust-runtime/aws-http/src/retry.rs @@ -143,7 +143,7 @@ mod test { ) -> Result, SdkError> { Err(SdkError::ServiceError { err, - raw: operation::Response::new(raw.map(|b| SdkBody::from(b))), + raw: operation::Response::new(raw.map(SdkBody::from)), }) } @@ -265,9 +265,7 @@ mod test { policy.classify_retry( Result::, SdkError>::Err(SdkError::ResponseError { err: Box::new(UnmodeledError), - raw: operation::Response::new( - http::Response::new("OK").map(|b| SdkBody::from(b)) - ), + raw: operation::Response::new(http::Response::new("OK").map(SdkBody::from)), }) .as_ref() ), diff --git a/aws/rust-runtime/aws-inlineable/src/http_body_checksum.rs b/aws/rust-runtime/aws-inlineable/src/http_body_checksum.rs index 4848f5c89a..24679851fb 100644 --- a/aws/rust-runtime/aws-inlineable/src/http_body_checksum.rs +++ b/aws/rust-runtime/aws-inlineable/src/http_body_checksum.rs @@ -265,7 +265,7 @@ mod tests { for i in 0..10000 { let line = format!("This is a large file created for testing purposes {}", i); file.as_file_mut().write(line.as_bytes()).unwrap(); - crc32c_checksum.update(&line.as_bytes()); + crc32c_checksum.update(line.as_bytes()); } let body = ByteStream::read_from() diff --git a/aws/rust-runtime/aws-inlineable/tests/middleware_e2e_test.rs b/aws/rust-runtime/aws-inlineable/tests/middleware_e2e_test.rs index e52667290b..90fdc32373 100644 --- a/aws/rust-runtime/aws-inlineable/tests/middleware_e2e_test.rs +++ b/aws/rust-runtime/aws-inlineable/tests/middleware_e2e_test.rs @@ -82,7 +82,7 @@ fn test_operation() -> Operation Operation().ok()); } - _ => panic!("Unexpected `MissingContentTypeReason`: {}", e.to_string()), + _ => panic!("Unexpected `MissingContentTypeReason`: {}", e), }, } } diff --git a/rust-runtime/aws-smithy-http-server/src/routing/mod.rs b/rust-runtime/aws-smithy-http-server/src/routing/mod.rs index e72f04f30d..ec6b4394a6 100644 --- a/rust-runtime/aws-smithy-http-server/src/routing/mod.rs +++ b/rust-runtime/aws-smithy-http-server/src/routing/mod.rs @@ -323,7 +323,7 @@ mod rest_tests { #[inline] fn call(&mut self, req: Request) -> Self::Future { - let body = boxed(Body::from(format!("{} :: {}", self.0, req.uri().to_string()))); + let body = boxed(Body::from(format!("{} :: {}", self.0, req.uri()))); let fut = async { Ok(Response::builder().status(&http::StatusCode::OK).body(body).unwrap()) }; Box::pin(fut) } diff --git a/rust-runtime/aws-smithy-http-server/src/routing/tiny_map.rs b/rust-runtime/aws-smithy-http-server/src/routing/tiny_map.rs index 625bd2d4f6..236da27797 100644 --- a/rust-runtime/aws-smithy-http-server/src/routing/tiny_map.rs +++ b/rust-runtime/aws-smithy-http-server/src/routing/tiny_map.rs @@ -122,9 +122,9 @@ mod tests { const CUTOFF: usize = 5; - const SMALL_VALUES: [(&'static str, usize); 3] = [("a", 0), ("b", 1), ("c", 2)]; - const MEDIUM_VALUES: [(&'static str, usize); 5] = [("a", 0), ("b", 1), ("c", 2), ("d", 3), ("e", 4)]; - const LARGE_VALUES: [(&'static str, usize); 10] = [ + const SMALL_VALUES: [(&str, usize); 3] = [("a", 0), ("b", 1), ("c", 2)]; + const MEDIUM_VALUES: [(&str, usize); 5] = [("a", 0), ("b", 1), ("c", 2), ("d", 3), ("e", 4)]; + const LARGE_VALUES: [(&str, usize); 10] = [ ("a", 0), ("b", 1), ("c", 2), diff --git a/rust-runtime/aws-smithy-http/src/header.rs b/rust-runtime/aws-smithy-http/src/header.rs index 965bcdd8e0..69ef14ea47 100644 --- a/rust-runtime/aws-smithy-http/src/header.rs +++ b/rust-runtime/aws-smithy-http/src/header.rs @@ -604,10 +604,8 @@ mod test { let merged_header_map = append_merge_header_maps(left_hand_side_headers, right_hand_side_headers); - let actual_merged_values: Vec<_> = merged_header_map - .get_all(header_name.clone()) - .into_iter() - .collect(); + let actual_merged_values: Vec<_> = + merged_header_map.get_all(header_name).into_iter().collect(); let expected_merged_values = vec![left_header_value, right_header_value]; @@ -630,10 +628,8 @@ mod test { let merged_header_map = append_merge_header_maps(left_hand_side_headers, right_hand_side_headers); - let actual_merged_values: Vec<_> = merged_header_map - .get_all(header_name.clone()) - .into_iter() - .collect(); + let actual_merged_values: Vec<_> = + merged_header_map.get_all(header_name).into_iter().collect(); let expected_merged_values = vec![left_header_value_1, left_header_value_2, right_header_value]; @@ -655,10 +651,8 @@ mod test { let merged_header_map = append_merge_header_maps(left_hand_side_headers, right_hand_side_headers); - let actual_merged_values: Vec<_> = merged_header_map - .get_all(header_name.clone()) - .into_iter() - .collect(); + let actual_merged_values: Vec<_> = + merged_header_map.get_all(header_name).into_iter().collect(); let expected_merged_values = vec![right_header_value_1, right_header_value_2]; diff --git a/rust-runtime/aws-smithy-http/src/retry.rs b/rust-runtime/aws-smithy-http/src/retry.rs index b562b66290..48e86894cb 100644 --- a/rust-runtime/aws-smithy-http/src/retry.rs +++ b/rust-runtime/aws-smithy-http/src/retry.rs @@ -124,7 +124,7 @@ mod test { ) -> Result, SdkError> { Err(SdkError::ServiceError { err, - raw: operation::Response::new(raw.map(|b| SdkBody::from(b))), + raw: operation::Response::new(raw.map(SdkBody::from)), }) } @@ -194,9 +194,7 @@ mod test { policy.classify_retry( Result::, SdkError>::Err(SdkError::ResponseError { err: Box::new(UnmodeledError), - raw: operation::Response::new( - http::Response::new("OK").map(|b| SdkBody::from(b)) - ), + raw: operation::Response::new(http::Response::new("OK").map(SdkBody::from)), }) .as_ref() ), diff --git a/rust-runtime/aws-smithy-json/src/deserialize/token.rs b/rust-runtime/aws-smithy-json/src/deserialize/token.rs index 6525651828..3bead63fad 100644 --- a/rust-runtime/aws-smithy-json/src/deserialize/token.rs +++ b/rust-runtime/aws-smithy-json/src/deserialize/token.rs @@ -600,7 +600,7 @@ pub mod test { Err(Error::new( ErrorReason::Custom(Cow::Owned(format!( "{} is not a valid epoch", - invalid.replace("-", "") + invalid.replace('-', "") ))), None, )), diff --git a/rust-runtime/aws-smithy-protocol-test/src/lib.rs b/rust-runtime/aws-smithy-protocol-test/src/lib.rs index 1825867efd..651459e00e 100644 --- a/rust-runtime/aws-smithy-protocol-test/src/lib.rs +++ b/rust-runtime/aws-smithy-protocol-test/src/lib.rs @@ -386,9 +386,7 @@ mod tests { fn test_validate_empty_query_string() { let request = Request::builder().uri("/foo").body(()).unwrap(); validate_query_string(&request, &[]).expect("no required params should pass"); - validate_query_string(&request, &["a"]) - .err() - .expect("no params provided"); + validate_query_string(&request, &["a"]).expect_err("no params provided"); } #[test] diff --git a/rust-runtime/aws-smithy-query/src/lib.rs b/rust-runtime/aws-smithy-query/src/lib.rs index f8065be16e..67c0d2ee1d 100644 --- a/rust-runtime/aws-smithy-query/src/lib.rs +++ b/rust-runtime/aws-smithy-query/src/lib.rs @@ -9,6 +9,7 @@ use aws_smithy_types::date_time::{DateTimeFormatError, Format}; use aws_smithy_types::primitive::Encoder; use aws_smithy_types::{DateTime, Number}; use std::borrow::Cow; +use std::fmt::Write; use urlencoding::encode; pub struct QueryWriter<'a> { @@ -62,14 +63,18 @@ impl<'a> QueryMapWriter<'a> { pub fn entry(&mut self, key: &str) -> QueryValueWriter { let entry = if self.flatten { "" } else { ".entry" }; - self.output.push_str(&format!( + write!( + &mut self.output, "&{}{}.{}.{}={}", self.prefix, entry, self.next_index, self.key_name, encode(key) - )); + ) + // The `Write` implementation for `String` is infallible, + // see https://doc.rust-lang.org/src/alloc/string.rs.html#2815 + .unwrap(); let value_name = format!( "{}{}.{}.{}", self.prefix, entry, self.next_index, self.value_name 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 dd5d72d1b3..560a16409e 100644 --- a/rust-runtime/aws-smithy-types/src/date_time/format.rs +++ b/rust-runtime/aws-smithy-types/src/date_time/format.rs @@ -532,7 +532,7 @@ mod tests { .smithy_format_value .as_ref() .expect("parse test cases should always have a formatted value"); - let actual = parse(&to_parse); + let actual = parse(to_parse); assert!( actual.is_ok(), diff --git a/rust-runtime/aws-smithy-types/src/lib.rs b/rust-runtime/aws-smithy-types/src/lib.rs index 3e7b599e15..6a18c187a0 100644 --- a/rust-runtime/aws-smithy-types/src/lib.rs +++ b/rust-runtime/aws-smithy-types/src/lib.rs @@ -291,7 +291,7 @@ impl TryFrom for f64 { } } Number::NegInt(v) => { - if -(1 << 53) <= v && v <= (1 << 53) { + if (-(1 << 53)..=(1 << 53)).contains(&v) { Ok(v as Self) } else { Err(Self::Error::I64ToFloatLossyConversion(v)) @@ -316,7 +316,7 @@ impl TryFrom for f32 { } } Number::NegInt(v) => { - if -(1 << 24) <= v && v <= (1 << 24) { + if (-(1 << 24)..=(1 << 24)).contains(&v) { Ok(v as Self) } else { Err(Self::Error::I64ToFloatLossyConversion(v)) diff --git a/rust-runtime/aws-smithy-xml/src/decode.rs b/rust-runtime/aws-smithy-xml/src/decode.rs index cd0c6ba635..936d4c3d32 100644 --- a/rust-runtime/aws-smithy-xml/src/decode.rs +++ b/rust-runtime/aws-smithy-xml/src/decode.rs @@ -463,7 +463,7 @@ mod test { let xml = r#""#; let mut doc = Document::new(xml); let mut scoped = doc.root_element().expect("valid doc"); - assert_eq!(scoped.start_el.closed, true); + assert!(scoped.start_el.closed); assert!(scoped.next_tag().is_none()) } @@ -531,8 +531,8 @@ mod test { root.start_el().attributes, vec![Attr { name: Name { - prefix: "xsi".into(), - local: "type".into() + prefix: "xsi", + local: "type" }, value: "CanonicalUser".into() }] diff --git a/rust-runtime/aws-smithy-xml/src/unescape.rs b/rust-runtime/aws-smithy-xml/src/unescape.rs index 170530596d..3f779ebc0c 100644 --- a/rust-runtime/aws-smithy-xml/src/unescape.rs +++ b/rust-runtime/aws-smithy-xml/src/unescape.rs @@ -150,7 +150,7 @@ mod test { fn no_panics(s: String) { let unescaped = unescape(&s); // if the string needed to be escaped, we - if s.contains("&") { + if s.contains('&') { assert!( matches!(unescaped, Ok(Cow::Owned(_)) | Err(_)) ); diff --git a/rust-runtime/aws-smithy-xml/tests/handwritten_parsers.rs b/rust-runtime/aws-smithy-xml/tests/handwritten_parsers.rs index d8bedd9870..a58f0b3241 100644 --- a/rust-runtime/aws-smithy-xml/tests/handwritten_parsers.rs +++ b/rust-runtime/aws-smithy-xml/tests/handwritten_parsers.rs @@ -44,6 +44,7 @@ fn deserialize_xml_attribute(inp: &str) -> Result { let mut doc = Document::new(inp); let mut root = doc.root_element()?; #[allow(unused_assignments)] + #[allow(clippy::blacklisted_name)] let mut foo: Option = None; let mut bar: Option = None; foo = root.start_el().attr("foo").map(|attr| attr.to_string()); diff --git a/tools/Dockerfile b/tools/Dockerfile index 9d8c0b963b..b2f11d4d90 100644 --- a/tools/Dockerfile +++ b/tools/Dockerfile @@ -45,7 +45,7 @@ RUN set -eux; \ # Rust & Tools Installation Stage # FROM bare_base_image AS install_rust -ARG rust_stable_version=1.61.0 +ARG rust_stable_version=1.62.0 ARG rust_nightly_version=nightly-2022-07-25 ARG cargo_deny_version=0.12.2 ARG cargo_udeps_version=0.1.29 @@ -117,7 +117,7 @@ RUN set -eux; \ # Final image # FROM bare_base_image AS final_image -ARG rust_stable_version=1.61.0 +ARG rust_stable_version=1.62.0 ARG rust_nightly_version=nightly-2022-07-25 RUN set -eux; \ yum -y updateinfo; \ diff --git a/tools/changelogger/src/render.rs b/tools/changelogger/src/render.rs index 0a61b3609c..9bb8e765a4 100644 --- a/tools/changelogger/src/render.rs +++ b/tools/changelogger/src/render.rs @@ -377,7 +377,10 @@ fn render(entries: &[ChangelogEntry], release_header: &str) -> (String, String) out.push_str("- @"); out.push_str(&contributor_handle); if !contribution_references.is_empty() { - out.push_str(&format!(" ({})", contribution_references)); + write!(&mut out, " ({})", contribution_references) + // The `Write` implementation for `String` is infallible, + // see https://doc.rust-lang.org/src/alloc/string.rs.html#2815 + .unwrap() } out.push('\n'); } diff --git a/tools/ci-cdk/canary-lambda/src/canary.rs b/tools/ci-cdk/canary-lambda/src/canary.rs index 242c9f0c07..d46345a32d 100644 --- a/tools/ci-cdk/canary-lambda/src/canary.rs +++ b/tools/ci-cdk/canary-lambda/src/canary.rs @@ -20,7 +20,7 @@ macro_rules! mk_canary { pub(crate) fn mk_canary( clients: &Clients, env: &CanaryEnv, - ) -> Option<(&'static str, crate::canary::CanaryFuture)> { + ) -> Option<(&'static str, $crate::canary::CanaryFuture)> { Some(($name, Box::pin($run_canary(clients, env)))) } }; diff --git a/tools/crate-hasher/src/file_list.rs b/tools/crate-hasher/src/file_list.rs index a7b10f39eb..03f6090cb6 100644 --- a/tools/crate-hasher/src/file_list.rs +++ b/tools/crate-hasher/src/file_list.rs @@ -5,6 +5,7 @@ use anyhow::{Context, Result}; use std::collections::BTreeSet; +use std::fmt::Write; use std::fs::Metadata; use std::path::Path; @@ -84,7 +85,7 @@ impl FileMetadata { /// Returns a string to hash for this file fn hash_entry(&self) -> String { let mut entry = String::with_capacity(7 + self.path.len() + 1 + self.sha256.len() + 1); - entry.push_str(&format!("{:06o} ", self.mode)); + write!(&mut entry, "{:06o} ", self.mode).unwrap(); entry.push_str(&self.path); entry.push(' '); entry.push_str(&self.sha256); diff --git a/tools/publisher/src/cargo/publish.rs b/tools/publisher/src/cargo/publish.rs index a8a08a6cdc..71e79e3814 100644 --- a/tools/publisher/src/cargo/publish.rs +++ b/tools/publisher/src/cargo/publish.rs @@ -71,7 +71,7 @@ mod tests { "aws-sdk-dynamodb", Version::parse("0.0.22-alpha").unwrap(), ), - package_path: env::current_dir().unwrap().into(), + package_path: env::current_dir().unwrap(), } .spawn() .await @@ -86,7 +86,7 @@ mod tests { "something", Version::parse("0.0.22-alpha").unwrap(), ), - package_path: env::current_dir().unwrap().into(), + package_path: env::current_dir().unwrap(), } .spawn() .await; @@ -108,7 +108,7 @@ mod tests { "aws-sdk-dynamodb", Version::parse("0.0.22-alpha").unwrap(), ), - package_path: env::current_dir().unwrap().into(), + package_path: env::current_dir().unwrap(), } .spawn() .await diff --git a/tools/publisher/src/package.rs b/tools/publisher/src/package.rs index 4777e0a8a3..2cc13df3ad 100644 --- a/tools/publisher/src/package.rs +++ b/tools/publisher/src/package.rs @@ -386,7 +386,7 @@ mod tests { let error = format!( "{}", - read_package(&path, manifest).err().expect("should fail") + read_package(&path, manifest).expect_err("should fail") ); assert!( error.contains("Invalid crate version"), @@ -517,8 +517,7 @@ mod tests { &[("C", "1.2.0"), ("D", "1.3.0"), ("F", "1.4.0")], ), ]) - .err() - .expect("fail"); + .expect_err("fail"); assert_eq!( "crate A has multiple versions: 1.1.0 and 1.0.0", format!("{}", error) diff --git a/tools/publisher/src/sort.rs b/tools/publisher/src/sort.rs index cff1d21ad5..a6da808a4e 100644 --- a/tools/publisher/src/sort.rs +++ b/tools/publisher/src/sort.rs @@ -120,7 +120,7 @@ mod tests { package("C", &["B"]), ]; - let error = dependency_order(packages).err().expect("cycle"); + let error = dependency_order(packages).expect_err("cycle"); assert_eq!("dependency cycle detected", format!("{}", error)); } diff --git a/tools/publisher/src/subcommand/publish.rs b/tools/publisher/src/subcommand/publish.rs index a2fdc171fb..58cc9ea833 100644 --- a/tools/publisher/src/subcommand/publish.rs +++ b/tools/publisher/src/subcommand/publish.rs @@ -126,7 +126,7 @@ async fn is_published(handle: &PackageHandle) -> Result { 3, Duration::from_secs(5), || async { - let expected_version = (&handle.version).to_string(); + let expected_version = handle.version.to_string(); let crate_info = match CRATES_IO_CLIENT.get_crate(&handle.name).await { Ok(info) => info, Err(Error::NotFound(_)) => return Ok(false), @@ -260,9 +260,9 @@ mod test { #[tokio::test] async fn crate_published_works() { let handle = PackageHandle::new("aws-smithy-http", "0.27.0-alpha.1".parse().unwrap()); - assert_eq!(is_published(&handle).await.expect("failed"), true); + assert!(is_published(&handle).await.expect("failed")); // we will never publish this version let handle = PackageHandle::new("aws-smithy-http", "0.21.0-alpha.1".parse().unwrap()); - assert_eq!(is_published(&handle).await.expect("failed"), false); + assert!(!is_published(&handle).await.expect("failed")); } } diff --git a/tools/publisher/src/subcommand/tag_versions_manifest.rs b/tools/publisher/src/subcommand/tag_versions_manifest.rs index dfc52c7f57..ebd05d9910 100644 --- a/tools/publisher/src/subcommand/tag_versions_manifest.rs +++ b/tools/publisher/src/subcommand/tag_versions_manifest.rs @@ -86,7 +86,7 @@ mod tests { .unwrap(); let expected = { - let mut expected = original.clone(); + let mut expected = original; expected.release.as_mut().unwrap().tag = Some("some-release-tag".to_string()); expected }; diff --git a/tools/sdk-lints/src/copyright.rs b/tools/sdk-lints/src/copyright.rs index 04b61a59ce..5645fb6590 100644 --- a/tools/sdk-lints/src/copyright.rs +++ b/tools/sdk-lints/src/copyright.rs @@ -55,7 +55,7 @@ fn check_copyright_header(path: impl AsRef) -> Vec { path.as_ref().display() ))]; } - return vec![]; + vec![] } fn needs_copyright_header(path: &Path) -> bool { diff --git a/tools/sdk-sync/src/sync.rs b/tools/sdk-sync/src/sync.rs index aa2fd6fc65..1512bd0909 100644 --- a/tools/sdk-sync/src/sync.rs +++ b/tools/sdk-sync/src/sync.rs @@ -10,6 +10,7 @@ use anyhow::{bail, Context, Result}; use smithy_rs_tool_common::git::{Commit, CommitHash, Git, GitCLI}; use smithy_rs_tool_common::macros::here; use std::collections::BTreeSet; +use std::fmt::Write; use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::mpsc::{Sender, TryRecvError}; @@ -405,7 +406,7 @@ impl Sync { .map(|c| format!("{} <{}>", c.author_name, c.author_email)) .collect(); for author in authors { - commit_message.push_str(&format!("Co-authored-by: {}\n", author)); + writeln!(&mut commit_message, "Co-authored-by: {}", author).unwrap(); } commit_message } diff --git a/tools/smithy-rs-tool-common/src/git.rs b/tools/smithy-rs-tool-common/src/git.rs index b22543f0ab..b1b34aa263 100644 --- a/tools/smithy-rs-tool-common/src/git.rs +++ b/tools/smithy-rs-tool-common/src/git.rs @@ -7,7 +7,7 @@ use crate::shell::{handle_failure, output_text}; use anyhow::{bail, Context, Result}; use std::borrow::Cow; use std::ffi::OsStr; -use std::fmt; +use std::fmt::{self, Write}; use std::path::{Path, PathBuf}; use std::process::Command; use tracing::debug; @@ -415,7 +415,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() { - message.push_str(&format!("[in {:?}]: ", cwd)); + write!(&mut message, "[in {:?}]: ", cwd).unwrap(); } message.push_str(command.get_program().to_str().expect("valid str")); for arg in command.get_args() {