Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/eslint/no_unused_vars/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ impl Symbol<'_, '_> {
fn is_in_declare_global(&self) -> bool {
self.scopes()
.ancestors(self.scope_id())
.filter(|scope_id| {
let flags = self.scopes().get_flags(*scope_id);
.filter(|&scope_id| {
let flags = self.scopes().get_flags(scope_id);
flags.contains(ScopeFlags::TsModuleBlock)
})
.any(|ambient_module_scope_id| {
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/jest/no_mocks_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ impl Rule for NoMocksImport {
return;
};

for reference_id in require_reference_ids {
let reference = ctx.symbols().get_reference(*reference_id);
for &reference_id in require_reference_ids {
let reference = ctx.symbols().get_reference(reference_id);
let Some(parent) = ctx.nodes().parent_node(reference.node_id()) else {
return;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ impl Rule for NoUnsafeDeclarationMerging {
match node.kind() {
AstKind::Class(decl) => {
if let Some(ident) = decl.id.as_ref() {
for (_, symbol_id) in ctx.semantic().scopes().get_bindings(node.scope_id()) {
for (_, &symbol_id) in ctx.semantic().scopes().get_bindings(node.scope_id()) {
if let AstKind::TSInterfaceDeclaration(scope_interface) =
get_symbol_kind(*symbol_id, ctx)
get_symbol_kind(symbol_id, ctx)
{
check_and_diagnostic(ident, &scope_interface.id, ctx);
}
}
}
}
AstKind::TSInterfaceDeclaration(decl) => {
for (_, symbol_id) in ctx.semantic().scopes().get_bindings(node.scope_id()) {
if let AstKind::Class(scope_class) = get_symbol_kind(*symbol_id, ctx) {
for (_, &symbol_id) in ctx.semantic().scopes().get_bindings(node.scope_id()) {
if let AstKind::Class(scope_class) = get_symbol_kind(symbol_id, ctx) {
if let Some(scope_class_ident) = scope_class.id.as_ref() {
check_and_diagnostic(&decl.id, scope_class_ident, ctx);
}
Expand Down
9 changes: 4 additions & 5 deletions crates/oxc_linter/src/utils/jest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,10 @@ fn collect_ids_referenced_to_import<'a, 'c>(

if matches!(import_decl.source.value.as_str(), "@jest/globals" | "vitest") {
let original = find_original_name(import_decl, name);
let mut ret = vec![];
for reference_id in reference_ids {
ret.push((*reference_id, original));
}

let ret = reference_ids
.iter()
.map(|&reference_id| (reference_id, original))
.collect::<Vec<_>>();
return Some(ret);
}
}
Expand Down