diff --git a/Cargo.toml b/Cargo.toml index c951456a3b..80a4915b53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "naga" version = "0.10.0" authors = ["Naga Developers"] -edition = "2018" +edition = "2021" description = "Shader translation infrastructure" homepage = "https://github.com/gfx-rs/naga" repository = "https://github.com/gfx-rs/naga" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 02e563772f..6cc017e35b 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -2,7 +2,7 @@ name = "naga-cli" version = "0.10.0" authors = ["Naga Developers"] -edition = "2018" +edition = "2021" description = "Shader translation command line tool" homepage = "https://github.com/gfx-rs/naga" repository = "https://github.com/gfx-rs/naga" diff --git a/src/arena.rs b/src/arena.rs index d21a786cb5..5d5cf37935 100644 --- a/src/arena.rs +++ b/src/arena.rs @@ -96,8 +96,6 @@ impl Handle { /// Convert a `usize` index into a `Handle`. fn from_usize(index: usize) -> Self { - use std::convert::TryFrom; - let handle_index = u32::try_from(index + 1) .ok() .and_then(Index::new) diff --git a/src/front/wgsl/number.rs b/src/front/wgsl/number.rs index d7e8801b09..fafe1d2270 100644 --- a/src/front/wgsl/number.rs +++ b/src/front/wgsl/number.rs @@ -24,12 +24,9 @@ impl Number { /// lossy, return an error. fn abstract_to_concrete(self) -> Result { match self { - Number::AbstractInt(num) => { - use std::convert::TryFrom; - i32::try_from(num) - .map(Number::I32) - .map_err(|_| NumberError::NotRepresentable) - } + Number::AbstractInt(num) => i32::try_from(num) + .map(Number::I32) + .map_err(|_| NumberError::NotRepresentable), Number::AbstractFloat(num) => { let num = num as f32; if num.is_finite() { @@ -94,9 +91,9 @@ fn parse(input: &str) -> (Result, &str) { /// returns `true` and consumes `X` bytes from the given byte buffer /// if the given `X` nr of patterns are found at the start of the buffer macro_rules! consume { - ($bytes:ident, $($($pattern:pat)|*),*) => { + ($bytes:ident, $($pattern:pat),*) => { match $bytes { - &[$($($pattern)|*),*, ref rest @ ..] => { $bytes = rest; true }, + &[$($pattern),*, ref rest @ ..] => { $bytes = rest; true }, _ => false, } }; @@ -106,9 +103,9 @@ fn parse(input: &str) -> (Result, &str) { /// if one of the given patterns are found at the start of the buffer /// returning the corresponding expr for the matched pattern macro_rules! consume_map { - ($bytes:ident, [$($($pattern:pat)|* => $to:expr),*]) => { + ($bytes:ident, [$($pattern:pat_param => $to:expr),*]) => { match $bytes { - $( &[$($pattern)|*, ref rest @ ..] => { $bytes = rest; Some($to) }, )* + $( &[$pattern, ref rest @ ..] => { $bytes = rest; Some($to) }, )* _ => None, } }; diff --git a/src/proc/mod.rs b/src/proc/mod.rs index 0b9f406af4..a5731de896 100644 --- a/src/proc/mod.rs +++ b/src/proc/mod.rs @@ -389,7 +389,6 @@ impl crate::Constant { /// `OpArrayType` referring to an inappropriate `OpConstant`). So we return /// `Option` and let the caller sort things out. pub(crate) fn to_array_length(&self) -> Option { - use std::convert::TryInto; match self.inner { crate::ConstantInner::Scalar { value, width: _ } => match value { crate::ScalarValue::Uint(value) => value.try_into().ok(),