Skip to content

Commit

Permalink
chore(deps): update dependency rust to v1.84.0 (#8391)
Browse files Browse the repository at this point in the history
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [rust](https://redirect.github.com/rust-lang/rust) | minor | `1.83.0` -> `1.84.0` |

---

### Release Notes

<details>
<summary>rust-lang/rust (rust)</summary>

### [`v1.84.0`](https://redirect.github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1840-2025-01-09)

[Compare Source](https://redirect.github.com/rust-lang/rust/compare/1.83.0...1.84.0)

\==========================

<a id="
Language"></a>

## Language

-   [Allow `#[deny]` inside `#[forbid]` as a no-op](https://redirect.github.com/rust-lang/rust/pull/121560/)
-   [Show a warning when `-Ctarget-feature` is used to toggle features that can lead to unsoundness due to ABI mismatches](https://redirect.github.com/rust-lang/rust/pull/129884)
-   [Use the next-generation trait solver in coherence](https://redirect.github.com/rust-lang/rust/pull/130654)
-   [Allow coercions to drop the principal of trait objects](https://redirect.github.com/rust-lang/rust/pull/131857)
-   [Support `/` as the path separator for `include!()` in all cases on Windows](https://redirect.github.com/rust-lang/rust/pull/125205)
-   [Taking a raw ref (`raw (const|mut)`) of a deref of a pointer (`*ptr`) is now safe](https://redirect.github.com/rust-lang/rust/pull/129248)
-   [Stabilize s390x inline assembly](https://redirect.github.com/rust-lang/rust/pull/131258)
-   [Stabilize Arm64EC inline assembly](https://redirect.github.com/rust-lang/rust/pull/131781)
-   [Lint against creating pointers to immediately dropped temporaries](https://redirect.github.com/rust-lang/rust/pull/128985)
-   [Execute drop glue when unwinding in an `extern "C"` function](https://redirect.github.com/rust-lang/rust/pull/129582)

<a id="1.84.0-Compiler"></a>

## Compiler

-   [Add `--print host-tuple` flag to print the host target tuple and affirm the "target tuple" terminology over "target triple"](https://redirect.github.com/rust-lang/rust/pull/125579)
-   [Declaring functions with a calling convention not supported on the current target now triggers a hard error](https://redirect.github.com/rust-lang/rust/pull/129935)
-   [Set up indirect access to external data for `loongarch64-unknown-linux-{musl,ohos}`](https://redirect.github.com/rust-lang/rust/pull/131583)
-   [Enable XRay instrumentation for LoongArch Linux targets](https://redirect.github.com/rust-lang/rust/pull/131818)
-   [Extend the `unexpected_cfgs` lint to also warn in external macros](https://redirect.github.com/rust-lang/rust/pull/132577)
-   [Stabilize WebAssembly `multivalue`, `reference-types`, and `tail-call` target features](https://redirect.github.com/rust-lang/rust/pull/131080)
-   [Added Tier 2 support for the `wasm32v1-none` target](https://redirect.github.com/rust-lang/rust/pull/131487)

<a id="1.84.0-Libraries"></a>

## Libraries

-   [Implement `From<&mut {slice}>` for `Box/Rc/Arc<{slice}>`](https://redirect.github.com/rust-lang/rust/pull/129329)
-   [Move `<float>::copysign`, `<float>::abs`, `<float>::signum` to `core`](https://redirect.github.com/rust-lang/rust/pull/131304)
-   [Add `LowerExp` and `UpperExp` implementations to `NonZero`](https://redirect.github.com/rust-lang/rust/pull/131377)
-   [Implement `FromStr` for `CString` and `TryFrom<CString>` for `String`](https://redirect.github.com/rust-lang/rust/pull/130608)
-   [`std::os::darwin` has been made public](https://redirect.github.com/rust-lang/rust/pull/123723)

<a id="1.84.0-Stabilized-APIs"></a>

## Stabilized APIs

-   [`Ipv6Addr::is_unique_local`](https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.is_unique_local)
-   [`Ipv6Addr::is_unicast_link_local`](https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.is_unicast_link_local)
-   [`core::ptr::with_exposed_provenance`](https://doc.rust-lang.org/stable/core/ptr/fn.with_exposed_provenance.html)
-   [`core::ptr::with_exposed_provenance_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.with_exposed_provenance_mut.html)
-   [`<ptr>::addr`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.addr)
-   [`<ptr>::expose_provenance`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.expose_provenance)
-   [`<ptr>::with_addr`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.with_addr)
-   [`<ptr>::map_addr`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.map_addr)
-   [`<int>::isqrt`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.isqrt)
-   [`<int>::checked_isqrt`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.checked_isqrt)
-   [`<uint>::isqrt`](https://doc.rust-lang.org/stable/core/primitive.u32.html#method.isqrt)
-   [`NonZero::isqrt`](https://doc.rust-lang.org/stable/core/num/struct.NonZero.html#impl-NonZero%3Cu128%3E/method.isqrt)
-   [`core::ptr::without_provenance`](https://doc.rust-lang.org/stable/core/ptr/fn.without_provenance.html)
-   [`core::ptr::without_provenance_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.without_provenance_mut.html)
-   [`core::ptr::dangling`](https://doc.rust-lang.org/stable/core/ptr/fn.dangling.html)
-   [`core::ptr::dangling_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.dangling_mut.html)

These APIs are now stable in const contexts

-   [`AtomicBool::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicBool.html#method.from_ptr)
-   [`AtomicPtr::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicPtr.html#method.from_ptr)
-   [`AtomicU8::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU8.html#method.from_ptr)
-   [`AtomicU16::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU16.html#method.from_ptr)
-   [`AtomicU32::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU32.html#method.from_ptr)
-   [`AtomicU64::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU64.html#method.from_ptr)
-   [`AtomicUsize::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicUsize.html#method.from_ptr)
-   [`AtomicI8::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI8.html#method.from_ptr)
-   [`AtomicI16::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI16.html#method.from_ptr)
-   [`AtomicI32::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI32.html#method.from_ptr)
-   [`AtomicI64::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI64.html#method.from_ptr)
-   [`AtomicIsize::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicIsize.html#method.from_ptr)
-   [`<ptr>::is_null`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_null-1)
-   [`<ptr>::as_ref`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.as_ref-1)
-   [`<ptr>::as_mut`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.as_mut)
-   [`Pin::new`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.new)
-   [`Pin::new_unchecked`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.new_unchecked)
-   [`Pin::get_ref`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.get_ref)
-   [`Pin::into_ref`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.into_ref)
-   [`Pin::get_mut`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.get_mut)
-   [`Pin::get_unchecked_mut`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.get_unchecked_mut)
-   [`Pin::static_ref`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.static_ref)
-   [`Pin::static_mut`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.static_mut)

<a id="1.84.0-Cargo"></a>

## Cargo

-   [Stabilize MSRV-aware resolver config](https://redirect.github.com/rust-lang/cargo/pull/14639/)
-   [Stabilize resolver v3](https://redirect.github.com/rust-lang/cargo/pull/14754/)

<a id="1.84-Rustdoc"></a>

## Rustdoc

-   [rustdoc-search: improve type-driven search](https://redirect.github.com/rust-lang/rust/pull/127589)

<a id="1.84.0-Compatibility-Notes"></a>

## Compatibility Notes

-   [Enable by default the `LSX` target feature for LoongArch Linux targets](https://redirect.github.com/rust-lang/rust/pull/132140)
-   [The unstable `-Zprofile` flag (“gcov-style” coverage instrumentation) has been removed.](https://redirect.github.com/rust-lang/rust/pull/131829) This does not affect the stable flags for coverage instrumentation (`-Cinstrument-coverage`) and profile-guided optimization (`-Cprofile-generate`, `-Cprofile-use`), which are unrelated and remain available.
-   Support for the target named `wasm32-wasi` has been removed as the target is now named `wasm32-wasip1`. This completes the [transition](https://redirect.github.com/rust-lang/compiler-team/issues/607) [plan](https://redirect.github.com/rust-lang/compiler-team/issues/695) for this target following [the introduction of `wasm32-wasip1`](https://redirect.github.com/rust-lang/rust/pull/120468) in Rust 1.78. Compiler warnings on [use of `wasm32-wasi`](https://redirect.github.com/rust-lang/rust/pull/126662) introduced in Rust 1.81 are now gone as well as the target is removed.
-   [The syntax `&pin (mut|const) T` is now parsed as a type which in theory could affect macro expansion results in some edge cases](https://redirect.github.com/rust-lang/rust/pull/130635#issuecomment-2375462821)
-   [Legacy syntax for calling `std::arch` functions is no longer permitted to declare items or bodies (such as closures, inline consts, or async blocks).](https://redirect.github.com/rust-lang/rust/pull/130443#issuecomment-2445678945)
-   The `wasm32-unknown-emscripten` target's binary release of the standard library is now [built with the latest emsdk 3.1.68](https://redirect.github.com/rust-lang/rust/pull/131533), which fixes an ABI-incompatibility with Emscripten >= 3.1.42. If you are locally using a version of emsdk with an incompatible ABI (e.g. before 3.1.42 or a future one), you should build your code with `-Zbuild-std` to ensure that `std` uses the correct ABI.
-   [Declaring functions with a calling convention not supported on the current target now triggers a hard error](https://redirect.github.com/rust-lang/rust/pull/129935)
-   [The next-generation trait solver is now enabled for coherence, fixing multiple soundness issues](https://redirect.github.com/rust-lang/rust/pull/130654)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - "before 11am on monday" in timezone Asia/Shanghai.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS45Mi4wIiwidXBkYXRlZEluVmVyIjoiMzkuOTIuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
  • Loading branch information
renovate[bot] committed Jan 9, 2025
1 parent 3feac27 commit 772b71c
Show file tree
Hide file tree
Showing 47 changed files with 109 additions and 113 deletions.
2 changes: 1 addition & 1 deletion crates/oxc_ast/src/ast_impl/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ impl ExportNamedDeclaration<'_> {
#[allow(missing_docs)]
pub fn is_typescript_syntax(&self) -> bool {
self.export_kind == ImportOrExportKind::Type
|| self.declaration.as_ref().map_or(false, Declaration::is_typescript_syntax)
|| self.declaration.as_ref().is_some_and(Declaration::is_typescript_syntax)
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_diagnostics/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl DiagnosticService {
/// Check if the max warning threshold, as set by
/// [`with_max_warnings`](DiagnosticService::with_max_warnings), has been exceeded.
pub fn max_warnings_exceeded(&self) -> bool {
self.max_warnings.map_or(false, |max_warnings| self.warnings_count.get() > max_warnings)
self.max_warnings.is_some_and(|max_warnings| self.warnings_count.get() > max_warnings)
}

/// Wrap [diagnostics] with the source code and path, converting them into [Error]s.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl<'a> CheckForStateChange<'a, '_> for VariableDeclarator<'a> {
|| self
.init
.as_ref()
.map_or(false, |init| init.check_for_state_change(check_for_new_objects))
.is_some_and(|init| init.check_for_state_change(check_for_new_objects))
}
}

Expand Down Expand Up @@ -294,7 +294,7 @@ impl CheckForStateChange<'_, '_> for AssignmentTargetProperty<'_> {
) => assignment_target_property_identifier
.init
.as_ref()
.map_or(false, |init| init.check_for_state_change(check_for_new_objects)),
.is_some_and(|init| init.check_for_state_change(check_for_new_objects)),
AssignmentTargetProperty::AssignmentTargetPropertyProperty(
assignment_target_property_property,
) => {
Expand Down
6 changes: 3 additions & 3 deletions crates/oxc_ecmascript/src/string_to_number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ impl StringToNumber for &str {
let mut bytes = s.trim_start_matches(['-', '+']).bytes();
if bytes
.next()
.filter(|c| c.to_ascii_lowercase() == b'i')
.and_then(|_| bytes.next().filter(|c| c.to_ascii_lowercase() == b'n'))
.and_then(|_| bytes.next().filter(|c| c.to_ascii_lowercase() == b'f'))
.filter(|c| c.eq_ignore_ascii_case(&b'i'))
.and_then(|_| bytes.next().filter(|c| c.eq_ignore_ascii_case(&b'n')))
.and_then(|_| bytes.next().filter(|c| c.eq_ignore_ascii_case(&b'f')))
.is_some()
{
return f64::NAN;
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_isolated_declarations/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ impl<'a> IsolatedDeclarations<'a> {
if can_expando_function_names.contains(&ident.name)
&& !assignable_properties_for_namespace
.get(&ident.name.as_str())
.map_or(false, |properties| {
.is_some_and(|properties| {
properties.contains(&static_member_expr.property.name)
})
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl IsolatedLintHandler {

path.extension()
.and_then(std::ffi::OsStr::to_str)
.map_or(false, |ext| wanted_exts.contains(ext))
.is_some_and(|ext| wanted_exts.contains(ext))
}

fn wrap_diagnostics(
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/ast_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl<'a> IsConstant<'a, '_> for Expression<'a> {
Self::TemplateLiteral(template) => {
let test_quasis = in_boolean_position
&& template.quasis.iter().any(|quasi| {
quasi.value.cooked.as_ref().map_or(false, |cooked| !cooked.is_empty())
quasi.value.cooked.as_ref().is_some_and(|cooked| !cooked.is_empty())
});
let test_expressions =
template.expressions.iter().all(|expr| expr.is_constant(false, semantic));
Expand Down Expand Up @@ -125,7 +125,7 @@ impl<'a> IsConstant<'a, '_> for Expression<'a> {
.expressions
.iter()
.last()
.map_or(false, |last| last.is_constant(in_boolean_position, semantic)),
.is_some_and(|last| last.is_constant(in_boolean_position, semantic)),
Self::CallExpression(call_expr) => call_expr.is_constant(in_boolean_position, semantic),
Self::ParenthesizedExpression(paren_expr) => {
paren_expr.expression.is_constant(in_boolean_position, semantic)
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/options/allow_warn_deny.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl TryFrom<&Value> for AllowWarnDeny {

fn invalid_int_severity<D: Display>(value: D) -> OxcDiagnostic {
OxcDiagnostic::error(format!(
r#"Failed to parse rule severity, expected one of `0`, `1` or `2`, but got {value}"#
r"Failed to parse rule severity, expected one of `0`, `1` or `2`, but got {value}"
))
}

Expand Down
3 changes: 1 addition & 2 deletions crates/oxc_linter/src/rules/eslint/func_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,7 @@ impl Rule for FuncNames {
|name| {
// if this name shadows a variable in the outer scope **and** that name is referenced
// inside the function body, it is unsafe to add a name to this function
if ctx.scopes().find_binding(func.scope_id(), &name).map_or(
false,
if ctx.scopes().find_binding(func.scope_id(), &name).is_some_and(
|shadowed_var| {
ctx.semantic().symbol_references(shadowed_var).any(
|reference| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl NoConstantBinaryExpression {
.expressions
.iter()
.last()
.map_or(false, |last| Self::has_constant_nullishness(last, non_nullish, ctx)),
.is_some_and(|last| Self::has_constant_nullishness(last, non_nullish, ctx)),
Expression::Identifier(_) => expr.evaluate_to_undefined(),
_ => false,
}
Expand Down Expand Up @@ -255,7 +255,7 @@ impl NoConstantBinaryExpression {
.expressions
.iter()
.last()
.map_or(false, |last| Self::has_constant_loose_boolean_comparison(last, ctx)),
.is_some_and(|last| Self::has_constant_loose_boolean_comparison(last, ctx)),
Expression::ParenthesizedExpression(paren_expr) => {
Self::has_constant_loose_boolean_comparison(&paren_expr.expression, ctx)
}
Expand Down Expand Up @@ -321,7 +321,7 @@ impl NoConstantBinaryExpression {
.expressions
.iter()
.last()
.map_or(false, |last| Self::has_constant_strict_boolean_comparison(last, ctx)),
.is_some_and(|last| Self::has_constant_strict_boolean_comparison(last, ctx)),
Expression::ParenthesizedExpression(paren_expr) => {
Self::has_constant_strict_boolean_comparison(&paren_expr.expression, ctx)
}
Expand Down Expand Up @@ -350,7 +350,7 @@ impl NoConstantBinaryExpression {
.expressions
.iter()
.last()
.map_or(false, |last| Self::is_always_new(last, ctx)),
.is_some_and(|last| Self::is_always_new(last, ctx)),
Expression::AssignmentExpression(assignment_expr)
if assignment_expr.operator == AssignmentOperator::Assign =>
{
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ declare_oxc_lint!(

impl Rule for NoEval {
fn from_configuration(value: serde_json::Value) -> Self {
let allow_indirect = value.get(0).map_or(false, |config| {
let allow_indirect = value.get(0).is_some_and(|config| {
config.get("allowIndirect").and_then(serde_json::Value::as_bool).unwrap_or(false)
});

Expand Down
8 changes: 4 additions & 4 deletions crates/oxc_linter/src/rules/eslint/no_extra_boolean_cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ fn is_bool_fn_or_constructor_call(node: &AstNode) -> bool {

fn is_first_arg(node: &AstNode, parent: &AstNode) -> bool {
match parent.kind() {
AstKind::CallExpression(expr) => expr.arguments.first().map_or(false, |arg| {
AstKind::CallExpression(expr) => expr.arguments.first().is_some_and(|arg| {
if let Some(expr) = arg.as_expression() {
expr.without_parentheses().span() == node.kind().span()
} else {
false
}
}),
AstKind::NewExpression(expr) => expr.arguments.first().map_or(false, |arg| {
AstKind::NewExpression(expr) => expr.arguments.first().is_some_and(|arg| {
if let Some(expr) = arg.as_expression() {
expr.without_parentheses().span() == node.kind().span()
} else {
Expand All @@ -155,7 +155,7 @@ fn is_first_arg(node: &AstNode, parent: &AstNode) -> bool {
}

fn is_inside_test_condition(node: &AstNode, ctx: &LintContext) -> bool {
get_real_parent(node, ctx).map_or(false, |parent| match parent.kind() {
get_real_parent(node, ctx).is_some_and(|parent| match parent.kind() {
AstKind::IfStatement(stmt) => {
let expr_span = stmt.test.get_inner_expression().without_parentheses().span();
expr_span == node.kind().span()
Expand All @@ -172,7 +172,7 @@ fn is_inside_test_condition(node: &AstNode, ctx: &LintContext) -> bool {
let expr_span = stmt.test.get_inner_expression().without_parentheses().span();
expr_span == node.kind().span()
}
AstKind::ForStatement(stmt) => stmt.test.as_ref().map_or(false, |expr| {
AstKind::ForStatement(stmt) => stmt.test.as_ref().is_some_and(|expr| {
let expr_span = expr.get_inner_expression().without_parentheses().span();
expr_span == node.kind().span()
}),
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/no_undef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl Rule for NoUndef {
}

fn has_typeof_operator(node: &AstNode<'_>, ctx: &LintContext<'_>) -> bool {
ctx.nodes().parent_node(node.id()).map_or(false, |parent| match parent.kind() {
ctx.nodes().parent_node(node.id()).is_some_and(|parent| match parent.kind() {
AstKind::UnaryExpression(expr) => expr.operator == UnaryOperator::Typeof,
AstKind::ParenthesizedExpression(_) => has_typeof_operator(parent, ctx),
_ => false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl<'a> HasAnyUsedBinding<'a> for ObjectPattern<'a> {
return true;
}
self.properties.iter().any(|p| p.value.has_any_used_binding(ctx))
|| self.rest.as_ref().map_or(false, |rest| rest.argument.has_any_used_binding(ctx))
|| self.rest.as_ref().is_some_and(|rest| rest.argument.has_any_used_binding(ctx))
}
}
impl<'a> HasAnyUsedBinding<'a> for ArrayPattern<'a> {
Expand All @@ -66,6 +66,6 @@ impl<'a> HasAnyUsedBinding<'a> for ArrayPattern<'a> {
// if the destructured element is ignored, it is considered used
el.get_identifier().is_some_and(|name| ctx.options.is_ignored_array_destructured(&name))
|| el.has_any_used_binding(ctx)
}) || self.rest.as_ref().map_or(false, |rest| rest.argument.has_any_used_binding(ctx))
}) || self.rest.as_ref().is_some_and(|rest| rest.argument.has_any_used_binding(ctx))
}
}
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/eslint/valid_typeof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl Rule for ValidTypeof {
}

fn from_configuration(value: serde_json::Value) -> Self {
let require_string_literals = value.get(0).map_or(false, |config| {
let require_string_literals = value.get(0).is_some_and(|config| {
config
.get("requireStringLiterals")
.and_then(serde_json::Value::as_bool)
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/jest/no_large_snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ impl Rule for NoLargeSnapshots {
}

fn run_once(&self, ctx: &LintContext) {
let is_snap = ctx.file_path().to_str().map_or(false, |p| {
Path::new(p).extension().map_or(false, |ext| ext.eq_ignore_ascii_case("snap"))
let is_snap = ctx.file_path().to_str().is_some_and(|p| {
Path::new(p).extension().is_some_and(|ext| ext.eq_ignore_ascii_case("snap"))
});

if is_snap {
Expand Down
4 changes: 1 addition & 3 deletions crates/oxc_linter/src/rules/jest/no_restricted_matchers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ impl NoRestrictedMatchers {

fn check_restriction(chain_call: &str, restriction: &str) -> bool {
if MODIFIER_NAME.contains(restriction)
|| Path::new(restriction)
.extension()
.map_or(false, |ext| ext.eq_ignore_ascii_case("not"))
|| Path::new(restriction).extension().is_some_and(|ext| ext.eq_ignore_ascii_case("not"))
{
return chain_call.starts_with(restriction);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/prefer_jest_mocked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl PreferJestMocked {

fn can_fix<'a>(node: &AstNode<'a>, ctx: &LintContext<'a>) -> bool {
outermost_paren_parent(node, ctx)
.map_or(false, |parent| !matches!(parent.kind(), AstKind::SimpleAssignmentTarget(_)))
.is_some_and(|parent| !matches!(parent.kind(), AstKind::SimpleAssignmentTarget(_)))
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jest/valid_title.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ fn validate_title(

if !valid_title.disallowed_words.is_empty() {
let Ok(disallowed_words_reg) = regex::Regex::new(&format!(
r#"(?iu)\b(?:{})\b"#,
r"(?iu)\b(?:{})\b",
valid_title.disallowed_words.join("|").cow_replace('.', r"\.")
)) else {
return;
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jsdoc/check_tag_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl Rule for CheckTagNames {
let config = &self.0;
let user_defined_tags = settings.list_user_defined_tag_names();

let is_dts = ctx.file_path().to_str().map_or(false, |p| p.ends_with(".d.ts"));
let is_dts = ctx.file_path().to_str().is_some_and(|p| p.ends_with(".d.ts"));
// NOTE: The original rule seems to check `declare` context by visiting AST nodes.
// https://github.com/gajus/eslint-plugin-jsdoc/blob/e343ab5b1efaa59b07c600138aee070b4083857e/src/rules/checkTagNames.js#L121
// But...
Expand Down
22 changes: 11 additions & 11 deletions crates/oxc_linter/src/rules/jsx_a11y/alt_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ impl Rule for AltText {
// <input type="image">
if let Some(custom_tags) = &self.input_type_image {
let has_input_with_type_image = name.eq_ignore_ascii_case("input")
&& has_jsx_prop_ignore_case(jsx_el, "type").map_or(false, |v| {
get_string_literal_prop_value(v).map_or(false, |v| v == "image")
&& has_jsx_prop_ignore_case(jsx_el, "type").is_some_and(|v| {
get_string_literal_prop_value(v).is_some_and(|v| v == "image")
});
if has_input_with_type_image || custom_tags.iter().any(|i| i == name) {
input_type_image_rule(jsx_el, ctx);
Expand All @@ -231,7 +231,7 @@ fn is_valid_alt_prop(item: &JSXAttributeItem<'_>) -> bool {

fn is_presentation_role<'a>(item: &'a JSXAttributeItem<'a>) -> bool {
get_string_literal_prop_value(item)
.map_or(false, |value| value == "presentation" || value == "none")
.is_some_and(|value| value == "presentation" || value == "none")
}

fn aria_label_has_value<'a>(item: &'a JSXAttributeItem<'a>) -> bool {
Expand All @@ -253,7 +253,7 @@ fn img_rule<'a>(node: &'a JSXOpeningElement<'a>, ctx: &LintContext<'a>) {
return;
}

if has_jsx_prop_ignore_case(node, "role").map_or(false, is_presentation_role) {
if has_jsx_prop_ignore_case(node, "role").is_some_and(is_presentation_role) {
ctx.diagnostic(prefer_alt(node.span));
return;
}
Expand Down Expand Up @@ -281,13 +281,13 @@ fn object_rule<'a>(
ctx: &LintContext<'a>,
) {
let has_aria_label =
has_jsx_prop_ignore_case(node, "aria-label").map_or(false, aria_label_has_value);
has_jsx_prop_ignore_case(node, "aria-label").is_some_and(aria_label_has_value);
let has_aria_labelledby =
has_jsx_prop_ignore_case(node, "aria-labelledby").map_or(false, aria_label_has_value);
has_jsx_prop_ignore_case(node, "aria-labelledby").is_some_and(aria_label_has_value);
let has_label = has_aria_label || has_aria_labelledby;
let has_title_attr = has_jsx_prop_ignore_case(node, "title")
.and_then(get_string_literal_prop_value)
.map_or(false, |v| !v.is_empty());
.is_some_and(|v| !v.is_empty());

if has_label || has_title_attr || object_has_accessible_child(ctx, parent) {
return;
Expand All @@ -297,9 +297,9 @@ fn object_rule<'a>(

fn area_rule<'a>(node: &'a JSXOpeningElement<'a>, ctx: &LintContext<'a>) {
let has_aria_label =
has_jsx_prop_ignore_case(node, "aria-label").map_or(false, aria_label_has_value);
has_jsx_prop_ignore_case(node, "aria-label").is_some_and(aria_label_has_value);
let has_aria_labelledby =
has_jsx_prop_ignore_case(node, "aria-labelledby").map_or(false, aria_label_has_value);
has_jsx_prop_ignore_case(node, "aria-labelledby").is_some_and(aria_label_has_value);
let has_label = has_aria_label || has_aria_labelledby;
if has_label {
return;
Expand All @@ -318,9 +318,9 @@ fn area_rule<'a>(node: &'a JSXOpeningElement<'a>, ctx: &LintContext<'a>) {

fn input_type_image_rule<'a>(node: &'a JSXOpeningElement<'a>, ctx: &LintContext<'a>) {
let has_aria_label =
has_jsx_prop_ignore_case(node, "aria-label").map_or(false, aria_label_has_value);
has_jsx_prop_ignore_case(node, "aria-label").is_some_and(aria_label_has_value);
let has_aria_labelledby =
has_jsx_prop_ignore_case(node, "aria-labelledby").map_or(false, aria_label_has_value);
has_jsx_prop_ignore_case(node, "aria-labelledby").is_some_and(aria_label_has_value);
let has_label = has_aria_label || has_aria_labelledby;
if has_label {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn is_valid_tab_index_attr(attr: &JSXAttribute) -> bool {
attr.value
.as_ref()
.and_then(|value| parse_jsx_value(value).ok())
.map_or(false, |parsed_value| parsed_value < -1.0)
.is_some_and(|parsed_value| parsed_value < -1.0)
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jsx_a11y/autocomplete_valid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ fn is_valid_autocomplete_value(value: &str) -> bool {
1 => VALID_AUTOCOMPLETE_VALUES.contains(parts[0]),
2 => VALID_AUTOCOMPLETE_COMBINATIONS
.get(parts[0])
.map_or(false, |valid_suffixes| valid_suffixes.contains(parts[1])),
.is_some_and(|valid_suffixes| valid_suffixes.contains(parts[1])),
_ => false,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fn is_focusable<'a>(ctx: &LintContext<'a>, element: &JSXOpeningElement<'a>) -> b

if let Some(JSXAttributeItem::Attribute(attr)) = has_jsx_prop_ignore_case(element, "tabIndex") {
if let Some(attr_value) = &attr.value {
return parse_jsx_value(attr_value).map_or(false, |num| num >= 0.0);
return parse_jsx_value(attr_value).is_ok_and(|num| num >= 0.0);
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jsx_a11y/no_redundant_roles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl Rule for NoRedundantRoles {
let roles = role_values.value.split_whitespace().collect::<Vec<_>>();
for role in &roles {
let exceptions = DEFAULT_ROLE_EXCEPTIONS.get(&component);
if exceptions.map_or(false, |set| set.contains(role)) {
if exceptions.is_some_and(|set| set.contains(role)) {
ctx.diagnostic_with_fix(
no_redundant_roles_diagnostic(attr.span, &component, role),
|fixer| fixer.delete_range(attr.span),
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/rules/nextjs/no_page_custom_font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ impl Rule for NoPageCustomFont {
return;
}

let in_document = ctx.file_path().file_name().map_or(false, |file_name| {
file_name.to_str().map_or(false, |file_name| file_name.starts_with("_document."))
let in_document = ctx.file_path().file_name().is_some_and(|file_name| {
file_name.to_str().is_some_and(|file_name| file_name.starts_with("_document."))
});
let span = ctx.nodes().parent_kind(node.id()).unwrap().span();
let diagnostic = if in_document {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl Rule for PreferAwaitToCallbacks {
return;
}

let is_lodash = expr.callee.as_member_expression().map_or(false, |mem_expr| {
let is_lodash = expr.callee.as_member_expression().is_some_and( |mem_expr| {
matches!(mem_expr.object(), Expression::Identifier(id) if matches!(id.name.as_str(), "_" | "lodash" | "underscore"))
});

Expand Down
Loading

0 comments on commit 772b71c

Please sign in to comment.