Skip to content

Commit

Permalink
refactor(semantic): replace ref syntax (#5253)
Browse files Browse the repository at this point in the history
Pure code style refactor. Prefer `if let Some(y) = &x.y` over `if let Some(ref y) = x.y`.
  • Loading branch information
overlookmotel committed Aug 27, 2024
1 parent cbb4725 commit 892a7fa
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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,
} {
Expand Down

0 comments on commit 892a7fa

Please sign in to comment.