Skip to content

Commit ce9bcf0

Browse files
committed
refactor(linter/no-func-assign): use let-else chain (#14525)
1 parent a9cea7c commit ce9bcf0

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

crates/oxc_linter/src/rules/eslint/no_func_assign.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@ declare_oxc_lint!(
6868

6969
impl Rule for NoFuncAssign {
7070
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
71-
if let AstKind::Function(func) = node.kind() {
72-
let (func_name, symbol_id) = match &func.id {
73-
Some(id) => (id.name.as_str(), id.symbol_id()),
74-
None => return,
75-
};
76-
let symbol_table = ctx.scoping();
77-
for reference in symbol_table.get_resolved_references(symbol_id) {
78-
if reference.is_write() {
79-
ctx.diagnostic(no_func_assign_diagnostic(
80-
func_name,
81-
ctx.semantic().reference_span(reference),
82-
));
83-
}
71+
let AstKind::Function(func) = node.kind() else { return };
72+
73+
let (func_name, symbol_id) = match &func.id {
74+
Some(id) => (id.name.as_str(), id.symbol_id()),
75+
None => return,
76+
};
77+
let symbol_table = ctx.scoping();
78+
for reference in symbol_table.get_resolved_references(symbol_id) {
79+
if reference.is_write() {
80+
ctx.diagnostic(no_func_assign_diagnostic(
81+
func_name,
82+
ctx.semantic().reference_span(reference),
83+
));
8484
}
8585
}
8686
}

0 commit comments

Comments
 (0)