diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d59e28c0d63d1b456c1cfba64df913005b9759f5..3c34a479d2055246643bef6d685931cd3e8f7f68 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,7 +8,7 @@ on: name: CI env: - rust_version: 1.52.1 + rust_version: 1.53.0 rust_toolchain_components: clippy,rustfmt java_version: 11 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f7415d01d66cf37e5313e81da69bdaf149a5640..91314d2e696c56d92fd7df55dc36437b9de03b98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ vNext (Month Day, Year) ======================= +**Breaking changes** +- :warning: MSRV increased from 1.52.1 to 1.53.0 per our 3-behind MSRV policy. + +**New this week** - :bug: Fix an issue where `smithy-xml` may have generated invalid XML (smithy-rs#719) v0.24 (September 24th, 2021) diff --git a/aws/SDK_CHANGELOG.md b/aws/SDK_CHANGELOG.md index cc910f67671642f1958ae3d472bb834cd9c07518..a421546fca621d791f0a10d6fb29509ed2d25b8c 100644 --- a/aws/SDK_CHANGELOG.md +++ b/aws/SDK_CHANGELOG.md @@ -1,5 +1,10 @@ vNext (Month Day, Year) ======================= +**Breaking changes** +- :warning: MSRV increased from 1.52.1 to 1.53.0 per our 3-behind MSRV policy. + +**Tasks to cut release** +- [ ] Bump MSRV on aws-sdk-rust, then delete this line. v0.0.19-alpha (September 24th, 2021) ==================================== diff --git a/aws/rust-runtime/aws-config/src/meta/credentials/chain.rs b/aws/rust-runtime/aws-config/src/meta/credentials/chain.rs index 9e053ea09004ace57a985dcf7b3fe060f520c699..b37a1da62726d33a8fad0b8da65298d2d4dae4d9 100644 --- a/aws/rust-runtime/aws-config/src/meta/credentials/chain.rs +++ b/aws/rust-runtime/aws-config/src/meta/credentials/chain.rs @@ -90,7 +90,7 @@ impl CredentialsProviderChain { } } } - return Err(CredentialsError::CredentialsNotLoaded); + Err(CredentialsError::CredentialsNotLoaded) } } diff --git a/aws/rust-runtime/aws-config/src/profile/credentials/exec.rs b/aws/rust-runtime/aws-config/src/profile/credentials/exec.rs index f8fc8b8fb5dcb7da3feeed2c14e38a3bf404c6db..ef50a8e8b3e329c16948c8b523c6699f80c05b9d 100644 --- a/aws/rust-runtime/aws-config/src/profile/credentials/exec.rs +++ b/aws/rust-runtime/aws-config/src/profile/credentials/exec.rs @@ -151,12 +151,10 @@ pub mod named { } fn lower_cow(mut inp: Cow) -> Cow { - if inp.chars().all(|c| c.is_ascii_lowercase()) { - inp - } else { + if !inp.chars().all(|c| c.is_ascii_lowercase()) { inp.to_mut().make_ascii_lowercase(); - inp } + inp } impl NamedProviderFactory { diff --git a/aws/rust-runtime/aws-types/src/os_shim_internal.rs b/aws/rust-runtime/aws-types/src/os_shim_internal.rs index 2de9e19b615c4ae36d5a02297cbe47b4c9e3378e..8bb19554a796e413431367724934761cd40e45f3 100644 --- a/aws/rust-runtime/aws-types/src/os_shim_internal.rs +++ b/aws/rust-runtime/aws-types/src/os_shim_internal.rs @@ -261,7 +261,6 @@ impl Default for TimeSource { /// let client = Client::with_timesource(TimeSource::manual(&time)); /// time.advance(Duration::from_secs(100)); /// ``` -/// ``` #[derive(Clone, Debug)] pub struct ManualTimeSource { queries: Arc>>, diff --git a/aws/rust-runtime/aws-types/src/region.rs b/aws/rust-runtime/aws-types/src/region.rs index 821f21c19e2b000e19f68c15727a923ea2832601..c1c21ae8c609ca03e35472aadf3b48dce8653287 100644 --- a/aws/rust-runtime/aws-types/src/region.rs +++ b/aws/rust-runtime/aws-types/src/region.rs @@ -12,7 +12,7 @@ use std::fmt::{Display, Formatter}; /// per-client basis unless otherwise noted. A full list of regions is found in the /// "Regions and Endpoints" document. /// -/// See http://docs.aws.amazon.com/general/latest/gr/rande.html for +/// See for /// information on AWS regions. #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct Region( diff --git a/aws/sdk/examples/dynamodb/src/bin/movies.rs b/aws/sdk/examples/dynamodb/src/bin/movies.rs index 5751e4ac900b522f67456d62a1bdda6d3c522816..a6abb7108f8a28a50a47777412ea3a5299bbeec8 100644 --- a/aws/sdk/examples/dynamodb/src/bin/movies.rs +++ b/aws/sdk/examples/dynamodb/src/bin/movies.rs @@ -40,7 +40,8 @@ struct Opt { verbose: bool, } -/// A partial reimplementation of https://docs.amazonaws.cn/en_us/amazondynamodb/latest/developerguide/GettingStarted.Ruby.html +/// A partial reimplementation of +/// /// in Rust /// /// - Create table diff --git a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customizations/AllowClippyLintsGenerator.kt b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customizations/AllowLintsGenerator.kt similarity index 79% rename from codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customizations/AllowClippyLintsGenerator.kt rename to codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customizations/AllowLintsGenerator.kt index c1bdd101e2b19eb617d0ee15cf866df41524351a..8014f80baea2a47f80ce9f86bdaf2caea0e5746c 100644 --- a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customizations/AllowClippyLintsGenerator.kt +++ b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customizations/AllowLintsGenerator.kt @@ -33,12 +33,21 @@ val ClippyAllowLints = listOf( "vec_init_then_push", ) -class AllowClippyLints : LibRsCustomization() { +val AllowDocsLints = listOf( + // Rust >=1.53.0 requires links to be wrapped in ``. This is extremely hard to enforce for + // docs that come from the modeled documentation, so we need to disable this lint + "bare_urls" +) + +class AllowLintsGenerator : LibRsCustomization() { override fun section(section: LibRsSection) = when (section) { is LibRsSection.Attributes -> writable { ClippyAllowLints.forEach { Attribute.Custom("allow(clippy::$it)", container = true).render(this) } + AllowDocsLints.forEach { + Attribute.Custom("allow(rustdoc::$it)", container = true).render(this) + } // add a newline at the end this.write("") } diff --git a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customize/RequiredCustomizations.kt b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customize/RequiredCustomizations.kt index 847348e2c7413b11681a32dde1c38c012d3d69a5..b60f2f697f7227ef768db94c601cfba33a13af23 100644 --- a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customize/RequiredCustomizations.kt +++ b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/customize/RequiredCustomizations.kt @@ -6,7 +6,7 @@ package software.amazon.smithy.rust.codegen.smithy.customize import software.amazon.smithy.model.shapes.OperationShape -import software.amazon.smithy.rust.codegen.smithy.customizations.AllowClippyLints +import software.amazon.smithy.rust.codegen.smithy.customizations.AllowLintsGenerator import software.amazon.smithy.rust.codegen.smithy.customizations.CrateVersionGenerator import software.amazon.smithy.rust.codegen.smithy.customizations.EndpointPrefixGenerator import software.amazon.smithy.rust.codegen.smithy.customizations.HttpChecksumRequiredGenerator @@ -38,6 +38,6 @@ class RequiredCustomizations : RustCodegenDecorator { protocolConfig: ProtocolConfig, baseCustomizations: List ): List { - return baseCustomizations + CrateVersionGenerator() + SmithyTypesPubUseGenerator(protocolConfig.runtimeConfig) + AllowClippyLints() + return baseCustomizations + CrateVersionGenerator() + SmithyTypesPubUseGenerator(protocolConfig.runtimeConfig) + AllowLintsGenerator() } } diff --git a/rust-runtime/smithy-types/src/instant/mod.rs b/rust-runtime/smithy-types/src/instant/mod.rs index 3274ac9cca06d9a8b47cb661bddd1b460cb3c10f..007b4c0ddfda7d61553fc3aad91b1edf16f56592 100644 --- a/rust-runtime/smithy-types/src/instant/mod.rs +++ b/rust-runtime/smithy-types/src/instant/mod.rs @@ -100,11 +100,11 @@ impl Instant { } #[cfg(feature = "chrono-conversions")] - pub fn to_chrono(&self) -> DateTime { + pub fn to_chrono(self) -> DateTime { self.to_chrono_internal() } - fn to_chrono_internal(&self) -> DateTime { + fn to_chrono_internal(self) -> DateTime { DateTime::::from_utc( NaiveDateTime::from_timestamp(self.seconds, self.subsecond_nanos), Utc, @@ -115,7 +115,7 @@ impl Instant { /// /// Since SystemTime cannot represent times prior to the unix epoch, if this time is before /// 1/1/1970, this function will return `None`. - pub fn to_system_time(&self) -> Option { + pub fn to_system_time(self) -> Option { if self.seconds < 0 { None } else { @@ -146,7 +146,7 @@ impl Instant { /// Converts the `Instant` to the number of milliseconds since the Unix epoch. /// This is fallible since `Instant` holds more precision than an `i64`, and will /// return a `ConversionError` for `Instant` values that can't be converted. - pub fn to_epoch_millis(&self) -> Result { + pub fn to_epoch_millis(self) -> Result { let subsec_millis = Integer::div_floor(&i64::from(self.subsecond_nanos), &(NANOS_PER_MILLI as i64)); if self.seconds < 0 { diff --git a/rust-runtime/smithy-types/src/lib.rs b/rust-runtime/smithy-types/src/lib.rs index 1bcfd42c1d1fa6dd10bf4e8d41f3bcaead27d16f..fd8082cf76953df5140c7d2c4e2e182ca89eea2a 100644 --- a/rust-runtime/smithy-types/src/lib.rs +++ b/rust-runtime/smithy-types/src/lib.rs @@ -53,7 +53,7 @@ pub enum Document { } /// A number type that implements Javascript / JSON semantics, modeled on serde_json: -/// https://docs.serde.rs/src/serde_json/number.rs.html#20-22 +/// #[derive(Debug, Clone, Copy, PartialEq)] pub enum Number { PosInt(u64), @@ -64,11 +64,11 @@ pub enum Number { macro_rules! to_num_fn { ($name:ident, $typ:ident) => { /// Converts to a `$typ`. This conversion may be lossy. - pub fn $name(&self) -> $typ { + pub fn $name(self) -> $typ { match self { - Number::PosInt(val) => *val as $typ, - Number::NegInt(val) => *val as $typ, - Number::Float(val) => *val as $typ, + Number::PosInt(val) => val as $typ, + Number::NegInt(val) => val as $typ, + Number::Float(val) => val as $typ, } } };