Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update crates to Rust 2021 #1388

Merged
merged 1 commit into from
May 13, 2022
Merged

Update crates to Rust 2021 #1388

merged 1 commit into from
May 13, 2022

Conversation

82marbag
Copy link
Contributor

Generate crates using Rust 2021 instead of Rust 2018
Remove use std::convert::TryFrom which is in the prelude

Closes #1332

Signed-off-by: Daniele Ahmed [email protected]

Motivation and Context

Description

Testing

./gradlew :codegen-server-test:test

Checklist

  • I have updated CHANGELOG.next.toml if I made changes to the smithy-rs codegen or runtime crates
  • I have updated CHANGELOG.next.toml if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@82marbag 82marbag requested review from a team as code owners May 13, 2022 08:08
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Rust Wrk benchmark report:

Duration: 90 sec, Connections: 32, Threads: 2

Measurement Deviation Current Old
Requests/sec 4.50% 75581.38 72329.05
Total requests 4.49% 6807684 6515086
Total errors NaN% 0 0
Total successes 4.49% 6807684 6515086
Average latency ms 25.93% 0.68 0.54
Minimum latency ms 0.00% 0.02 0.02
Maximum latency ms -10.97% 21.74 24.42
Stdev latency ms 45.07% 1.03 0.71
Transfer Mb 4.49% 707.66 677.25
Connect errors NaN% 0 0
Read errors NaN% 0 0
Write errors NaN% 0 0
Status errors (not 2xx/3xx) NaN% 0 0
Timeout errors NaN% 0 0

Copy link
Contributor

@david-perez david-perez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

There are also some usages of TryFrom and TryInto in the runtime. It's weird that Clippy is not making the suggestion to remove the imports, since since #1268 the runtime uses the 2021 edition.

We can remove those in another PR.

➜  SmithyRsSource git:(1332) ✗ rg "TryFrom|TryInto"
rust-runtime/inlineable/src/ec2_query_errors.rs
7:use std::convert::TryFrom;
75:    use std::convert::TryFrom;

rust-runtime/inlineable/src/rest_xml_wrapped_errors.rs
7:use std::convert::TryFrom;
67:    use std::convert::TryFrom;

rust-runtime/aws-smithy-http-tower/src/lib.rs
67:    use std::convert::{Infallible, TryInto};

rust-runtime/aws-smithy-xml/src/decode.rs
169:impl<'a> TryFrom<&'a [u8]> for Document<'a> {

rust-runtime/aws-smithy-http/src/header.rs
9:use std::convert::TryFrom;
152:    HeaderValue: TryFrom<V>,
153:    <HeaderValue as TryFrom<V>>::Error: Into<http::Error>,
172:    HeaderValue: TryFrom<V>,
173:    <HeaderValue as TryFrom<V>>::Error: Into<http::Error>,

rust-runtime/aws-smithy-eventstream/src/str_bytes.rs
9:use std::convert::TryFrom;
30:/// use std::convert::TryInto;
93:impl TryFrom<&'static [u8]> for StrBytes {
104:impl TryFrom<Vec<u8>> for StrBytes {
115:impl TryFrom<Bytes> for StrBytes {
130:    use std::convert::TryInto;

rust-runtime/aws-smithy-eventstream/src/frame.rs
13:use std::convert::{TryFrom, TryInto};
67:    use std::convert::TryInto;
503:fn checked<T: TryFrom<U>, U>(from: U, err: Error) -> Result<T, Error> {

rust-runtime/inlineable/src/rest_xml_unwrapped_errors.rs
10:use std::convert::TryFrom;

aws/rust-runtime/aws-http/src/user_agent.rs
14:use std::convert::TryFrom;

aws/rust-runtime/aws-config/src/sso.rs
27:use std::convert::TryInto;

aws/rust-runtime/aws-config/src/json_credentials.rs
11:use std::convert::TryFrom;

rust-runtime/aws-smithy-types/src/date_time/mod.rs
10:use std::convert::TryFrom;
38:/// use std::convert::TryFrom;
248:impl TryFrom<DateTime> for SystemTime {
330:    use std::convert::TryFrom;

aws/rust-runtime/aws-config/src/sts/util.rs
10:use std::convert::TryFrom;

aws/rust-runtime/aws-sigv4/src/http_request/sign.rs
17:use std::convert::TryFrom;

aws/rust-runtime/aws-sigv4/src/http_request/canonical_request.rs
17:use std::convert::TryFrom;

rust-runtime/aws-smithy-http-server/examples/pokemon_service/src/lib.rs
12:    convert::TryInto,

aws/rust-runtime/aws-config/src/imds/client.rs
11:use std::convert::TryFrom;

codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/ServerHttpBoundProtocolGenerator.kt
563:                let http_status: u16 = TryFrom::<i32>::try_from(status)

Generate crates using Rust 2021 instead of Rust 2018
Remove use std::convert::TryFrom which is in the prelude

Closes #1332

Signed-off-by: Daniele Ahmed <[email protected]>
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Rust Wrk benchmark report:

Duration: 90 sec, Connections: 32, Threads: 2

Measurement Deviation Current Old
Requests/sec -2.74% 75992.38 78130.66
Total requests -2.81% 6840703 7038252
Total errors NaN% 0 0
Total successes -2.81% 6840703 7038252
Average latency ms -13.79% 0.75 0.87
Minimum latency ms 0.00% 0.02 0.02
Maximum latency ms -10.75% 18.27 20.47
Stdev latency ms -17.24% 1.2 1.45
Transfer Mb -2.81% 711.09 731.63
Connect errors NaN% 0 0
Read errors NaN% 0 0
Write errors NaN% 0 0
Status errors (not 2xx/3xx) NaN% 0 0
Timeout errors NaN% 0 0

Copy link
Contributor

@crisidev crisidev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Collaborator

@rcoh rcoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@82marbag 82marbag merged commit 154c5d1 into main May 13, 2022
@82marbag 82marbag deleted the 1332 branch May 13, 2022 13:28
david-perez added a commit that referenced this pull request Sep 12, 2022
We've long migrated to the 2021 edition everywhere. See PRs #1388, #1328,
and #1268.

See issue #1332 too.
david-perez added a commit that referenced this pull request Sep 13, 2022
We've long migrated to the 2021 edition everywhere. See PRs #1388, #1328,
and #1268.

See issue #1332 too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate crates with Rust 2021 edition
4 participants