Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(linter): use std::ptr::eq #5649

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
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl Rule for NoUselessSwitchCase {
let default_case = default_cases[0];

// Check if the `default` case is the last case
if std::ptr::from_ref(default_case) != std::ptr::from_ref(cases.last().unwrap()) {
if !std::ptr::eq(default_case, cases.last().unwrap()) {
Boshen marked this conversation as resolved.
Show resolved Hide resolved
return;
}

Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/unicorn/prefer_event_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Rule for PreferEventTarget {
return;
};

if std::ptr::from_ref(ident) != std::ptr::addr_of!(**callee_ident) {
if !std::ptr::eq(ident, callee_ident.as_ref()) {
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/unicorn/prefer_regexp_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Rule for PreferRegexpTest {
};

// Check if the `test` of the for statement is the same node as the call expression.
if std::ptr::addr_of!(**call_expr2) != std::ptr::from_ref(call_expr) {
if !std::ptr::eq(call_expr2.as_ref(), call_expr) {
return;
}
}
Expand All @@ -97,7 +97,7 @@ impl Rule for PreferRegexpTest {
};

// Check if the `test` of the conditional expression is the same node as the call expression.
if std::ptr::addr_of!(**call_expr2) != std::ptr::from_ref(call_expr) {
if !std::ptr::eq(call_expr2.as_ref(), call_expr) {
return;
}
}
Expand Down