From 17dfdb93659d6b3340f22ea4659a4e1bf3ca831c Mon Sep 17 00:00:00 2001 From: exrook Date: Sun, 22 Oct 2023 15:25:29 -0400 Subject: [PATCH] fix clippy lints introduced in 1.72 and 1.73 (#2581) fixes: - [non_canonical_clone_impl](https://rust-lang.github.io/rust-clippy/master/index.html#non_canonical_clone_impl) - [non_canonical_partial_ord_impl](https://rust-lang.github.io/rust-clippy/master/index.html#non_canonical_partial_ord_impl) - [redundant_guards](https://rust-lang.github.io/rust-clippy/master/index.html#redundant_guards) --- src/arena.rs | 7 ++----- src/front/wgsl/parse/lexer.rs | 4 +--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/arena.rs b/src/arena.rs index 3f17c57296..a9df066654 100644 --- a/src/arena.rs +++ b/src/arena.rs @@ -41,10 +41,7 @@ pub struct Handle { impl Clone for Handle { fn clone(&self) -> Self { - Handle { - index: self.index, - marker: self.marker, - } + *self } } @@ -60,7 +57,7 @@ impl Eq for Handle {} impl PartialOrd for Handle { fn partial_cmp(&self, other: &Self) -> Option { - self.index.partial_cmp(&other.index) + Some(self.cmp(other)) } } diff --git a/src/front/wgsl/parse/lexer.rs b/src/front/wgsl/parse/lexer.rs index 4654d4087f..ed273fbbb1 100644 --- a/src/front/wgsl/parse/lexer.rs +++ b/src/front/wgsl/parse/lexer.rs @@ -350,9 +350,7 @@ impl<'a> Lexer<'a> { &mut self, ) -> Result<(&'a str, Span), Error<'a>> { match self.next() { - (Token::Word(word), span) if word == "_" => { - Err(Error::InvalidIdentifierUnderscore(span)) - } + (Token::Word("_"), span) => Err(Error::InvalidIdentifierUnderscore(span)), (Token::Word(word), span) if word.starts_with("__") => { Err(Error::ReservedIdentifierPrefix(span)) }