From 3be851f722956d39dc09bd64b21971a3420c9a48 Mon Sep 17 00:00:00 2001 From: jeparlefrancais Date: Wed, 11 Dec 2024 12:40:32 -0500 Subject: [PATCH] Fix new clippy warnings --- src/frontend/work_cache.rs | 4 ++-- src/generator/token_based.rs | 2 +- src/process/expression_serializer.rs | 16 ++++++++-------- src/process/processors/find_identifier.rs | 2 +- src/process/processors/find_usage.rs | 6 +++--- src/rules/bundle/path_require_mode/mod.rs | 6 +++--- src/rules/convert_require/mod.rs | 6 +++--- src/rules/mod.rs | 2 +- src/rules/remove_comments.rs | 2 +- src/rules/replace_referenced_tokens.rs | 2 +- src/rules/require/path_iterator.rs | 2 +- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/frontend/work_cache.rs b/src/frontend/work_cache.rs index ecbb5027..6e8fbc1e 100644 --- a/src/frontend/work_cache.rs +++ b/src/frontend/work_cache.rs @@ -16,7 +16,7 @@ pub struct WorkCache<'a> { input_to_output: HashMap, } -impl<'a> Clone for WorkCache<'a> { +impl Clone for WorkCache<'_> { fn clone(&self) -> Self { Self { resources: self.resources, @@ -26,7 +26,7 @@ impl<'a> Clone for WorkCache<'a> { } } -impl<'a> fmt::Debug for WorkCache<'a> { +impl fmt::Debug for WorkCache<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("WorkCache") .field("resources", &self.resources) diff --git a/src/generator/token_based.rs b/src/generator/token_based.rs index 3d6b86d2..76d2fcf5 100644 --- a/src/generator/token_based.rs +++ b/src/generator/token_based.rs @@ -1688,7 +1688,7 @@ fn comma_token() -> Token { Token::from_content(",").with_trailing_trivia(TriviaKind::Whitespace.with_content(" ")) } -impl<'a> LuaGenerator for TokenBasedLuaGenerator<'a> { +impl LuaGenerator for TokenBasedLuaGenerator<'_> { fn into_string(self) -> String { self.output } diff --git a/src/process/expression_serializer.rs b/src/process/expression_serializer.rs index 571703ce..4bfd2483 100644 --- a/src/process/expression_serializer.rs +++ b/src/process/expression_serializer.rs @@ -181,7 +181,7 @@ impl Serializer { } } -impl<'a> ser::Serializer for &'a mut Serializer { +impl ser::Serializer for &mut Serializer { // The output type produced by this `Serializer` during successful // serialization. Most serializers that produce text or binary output should // set `Ok = ()` and serialize into an `io::Write` or buffer contained @@ -425,7 +425,7 @@ impl<'a> ser::Serializer for &'a mut Serializer { // // This impl is SerializeSeq so these methods are called after `serialize_seq` // is called on the Serializer. -impl<'a> ser::SerializeSeq for &'a mut Serializer { +impl ser::SerializeSeq for &mut Serializer { // Must match the `Ok` type of the serializer. type Ok = (); // Must match the `Error` type of the serializer. @@ -446,7 +446,7 @@ impl<'a> ser::SerializeSeq for &'a mut Serializer { } // Same thing but for tuples. -impl<'a> ser::SerializeTuple for &'a mut Serializer { +impl ser::SerializeTuple for &mut Serializer { type Ok = (); type Error = LuaSerializerError; @@ -463,7 +463,7 @@ impl<'a> ser::SerializeTuple for &'a mut Serializer { } // Same thing but for tuple structs. -impl<'a> ser::SerializeTupleStruct for &'a mut Serializer { +impl ser::SerializeTupleStruct for &mut Serializer { type Ok = (); type Error = LuaSerializerError; @@ -483,7 +483,7 @@ impl<'a> ser::SerializeTupleStruct for &'a mut Serializer { // `serialize_tuple_variant` method above. The `end` method // in this impl is responsible for closing both the outer and // inner tables. -impl<'a> ser::SerializeTupleVariant for &'a mut Serializer { +impl ser::SerializeTupleVariant for &mut Serializer { type Ok = (); type Error = LuaSerializerError; @@ -507,7 +507,7 @@ impl<'a> ser::SerializeTupleVariant for &'a mut Serializer { // There is a third optional method on the `SerializeMap` trait. The // `serialize_entry` method allows serializers to optimize for the case where // key and value are both available simultaneously. -impl<'a> ser::SerializeMap for &'a mut Serializer { +impl ser::SerializeMap for &mut Serializer { type Ok = (); type Error = LuaSerializerError; @@ -535,7 +535,7 @@ impl<'a> ser::SerializeMap for &'a mut Serializer { // Structs are like maps in which the keys are constrained to be compile-time // constant strings. -impl<'a> ser::SerializeStruct for &'a mut Serializer { +impl ser::SerializeStruct for &mut Serializer { type Ok = (); type Error = LuaSerializerError; @@ -556,7 +556,7 @@ impl<'a> ser::SerializeStruct for &'a mut Serializer { // Similar to `SerializeTupleVariant`, here the `end` method is responsible for // closing both of the curly braces opened by `serialize_struct_variant`. -impl<'a> ser::SerializeStructVariant for &'a mut Serializer { +impl ser::SerializeStructVariant for &mut Serializer { type Ok = (); type Error = LuaSerializerError; diff --git a/src/process/processors/find_identifier.rs b/src/process/processors/find_identifier.rs index 6b72e4c1..264074a2 100644 --- a/src/process/processors/find_identifier.rs +++ b/src/process/processors/find_identifier.rs @@ -60,7 +60,7 @@ impl<'a> FromIterator<&'a str> for FindVariables<'a> { } } -impl<'a> NodeProcessor for FindVariables<'a> { +impl NodeProcessor for FindVariables<'_> { fn process_variable_expression(&mut self, variable: &mut Identifier) { if !self.usage_found { let name = variable.get_name(); diff --git a/src/process/processors/find_usage.rs b/src/process/processors/find_usage.rs index fbf0cbce..810c0675 100644 --- a/src/process/processors/find_usage.rs +++ b/src/process/processors/find_usage.rs @@ -12,7 +12,7 @@ pub(crate) struct FindUsage<'a> { identifier_tracker: IdentifierTracker, } -impl<'a> ops::Deref for FindUsage<'a> { +impl ops::Deref for FindUsage<'_> { type Target = IdentifierTracker; fn deref(&self) -> &Self::Target { @@ -20,7 +20,7 @@ impl<'a> ops::Deref for FindUsage<'a> { } } -impl<'a> ops::DerefMut for FindUsage<'a> { +impl ops::DerefMut for FindUsage<'_> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.identifier_tracker } @@ -47,7 +47,7 @@ impl<'a> FindUsage<'a> { } } -impl<'a> NodeProcessor for FindUsage<'a> { +impl NodeProcessor for FindUsage<'_> { fn process_variable_expression(&mut self, variable: &mut Identifier) { self.verify_identifier(variable); } diff --git a/src/rules/bundle/path_require_mode/mod.rs b/src/rules/bundle/path_require_mode/mod.rs index b844e2bd..78da5a9a 100644 --- a/src/rules/bundle/path_require_mode/mod.rs +++ b/src/rules/bundle/path_require_mode/mod.rs @@ -261,7 +261,7 @@ impl<'a, 'b, 'code, 'resources> RequirePathProcessor<'a, 'b, 'code, 'resources> } } -impl<'a, 'b, 'resources, 'code> Deref for RequirePathProcessor<'a, 'b, 'resources, 'code> { +impl Deref for RequirePathProcessor<'_, '_, '_, '_> { type Target = IdentifierTracker; fn deref(&self) -> &Self::Target { @@ -269,7 +269,7 @@ impl<'a, 'b, 'resources, 'code> Deref for RequirePathProcessor<'a, 'b, 'resource } } -impl<'a, 'b, 'resources, 'code> DerefMut for RequirePathProcessor<'a, 'b, 'resources, 'code> { +impl DerefMut for RequirePathProcessor<'_, '_, '_, '_> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.identifier_tracker } @@ -300,7 +300,7 @@ where expression } -impl<'a, 'b, 'resources, 'code> NodeProcessor for RequirePathProcessor<'a, 'b, 'resources, 'code> { +impl NodeProcessor for RequirePathProcessor<'_, '_, '_, '_> { fn process_expression(&mut self, expression: &mut Expression) { if let Expression::Call(call) = expression { if let Some(replace_with) = self.try_inline_call(call) { diff --git a/src/rules/convert_require/mod.rs b/src/rules/convert_require/mod.rs index c4ba6b2f..9f77f86b 100644 --- a/src/rules/convert_require/mod.rs +++ b/src/rules/convert_require/mod.rs @@ -92,7 +92,7 @@ struct RequireConverter<'a> { context: &'a Context<'a, 'a, 'a>, } -impl<'a> Deref for RequireConverter<'a> { +impl Deref for RequireConverter<'_> { type Target = IdentifierTracker; fn deref(&self) -> &Self::Target { @@ -100,7 +100,7 @@ impl<'a> Deref for RequireConverter<'a> { } } -impl<'a> DerefMut for RequireConverter<'a> { +impl DerefMut for RequireConverter<'_> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.identifier_tracker } @@ -131,7 +131,7 @@ impl<'a> RequireConverter<'a> { } } -impl<'a> NodeProcessor for RequireConverter<'a> { +impl NodeProcessor for RequireConverter<'_> { fn process_function_call(&mut self, call: &mut FunctionCall) { if is_require_call(call, self) { match self.try_require_conversion(call) { diff --git a/src/rules/mod.rs b/src/rules/mod.rs index 50576cce..e0050181 100644 --- a/src/rules/mod.rs +++ b/src/rules/mod.rs @@ -132,7 +132,7 @@ pub struct Context<'a, 'resources, 'code> { dependencies: std::cell::RefCell>, } -impl<'a, 'resources, 'code> Context<'a, 'resources, 'code> { +impl Context<'_, '_, '_> { pub fn block(&self, path: impl AsRef) -> Option<&Block> { self.blocks.get(path.as_ref()).copied() } diff --git a/src/rules/remove_comments.rs b/src/rules/remove_comments.rs index eda1ceda..54dfa2de 100644 --- a/src/rules/remove_comments.rs +++ b/src/rules/remove_comments.rs @@ -250,7 +250,7 @@ impl<'a> FilterCommentProcessor<'a> { } } -impl<'a> NodeProcessor for FilterCommentProcessor<'a> { +impl NodeProcessor for FilterCommentProcessor<'_> { fn process_block(&mut self, block: &mut Block) { block.filter_comments(|trivia| self.ignore_trivia(trivia)); } diff --git a/src/rules/replace_referenced_tokens.rs b/src/rules/replace_referenced_tokens.rs index 30493c99..7cc316e4 100644 --- a/src/rules/replace_referenced_tokens.rs +++ b/src/rules/replace_referenced_tokens.rs @@ -17,7 +17,7 @@ impl<'a> Processor<'a> { } } -impl<'a> NodeProcessor for Processor<'a> { +impl NodeProcessor for Processor<'_> { fn process_block(&mut self, block: &mut Block) { block.replace_referenced_tokens(self.code); } diff --git a/src/rules/require/path_iterator.rs b/src/rules/require/path_iterator.rs index 5837a120..e8a0d444 100644 --- a/src/rules/require/path_iterator.rs +++ b/src/rules/require/path_iterator.rs @@ -34,7 +34,7 @@ impl<'a, 'b> PathIterator<'a, 'b> { } } -impl<'a, 'b> Iterator for PathIterator<'a, 'b> { +impl Iterator for PathIterator<'_, '_> { type Item = PathBuf; fn next(&mut self) -> Option {