mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
refactor(linter): use std::ptr::eq (#5649)
Follow-on after #5577. `!std::ptr::eq(x, y)` is more idiomatic than `std::ptr::from_ref(x) != std::ptr::from_ref(y)`.
This commit is contained in:
parent
19cdcc565c
commit
c8bc6f0549
3 changed files with 4 additions and 4 deletions
|
|
@ -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()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue