diff --git a/crates/ast-utils/src/lib.rs b/crates/ast-utils/src/lib.rs index 4faed489..03efda9b 100644 --- a/crates/ast-utils/src/lib.rs +++ b/crates/ast-utils/src/lib.rs @@ -141,7 +141,7 @@ pub fn block_has_yield(block: &Block) -> bool { #[inline] pub fn statement_has_yield(statement: &Statement) -> bool { - return match statement { + match statement { Statement::Namespace(namespace) => { for statement in namespace.statements().iter() { if statement_has_yield(statement) { @@ -259,7 +259,7 @@ pub fn statement_has_yield(statement: &Statement) -> bool { }, Statement::Expression(expression) => expression_has_yield(&expression.expression), _ => false, - }; + } } #[inline] @@ -446,7 +446,7 @@ pub fn block_has_throws(block: &Block) -> bool { #[inline] pub fn statement_has_throws(statement: &Statement) -> bool { - return match statement { + match statement { Statement::Namespace(namespace) => { for statement in namespace.statements().iter() { if statement_has_throws(statement) { @@ -564,7 +564,7 @@ pub fn statement_has_throws(statement: &Statement) -> bool { }, Statement::Expression(expression) => expression_has_throws(&expression.expression), _ => false, - }; + } } #[inline] diff --git a/crates/ast/src/node.rs b/crates/ast/src/node.rs index 4028ca6b..b3a93cf1 100644 --- a/crates/ast/src/node.rs +++ b/crates/ast/src/node.rs @@ -1992,7 +1992,7 @@ impl<'a> Node<'a> { } } -impl<'a> HasSpan for Node<'a> { +impl HasSpan for Node<'_> { fn span(&self) -> Span { match self { Self::Program(node) => node.span(), diff --git a/crates/docblock/src/internal/token.rs b/crates/docblock/src/internal/token.rs index a0918a40..3c6f4411 100644 --- a/crates/docblock/src/internal/token.rs +++ b/crates/docblock/src/internal/token.rs @@ -6,7 +6,7 @@ pub enum Token<'a> { EmptyLine { span: Span }, } -impl<'a> Token<'a> { +impl Token<'_> { pub fn span(&self) -> Span { match self { Token::Line { span, .. } => *span, diff --git a/crates/formatter/src/format/block.rs b/crates/formatter/src/format/block.rs index 5e2309bf..39410cd8 100644 --- a/crates/formatter/src/format/block.rs +++ b/crates/formatter/src/format/block.rs @@ -45,7 +45,7 @@ pub(super) fn print_block_of_nodes<'a, T: Format<'a> + HasSpan>( contents.push(Document::String("}")); - return Document::Group(Group::new(contents)); + Document::Group(Group::new(contents)) } pub(super) fn print_block<'a>( diff --git a/crates/lexer/src/lib.rs b/crates/lexer/src/lib.rs index d3e38738..bcd7fd61 100644 --- a/crates/lexer/src/lib.rs +++ b/crates/lexer/src/lib.rs @@ -848,10 +848,10 @@ impl<'a, 'i> Lexer<'a, 'i> { self.token(TokenKind::LeftParenthesis, buffer, start, end) } else { - return Some(Err(SyntaxError::UnexpectedToken( + Some(Err(SyntaxError::UnexpectedToken( self.input.read(1)[0], self.input.position(), - ))); + ))) } } HaltStage::LookingForRightParenthesis => { @@ -863,10 +863,10 @@ impl<'a, 'i> Lexer<'a, 'i> { self.token(TokenKind::RightParenthesis, buffer, start, end) } else { - return Some(Err(SyntaxError::UnexpectedToken( + Some(Err(SyntaxError::UnexpectedToken( self.input.read(1)[0], self.input.position(), - ))); + ))) } } HaltStage::LookingForTerminator => { diff --git a/crates/linter/src/context.rs b/crates/linter/src/context.rs index 90dc8b41..30919e88 100644 --- a/crates/linter/src/context.rs +++ b/crates/linter/src/context.rs @@ -45,7 +45,7 @@ pub struct LintContext<'a> { pub issues: &'a mut IssueCollection, } -impl<'a> LintContext<'a> { +impl LintContext<'_> { /// Determines the effective reporting level for a linter rule. pub fn level(&self) -> Level { self.rule.level diff --git a/crates/linter/src/plugin/naming/rules/function.rs b/crates/linter/src/plugin/naming/rules/function.rs index 5e30d611..e5ff235a 100644 --- a/crates/linter/src/plugin/naming/rules/function.rs +++ b/crates/linter/src/plugin/naming/rules/function.rs @@ -19,7 +19,7 @@ impl Rule for FunctionRule { } } -impl<'a> Walker> for FunctionRule { +impl Walker> for FunctionRule { fn walk_in_function(&self, function: &Function, context: &mut LintContext) { let name = context.lookup(&function.name.value); let fqfn = context.lookup_name(&function.name); diff --git a/crates/names/src/lib.rs b/crates/names/src/lib.rs index 91eaef02..7d07b714 100644 --- a/crates/names/src/lib.rs +++ b/crates/names/src/lib.rs @@ -85,7 +85,7 @@ impl Names { /// /// Panics if the name is not found at the given position. pub fn get(&self, position: &impl HasPosition) -> &StringIdentifier { - return self.names.get(&position.position().offset).map(|(name, _)| name).expect("name not found at position"); + self.names.get(&position.position().offset).map(|(name, _)| name).expect("name not found at position") } /// Returns whether the name at the given position was explicitly imported. @@ -98,7 +98,7 @@ impl Names { /// /// `true` if the name was imported, `false` otherwise. pub fn is_imported(&self, position: &impl HasPosition) -> bool { - return self.names.get(&position.position().offset).map(|(_, imported)| *imported).unwrap_or(false); + self.names.get(&position.position().offset).map(|(_, imported)| *imported).unwrap_or(false) } /// Inserts a resolved name at the given position. diff --git a/crates/reporting/src/reporter.rs b/crates/reporting/src/reporter.rs index 804921b2..a8616060 100644 --- a/crates/reporting/src/reporter.rs +++ b/crates/reporting/src/reporter.rs @@ -120,7 +120,7 @@ impl std::fmt::Debug for Reporter { struct Gaurd<'a>(MutexGuard<'a, StandardStream>); -impl<'a> WriteColor for Gaurd<'a> { +impl WriteColor for Gaurd<'_> { fn set_color(&mut self, spec: &term::termcolor::ColorSpec) -> std::io::Result<()> { self.0.set_color(spec) } @@ -134,7 +134,7 @@ impl<'a> WriteColor for Gaurd<'a> { } } -impl<'a> std::io::Write for Gaurd<'a> { +impl std::io::Write for Gaurd<'_> { fn write(&mut self, buf: &[u8]) -> std::io::Result { self.0.write(buf) } diff --git a/crates/symbol-table/src/walker.rs b/crates/symbol-table/src/walker.rs index e792d8f7..ab9631ae 100644 --- a/crates/symbol-table/src/walker.rs +++ b/crates/symbol-table/src/walker.rs @@ -102,7 +102,7 @@ impl SymbolWalker { } } -impl<'a> MutWalker> for SymbolWalker { +impl MutWalker> for SymbolWalker { fn walk_in_namespace(&mut self, namespace: &Namespace, context: &mut Context<'_>) { let name = match &namespace.name { Some(name) => context.interner.lookup(&name.value()).to_string(),