chore: upgrade remaining 2018 edition crates to 2021 edition (#5788)

This commit is contained in:
Taiki Endo
2023-06-12 02:21:50 +09:00
committed by GitHub
parent 6257712d68
commit af6c87a045
12 changed files with 15 additions and 16 deletions
+2 -2
View File
@@ -495,8 +495,8 @@ jobs:
- name: "rustfmt --check" - name: "rustfmt --check"
# Workaround for rust-lang/cargo#7732 # Workaround for rust-lang/cargo#7732
run: | run: |
if ! rustfmt --check --edition 2018 $(git ls-files '*.rs'); then if ! rustfmt --check --edition 2021 $(git ls-files '*.rs'); then
printf "Please run \`rustfmt --edition 2018 \$(git ls-files '*.rs')\` to fix rustfmt errors.\nSee CONTRIBUTING.md for more details.\n" >&2 printf "Please run \`rustfmt --edition 2021 \$(git ls-files '*.rs')\` to fix rustfmt errors.\nSee CONTRIBUTING.md for more details.\n" >&2
exit 1 exit 1
fi fi
+4 -4
View File
@@ -173,10 +173,10 @@ command below instead:
``` ```
# Mac or Linux # Mac or Linux
rustfmt --check --edition 2018 $(git ls-files '*.rs') rustfmt --check --edition 2021 $(git ls-files '*.rs')
# Powershell # Powershell
Get-ChildItem . -Filter "*.rs" -Recurse | foreach { rustfmt --check --edition 2018 $_.FullName } Get-ChildItem . -Filter "*.rs" -Recurse | foreach { rustfmt --check --edition 2021 $_.FullName }
``` ```
The `--check` argument prints the things that need to be fixed. If you remove The `--check` argument prints the things that need to be fixed. If you remove
it, `rustfmt` will update your files locally instead. it, `rustfmt` will update your files locally instead.
@@ -230,7 +230,7 @@ integration tests in the crate and follow the style.
Some of our crates include a set of fuzz tests, this will be marked by a Some of our crates include a set of fuzz tests, this will be marked by a
directory `fuzz`. It is a good idea to run fuzz tests after each change. directory `fuzz`. It is a good idea to run fuzz tests after each change.
To get started with fuzz testing you'll need to install To get started with fuzz testing you'll need to install
[cargo-fuzz](https://github.com/rust-fuzz/cargo-fuzz). [cargo-fuzz](https://github.com/rust-fuzz/cargo-fuzz).
`cargo install cargo-fuzz` `cargo install cargo-fuzz`
@@ -678,4 +678,4 @@ When releasing a new version of a crate, follow these steps:
[unit-tests]: https://doc.rust-lang.org/rust-by-example/testing/unit_testing.html [unit-tests]: https://doc.rust-lang.org/rust-by-example/testing/unit_testing.html
[integration-tests]: https://doc.rust-lang.org/rust-by-example/testing/integration_testing.html [integration-tests]: https://doc.rust-lang.org/rust-by-example/testing/integration_testing.html
[documentation-tests]: https://doc.rust-lang.org/rust-by-example/testing/doc_testing.html [documentation-tests]: https://doc.rust-lang.org/rust-by-example/testing/doc_testing.html
[conditional-compilation]: https://doc.rust-lang.org/reference/conditional-compilation.html [conditional-compilation]: https://doc.rust-lang.org/reference/conditional-compilation.html
+1 -1
View File
@@ -2,7 +2,7 @@
name = "benches" name = "benches"
version = "0.0.0" version = "0.0.0"
publish = false publish = false
edition = "2018" edition = "2021"
[features] [features]
test-util = ["tokio/test-util"] test-util = ["tokio/test-util"]
+1 -1
View File
@@ -2,7 +2,7 @@
name = "examples" name = "examples"
version = "0.0.0" version = "0.0.0"
publish = false publish = false
edition = "2018" edition = "2021"
# If you copy one of the examples into a new project, you should be using # If you copy one of the examples into a new project, you should be using
# [dependencies] instead, and delete the **path**. # [dependencies] instead, and delete the **path**.
+1 -1
View File
@@ -18,7 +18,7 @@ use futures::SinkExt;
use http::{header::HeaderValue, Request, Response, StatusCode}; use http::{header::HeaderValue, Request, Response, StatusCode};
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
use std::{convert::TryFrom, env, error::Error, fmt, io}; use std::{env, error::Error, fmt, io};
use tokio::net::{TcpListener, TcpStream}; use tokio::net::{TcpListener, TcpStream};
use tokio_stream::StreamExt; use tokio_stream::StreamExt;
use tokio_util::codec::{Decoder, Encoder, Framed}; use tokio_util::codec::{Decoder, Encoder, Framed};
+1 -1
View File
@@ -2,7 +2,7 @@
name = "stress-test" name = "stress-test"
version = "0.1.0" version = "0.1.0"
authors = ["Tokio Contributors <[email protected]>"] authors = ["Tokio Contributors <[email protected]>"]
edition = "2018" edition = "2021"
publish = false publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+1 -1
View File
@@ -2,7 +2,7 @@
name = "tests-build" name = "tests-build"
version = "0.1.0" version = "0.1.0"
authors = ["Tokio Contributors <[email protected]>"] authors = ["Tokio Contributors <[email protected]>"]
edition = "2018" edition = "2021"
publish = false publish = false
[features] [features]
+1 -1
View File
@@ -2,7 +2,7 @@
name = "tests-integration" name = "tests-integration"
version = "0.1.0" version = "0.1.0"
authors = ["Tokio Contributors <[email protected]>"] authors = ["Tokio Contributors <[email protected]>"]
edition = "2018" edition = "2021"
publish = false publish = false
[[bin]] [[bin]]
-1
View File
@@ -7,7 +7,6 @@ use tokio::process::{Child, Command};
use tokio_test::assert_ok; use tokio_test::assert_ok;
use futures::future::{self, FutureExt}; use futures::future::{self, FutureExt};
use std::convert::TryInto;
use std::env; use std::env;
use std::io; use std::io;
use std::process::{ExitStatus, Stdio}; use std::process::{ExitStatus, Stdio};
+1 -1
View File
@@ -5,7 +5,7 @@ name = "tokio-macros"
# - Update CHANGELOG.md. # - Update CHANGELOG.md.
# - Create "tokio-macros-1.x.y" git tag. # - Create "tokio-macros-1.x.y" git tag.
version = "2.1.0" version = "2.1.0"
edition = "2018" edition = "2021"
rust-version = "1.56" rust-version = "1.56"
authors = ["Tokio Contributors <[email protected]>"] authors = ["Tokio Contributors <[email protected]>"]
license = "MIT" license = "MIT"
+1 -1
View File
@@ -2,7 +2,7 @@
name = "tokio-stream-fuzz" name = "tokio-stream-fuzz"
version = "0.0.0" version = "0.0.0"
publish = false publish = false
edition = "2018" edition = "2021"
[package.metadata] [package.metadata]
cargo-fuzz = true cargo-fuzz = true
+1 -1
View File
@@ -2,7 +2,7 @@
name = "tokio-fuzz" name = "tokio-fuzz"
version = "0.0.0" version = "0.0.0"
publish = false publish = false
edition = "2018" edition = "2021"
[package.metadata] [package.metadata]
cargo-fuzz = true cargo-fuzz = true