Skip to content

Commit

Permalink
chore: apply clippy fix from stable channel
Browse files Browse the repository at this point in the history
Signed-off-by: azjezz <azjezz@protonmail.com>
  • Loading branch information
azjezz committed Dec 7, 2024
1 parent 5e4947a commit 852ec21
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions crates/ast-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -259,7 +259,7 @@ pub fn statement_has_yield(statement: &Statement) -> bool {
},
Statement::Expression(expression) => expression_has_yield(&expression.expression),
_ => false,
};
}
}

#[inline]
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -564,7 +564,7 @@ pub fn statement_has_throws(statement: &Statement) -> bool {
},
Statement::Expression(expression) => expression_has_throws(&expression.expression),
_ => false,
};
}
}

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion crates/ast/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion crates/docblock/src/internal/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion crates/formatter/src/format/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>(
Expand Down
8 changes: 4 additions & 4 deletions crates/lexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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 => {
Expand Down
2 changes: 1 addition & 1 deletion crates/linter/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/linter/src/plugin/naming/rules/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl Rule for FunctionRule {
}
}

impl<'a> Walker<LintContext<'a>> for FunctionRule {
impl Walker<LintContext<'_>> 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);
Expand Down
4 changes: 2 additions & 2 deletions crates/names/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions crates/reporting/src/reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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<usize> {
self.0.write(buf)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/symbol-table/src/walker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl SymbolWalker {
}
}

impl<'a> MutWalker<Context<'a>> for SymbolWalker {
impl MutWalker<Context<'_>> 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(),
Expand Down

0 comments on commit 852ec21

Please sign in to comment.