From 892a7fab609c809ffd5bf64c9ce8c415a03c6841 Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Tue, 27 Aug 2024 08:13:14 +0000 Subject: [PATCH] refactor(semantic): replace `ref` syntax (#5253) Pure code style refactor. Prefer `if let Some(y) = &x.y` over `if let Some(ref y) = x.y`. --- crates/oxc_semantic/src/builder.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/oxc_semantic/src/builder.rs b/crates/oxc_semantic/src/builder.rs index 74f4fa777..3772f9f1c 100644 --- a/crates/oxc_semantic/src/builder.rs +++ b/crates/oxc_semantic/src/builder.rs @@ -653,7 +653,7 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> { let node_id = self.current_node_id; /* cfg */ - if let Some(ref break_target) = stmt.label { + if let Some(break_target) = &stmt.label { self.visit_label_identifier(break_target); } @@ -1715,10 +1715,8 @@ impl<'a> SemanticBuilder<'a> { AstKind::ExportDefaultDeclaration(decl) => { // Only if the declaration has an ID, we mark it as an export if match &decl.declaration { - ExportDefaultDeclarationKind::FunctionDeclaration(ref func) => { - func.id.is_some() - } - ExportDefaultDeclarationKind::ClassDeclaration(ref class) => class.id.is_some(), + ExportDefaultDeclarationKind::FunctionDeclaration(func) => func.id.is_some(), + ExportDefaultDeclarationKind::ClassDeclaration(class) => class.id.is_some(), ExportDefaultDeclarationKind::TSInterfaceDeclaration(_) => true, _ => false, } {