From 8e31bbbe551e95a40a78fd96671916f917218b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 2 Nov 2021 15:03:37 +0100 Subject: [PATCH] chore: update to Rust edition 2021 (#12578) --- .rustfmt.toml | 2 +- bench_util/Cargo.toml | 2 +- cli/Cargo.toml | 2 +- cli/standalone.rs | 1 - core/Cargo.toml | 2 +- core/bindings.rs | 2 -- core/error.rs | 2 -- core/examples/http_bench_json_ops.rs | 1 - core/modules.rs | 1 - core/runtime.rs | 1 - ext/broadcast_channel/Cargo.toml | 2 +- ext/console/Cargo.toml | 2 +- ext/crypto/Cargo.toml | 2 +- ext/crypto/lib.rs | 2 -- ext/fetch/Cargo.toml | 2 +- ext/ffi/Cargo.toml | 2 +- ext/ffi/lib.rs | 1 - ext/http/Cargo.toml | 2 +- ext/net/Cargo.toml | 2 +- ext/timers/Cargo.toml | 2 +- ext/tls/Cargo.toml | 2 +- ext/url/Cargo.toml | 2 +- ext/web/Cargo.toml | 2 +- ext/webgpu/Cargo.toml | 2 +- ext/webgpu/binding.rs | 1 - ext/webgpu/bundle.rs | 1 - ext/webgpu/pipeline.rs | 1 - ext/webgpu/texture.rs | 2 -- ext/webidl/Cargo.toml | 2 +- ext/websocket/Cargo.toml | 2 +- ext/webstorage/Cargo.toml | 2 +- runtime/Cargo.toml | 2 +- runtime/ops/process.rs | 1 - serde_v8/Cargo.toml | 2 +- serde_v8/benches/de.rs | 2 -- serde_v8/src/de.rs | 2 -- serde_v8/src/ser.rs | 1 - serde_v8/tests/magic.rs | 1 - test_ffi/Cargo.toml | 2 +- test_util/Cargo.toml | 2 +- 40 files changed, 23 insertions(+), 46 deletions(-) diff --git a/.rustfmt.toml b/.rustfmt.toml index 00157aef26..7d282f4f0b 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,4 +1,4 @@ # Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. max_width = 80 tab_spaces = 2 -edition = "2018" +edition = "2021" diff --git a/bench_util/Cargo.toml b/bench_util/Cargo.toml index ba246cb756..b8a28b50bd 100644 --- a/bench_util/Cargo.toml +++ b/bench_util/Cargo.toml @@ -3,7 +3,7 @@ name = "deno_bench_util" version = "0.17.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" publish = true readme = "README.md" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 99840d8b0f..2e180a494f 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -5,7 +5,7 @@ name = "deno" version = "1.15.3" authors = ["the Deno authors"] default-run = "deno" -edition = "2018" +edition = "2021" license = "MIT" repository = "https://github.com/denoland/deno" description = "Provides the deno executable" diff --git a/cli/standalone.rs b/cli/standalone.rs index 819ba10a49..e0190920f2 100644 --- a/cli/standalone.rs +++ b/cli/standalone.rs @@ -29,7 +29,6 @@ use deno_runtime::worker::WorkerOptions; use deno_runtime::BootstrapOptions; use deno_tls::create_default_root_cert_store; use log::Level; -use std::convert::TryInto; use std::env::current_exe; use std::fs::File; use std::io::BufReader; diff --git a/core/Cargo.toml b/core/Cargo.toml index 089826ec6d..0d31029888 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -3,7 +3,7 @@ name = "deno_core" version = "0.105.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/core/bindings.rs b/core/bindings.rs index 2ba8059a0a..d1b01c2d99 100644 --- a/core/bindings.rs +++ b/core/bindings.rs @@ -17,8 +17,6 @@ use serde::Deserialize; use serde::Serialize; use serde_v8::to_v8; use std::cell::RefCell; -use std::convert::TryFrom; -use std::convert::TryInto; use std::option::Option; use url::Url; use v8::HandleScope; diff --git a/core/error.rs b/core/error.rs index b94b7f192b..793a42603f 100644 --- a/core/error.rs +++ b/core/error.rs @@ -4,8 +4,6 @@ pub use anyhow::anyhow; pub use anyhow::bail; pub use anyhow::Context; use std::borrow::Cow; -use std::convert::TryFrom; -use std::convert::TryInto; use std::error::Error; use std::fmt; use std::fmt::Debug; diff --git a/core/examples/http_bench_json_ops.rs b/core/examples/http_bench_json_ops.rs index 5989a472fb..749f404850 100644 --- a/core/examples/http_bench_json_ops.rs +++ b/core/examples/http_bench_json_ops.rs @@ -10,7 +10,6 @@ use deno_core::Resource; use deno_core::ResourceId; use deno_core::ZeroCopyBuf; use std::cell::RefCell; -use std::convert::TryFrom; use std::env; use std::io::Error; use std::net::SocketAddr; diff --git a/core/modules.rs b/core/modules.rs index ba7db507e1..dc2e5bb321 100644 --- a/core/modules.rs +++ b/core/modules.rs @@ -16,7 +16,6 @@ use std::cell::RefCell; use std::collections::HashMap; use std::collections::HashSet; use std::collections::VecDeque; -use std::convert::TryFrom; use std::future::Future; use std::pin::Pin; use std::rc::Rc; diff --git a/core/runtime.rs b/core/runtime.rs index 327662e7c5..80221295da 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -29,7 +29,6 @@ use futures::task::AtomicWaker; use std::any::Any; use std::cell::RefCell; use std::collections::HashMap; -use std::convert::TryFrom; use std::ffi::c_void; use std::mem::forget; use std::option::Option; diff --git a/ext/broadcast_channel/Cargo.toml b/ext/broadcast_channel/Cargo.toml index 6e6aa7421a..d200eb26bd 100644 --- a/ext/broadcast_channel/Cargo.toml +++ b/ext/broadcast_channel/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_broadcast_channel" version = "0.17.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/ext/console/Cargo.toml b/ext/console/Cargo.toml index 83c47d73b7..f6da8e5114 100644 --- a/ext/console/Cargo.toml +++ b/ext/console/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_console" version = "0.23.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/ext/crypto/Cargo.toml b/ext/crypto/Cargo.toml index 9d2f6923b9..b66911b1b6 100644 --- a/ext/crypto/Cargo.toml +++ b/ext/crypto/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_crypto" version = "0.37.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/ext/crypto/lib.rs b/ext/crypto/lib.rs index d5f95677a0..2170e3c72d 100644 --- a/ext/crypto/lib.rs +++ b/ext/crypto/lib.rs @@ -14,8 +14,6 @@ use serde::Deserialize; use serde::Serialize; use std::cell::RefCell; -use std::convert::TryFrom; -use std::convert::TryInto; use std::num::NonZeroU32; use std::rc::Rc; diff --git a/ext/fetch/Cargo.toml b/ext/fetch/Cargo.toml index 36a7a87823..dacdc32974 100644 --- a/ext/fetch/Cargo.toml +++ b/ext/fetch/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_fetch" version = "0.46.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/ext/ffi/Cargo.toml b/ext/ffi/Cargo.toml index 7b8d8f27ff..98520ea2e8 100644 --- a/ext/ffi/Cargo.toml +++ b/ext/ffi/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_ffi" version = "0.10.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/ext/ffi/lib.rs b/ext/ffi/lib.rs index f1e593296a..a21601e3b4 100644 --- a/ext/ffi/lib.rs +++ b/ext/ffi/lib.rs @@ -18,7 +18,6 @@ use serde::Deserialize; use std::borrow::Cow; use std::cell::RefCell; use std::collections::HashMap; -use std::convert::TryFrom; use std::ffi::c_void; use std::path::Path; use std::path::PathBuf; diff --git a/ext/http/Cargo.toml b/ext/http/Cargo.toml index c5fc9fdae4..d56c3dd545 100644 --- a/ext/http/Cargo.toml +++ b/ext/http/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_http" version = "0.15.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/ext/net/Cargo.toml b/ext/net/Cargo.toml index 5f22be0a8c..435ceab9c3 100644 --- a/ext/net/Cargo.toml +++ b/ext/net/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_net" version = "0.15.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/ext/timers/Cargo.toml b/ext/timers/Cargo.toml index 0916f29567..08d5980dac 100644 --- a/ext/timers/Cargo.toml +++ b/ext/timers/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_timers" version = "0.21.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/ext/tls/Cargo.toml b/ext/tls/Cargo.toml index 869bf1271b..c18a2f6fd6 100644 --- a/ext/tls/Cargo.toml +++ b/ext/tls/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_tls" version = "0.10.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/ext/url/Cargo.toml b/ext/url/Cargo.toml index 2b4751054c..a107f00425 100644 --- a/ext/url/Cargo.toml +++ b/ext/url/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_url" version = "0.23.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/ext/web/Cargo.toml b/ext/web/Cargo.toml index c4e8ae8a7e..e7e022047c 100644 --- a/ext/web/Cargo.toml +++ b/ext/web/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_web" version = "0.54.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/ext/webgpu/Cargo.toml b/ext/webgpu/Cargo.toml index e7a71de62a..150f1d6a42 100644 --- a/ext/webgpu/Cargo.toml +++ b/ext/webgpu/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_webgpu" version = "0.24.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/ext/webgpu/binding.rs b/ext/webgpu/binding.rs index c2dbcf455e..4f68c65e92 100644 --- a/ext/webgpu/binding.rs +++ b/ext/webgpu/binding.rs @@ -5,7 +5,6 @@ use deno_core::ResourceId; use deno_core::{OpState, Resource}; use serde::Deserialize; use std::borrow::Cow; -use std::convert::{TryFrom, TryInto}; use crate::texture::{GpuTextureFormat, GpuTextureViewDimension}; diff --git a/ext/webgpu/bundle.rs b/ext/webgpu/bundle.rs index df91104f5d..8b2828a30f 100644 --- a/ext/webgpu/bundle.rs +++ b/ext/webgpu/bundle.rs @@ -7,7 +7,6 @@ use deno_core::{OpState, Resource}; use serde::Deserialize; use std::borrow::Cow; use std::cell::RefCell; -use std::convert::TryInto; use std::rc::Rc; use crate::pipeline::GpuIndexFormat; diff --git a/ext/webgpu/pipeline.rs b/ext/webgpu/pipeline.rs index 77edcadfb3..3b0f035404 100644 --- a/ext/webgpu/pipeline.rs +++ b/ext/webgpu/pipeline.rs @@ -6,7 +6,6 @@ use deno_core::{OpState, Resource}; use serde::Deserialize; use serde::Serialize; use std::borrow::Cow; -use std::convert::{TryFrom, TryInto}; use crate::sampler::GpuCompareFunction; use crate::texture::GpuTextureFormat; diff --git a/ext/webgpu/texture.rs b/ext/webgpu/texture.rs index 47e7a14d2c..ac3ceda6a1 100644 --- a/ext/webgpu/texture.rs +++ b/ext/webgpu/texture.rs @@ -6,8 +6,6 @@ use deno_core::ResourceId; use deno_core::{OpState, Resource}; use serde::Deserialize; use std::borrow::Cow; -use std::convert::TryFrom; -use std::convert::TryInto; use super::error::WebGpuResult; pub(crate) struct WebGpuTexture(pub(crate) wgpu_core::id::TextureId); diff --git a/ext/webidl/Cargo.toml b/ext/webidl/Cargo.toml index e5d9113a5e..9988236aba 100644 --- a/ext/webidl/Cargo.toml +++ b/ext/webidl/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_webidl" version = "0.23.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/ext/websocket/Cargo.toml b/ext/websocket/Cargo.toml index fdef6d55be..0d41f2de63 100644 --- a/ext/websocket/Cargo.toml +++ b/ext/websocket/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_websocket" version = "0.28.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/ext/webstorage/Cargo.toml b/ext/webstorage/Cargo.toml index e6de6465d8..c4516d397a 100644 --- a/ext/webstorage/Cargo.toml +++ b/ext/webstorage/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_webstorage" version = "0.18.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index f1d065b16d..60f11d7030 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -4,7 +4,7 @@ name = "deno_runtime" version = "0.31.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" repository = "https://github.com/denoland/deno" description = "Provides the deno runtime library" diff --git a/runtime/ops/process.rs b/runtime/ops/process.rs index 833b1822c3..0324cb599c 100644 --- a/runtime/ops/process.rs +++ b/runtime/ops/process.rs @@ -261,7 +261,6 @@ pub fn kill(pid: i32, signal: &str) -> Result<(), AnyError> { let signo = super::signal::signal_str_to_int(signal)?; use nix::sys::signal::{kill as unix_kill, Signal}; use nix::unistd::Pid; - use std::convert::TryFrom; let sig = Signal::try_from(signo)?; unix_kill(Pid::from_raw(pid), Option::Some(sig)).map_err(AnyError::from) } diff --git a/serde_v8/Cargo.toml b/serde_v8/Cargo.toml index ac5d26575e..dbb636e0e7 100644 --- a/serde_v8/Cargo.toml +++ b/serde_v8/Cargo.toml @@ -3,7 +3,7 @@ name = "serde_v8" version = "0.16.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" license = "MIT" readme = "README.md" repository = "https://github.com/denoland/deno" diff --git a/serde_v8/benches/de.rs b/serde_v8/benches/de.rs index d800a39a56..83a46eb4e1 100644 --- a/serde_v8/benches/de.rs +++ b/serde_v8/benches/de.rs @@ -1,8 +1,6 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. use bencher::{benchmark_group, benchmark_main, Bencher}; -use std::convert::TryFrom; - use serde::Deserialize; use serde_v8::utils::{js_exec, v8_do}; diff --git a/serde_v8/src/de.rs b/serde_v8/src/de.rs index 14edfec03e..f803ab3812 100644 --- a/serde_v8/src/de.rs +++ b/serde_v8/src/de.rs @@ -2,8 +2,6 @@ use serde::de::{self, Visitor}; use serde::Deserialize; -use std::convert::TryFrom; - use crate::error::{Error, Result}; use crate::keys::{v8_struct_key, KeyCache}; use crate::payload::ValueType; diff --git a/serde_v8/src/ser.rs b/serde_v8/src/ser.rs index 386e46019f..d3853f1a3c 100644 --- a/serde_v8/src/ser.rs +++ b/serde_v8/src/ser.rs @@ -3,7 +3,6 @@ use serde::ser; use serde::ser::Serialize; use std::cell::RefCell; -use std::convert::TryInto; use crate::error::{Error, Result}; use crate::keys::v8_struct_key; diff --git a/serde_v8/tests/magic.rs b/serde_v8/tests/magic.rs index 15b318bafb..036fc52396 100644 --- a/serde_v8/tests/magic.rs +++ b/serde_v8/tests/magic.rs @@ -3,7 +3,6 @@ use serde::{Deserialize, Serialize}; use serde_v8::utils::{js_exec, v8_do}; use serde_v8::Result; -use std::convert::TryFrom; #[derive(Deserialize)] struct MagicOp<'s> { diff --git a/test_ffi/Cargo.toml b/test_ffi/Cargo.toml index 737efe21e5..8c9be227c4 100644 --- a/test_ffi/Cargo.toml +++ b/test_ffi/Cargo.toml @@ -4,7 +4,7 @@ name = "test_ffi" version = "0.1.0" authors = ["the deno authors"] -edition = "2018" +edition = "2021" publish = false [lib] diff --git a/test_util/Cargo.toml b/test_util/Cargo.toml index e93793392a..279cb4d304 100644 --- a/test_util/Cargo.toml +++ b/test_util/Cargo.toml @@ -4,7 +4,7 @@ name = "test_util" version = "0.1.0" authors = ["the Deno authors"] -edition = "2018" +edition = "2021" publish = false [[bin]]