From a788a64649cf10ac765d2b7e8f3211548b258aed Mon Sep 17 00:00:00 2001
From: renovate <29139614+renovate@users.noreply.github.com>
Date: Fri, 4 Apr 2025 07:43:00 +0000
Subject: [PATCH] chore(deps): update dependency rust to v1.86.0 (#10196)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This PR contains the following updates:
| Package | Update | Change |
|---|---|---|
| [rust](https://redirect.github.com/rust-lang/rust) | minor | `1.85.1` -> `1.86.0` |
---
### Release Notes
rust-lang/rust (rust)
### [`v1.86.0`](https://redirect.github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1860-2025-04-03)
[Compare Source](https://redirect.github.com/rust-lang/rust/compare/1.85.1...1.86.0)
\==========================
## Language
- [Stabilize upcasting trait objects to supertraits.](https://redirect.github.com/rust-lang/rust/pull/134367)
- [Allow safe functions to be marked with the `#[target_feature]` attribute.](https://redirect.github.com/rust-lang/rust/pull/134090)
- [The `missing_abi` lint now warns-by-default.](https://redirect.github.com/rust-lang/rust/pull/132397)
- Rust now lints about double negations, to catch cases that might have intended to be a prefix decrement operator (`--x`) as written in other languages. This was previously a clippy lint, `clippy::double_neg`, and is [now available directly in Rust as `double_negations`.](https://redirect.github.com/rust-lang/rust/pull/126604)
- [More pointers are now detected as definitely not-null based on their alignment in const eval.](https://redirect.github.com/rust-lang/rust/pull/133700)
- [Empty `repr()` attribute applied to invalid items are now correctly rejected.](https://redirect.github.com/rust-lang/rust/pull/133925)
- [Inner attributes `#![test]` and `#![rustfmt::skip]` are no longer accepted in more places than intended.](https://redirect.github.com/rust-lang/rust/pull/134276)
## Compiler
- [Debug-assert that raw pointers are non-null on access.](https://redirect.github.com/rust-lang/rust/pull/134424)
- [Change `-O` to mean `-C opt-level=3` instead of `-C opt-level=2` to match Cargo's defaults.](https://redirect.github.com/rust-lang/rust/pull/135439)
- [Fix emission of `overflowing_literals` under certain macro environments.](https://redirect.github.com/rust-lang/rust/pull/136393)
## Platform Support
- [Replace `i686-unknown-redox` target with `i586-unknown-redox`.](https://redirect.github.com/rust-lang/rust/pull/136698)
- [Increase baseline CPU of `i686-unknown-hurd-gnu` to Pentium 4.](https://redirect.github.com/rust-lang/rust/pull/136700)
- New tier 3 targets:
- [`{aarch64-unknown,x86_64-pc}-nto-qnx710_iosock`](https://redirect.github.com/rust-lang/rust/pull/133631).
For supporting Neutrino QNX 7.1 with `io-socket` network stack.
- [`{aarch64-unknown,x86_64-pc}-nto-qnx800`](https://redirect.github.com/rust-lang/rust/pull/133631).
For supporting Neutrino QNX 8.0 (`no_std`-only).
- [`{x86_64,i686}-win7-windows-gnu`](https://redirect.github.com/rust-lang/rust/pull/134609).
Intended for backwards compatibility with Windows 7. `{x86_64,i686}-win7-windows-msvc` are the Windows MSVC counterparts that already exist as Tier 3 targets.
- [`amdgcn-amd-amdhsa`](https://redirect.github.com/rust-lang/rust/pull/134740).
- [`x86_64-pc-cygwin`](https://redirect.github.com/rust-lang/rust/pull/134999).
- [`{mips,mipsel}-mti-none-elf`](https://redirect.github.com/rust-lang/rust/pull/135074).
Initial bare-metal support.
- [`m68k-unknown-none-elf`](https://redirect.github.com/rust-lang/rust/pull/135085).
- [`armv7a-nuttx-{eabi,eabihf}`, `aarch64-unknown-nuttx`, and `thumbv7a-nuttx-{eabi,eabihf}`](https://redirect.github.com/rust-lang/rust/pull/135757).
Refer to Rust's \[platform support page]\[platform-support-doc]
for more information on Rust's tiered platform support.
## Libraries
- The type of `FromBytesWithNulError` in `CStr::from_bytes_with_nul(bytes: &[u8]) -> Result<&Self, FromBytesWithNulError>` was [changed from an opaque struct to an enum](https://redirect.github.com/rust-lang/rust/pull/134143), allowing users to examine why the conversion failed.
- [Remove `RustcDecodable` and `RustcEncodable`.](https://redirect.github.com/rust-lang/rust/pull/134272)
- [Deprecate libtest's `--logfile` option.](https://redirect.github.com/rust-lang/rust/pull/134283)
- [On recent versions of Windows, `std::fs::remove_file` will now remove read-only files.](https://redirect.github.com/rust-lang/rust/pull/134679)
## Stabilized APIs
- [`{float}::next_down`](https://doc.rust-lang.org/stable/std/primitive.f64.html#method.next_down)
- [`{float}::next_up`](https://doc.rust-lang.org/stable/std/primitive.f64.html#method.next_up)
- [`<[_]>::get_disjoint_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.get_disjoint_mut)
- [`<[_]>::get_disjoint_unchecked_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.get_disjoint_unchecked_mut)
- [`slice::GetDisjointMutError`](https://doc.rust-lang.org/stable/std/slice/enum.GetDisjointMutError.html)
- [`HashMap::get_disjoint_mut`](https://doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html#method.get_disjoint_mut)
- [`HashMap::get_disjoint_unchecked_mut`](https://doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html#method.get_disjoint_unchecked_mut)
- [`NonZero::count_ones`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.count_ones)
- [`Vec::pop_if`](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.pop_if)
- [`sync::Once::wait`](https://doc.rust-lang.org/stable/std/sync/struct.Once.html#method.wait)
- [`sync::Once::wait_force`](https://doc.rust-lang.org/stable/std/sync/struct.Once.html#method.wait_force)
- [`sync::OnceLock::wait`](https://doc.rust-lang.org/stable/std/sync/struct.OnceLock.html#method.wait)
These APIs are now stable in const contexts:
- [`hint::black_box`](https://doc.rust-lang.org/stable/std/hint/fn.black_box.html)
- [`io::Cursor::get_mut`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.get_mut)
- [`io::Cursor::set_position`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.set_position)
- [`str::is_char_boundary`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.is_char_boundary)
- [`str::split_at`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at)
- [`str::split_at_checked`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at_checked)
- [`str::split_at_mut`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at_mut)
- [`str::split_at_mut_checked`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at_mut_checked)
## Cargo
- [When merging, replace rather than combine configuration keys that refer to a program path and its arguments.](https://redirect.github.com/rust-lang/cargo/pull/15066/)
- [Error if both `--package` and `--workspace` are passed but the requested package is missing.](https://redirect.github.com/rust-lang/cargo/pull/15071/) This was previously silently ignored, which was considered a bug since missing packages should be reported.
- [Deprecate the token argument in `cargo login` to avoid shell history leaks.](https://redirect.github.com/rust-lang/cargo/pull/15057/)
- [Simplify the implementation of `SourceID` comparisons.](https://redirect.github.com/rust-lang/cargo/pull/14980/) This may potentially change behavior if the canonicalized URL compares differently in alternative registries.
## Rustdoc
- [Add a sans-serif font setting.](https://redirect.github.com/rust-lang/rust/pull/133636)
## Compatibility Notes
- [The `wasm_c_abi` future compatibility warning is now a hard error.](https://redirect.github.com/rust-lang/rust/pull/133951)
Users of `wasm-bindgen` should upgrade to at least version 0.2.89, otherwise compilation will fail.
- [Remove long-deprecated no-op attributes `#![no_start]` and `#![crate_id]`.](https://redirect.github.com/rust-lang/rust/pull/134300)
- [The future incompatibility lint `cenum_impl_drop_cast` has been made into a hard error.](https://redirect.github.com/rust-lang/rust/pull/135964) This means it is now an error to cast a field-less enum to an integer if the enum implements `Drop`.
- [SSE2 is now required for "i686" 32-bit x86 hard-float targets; disabling it causes a warning that will become a hard error eventually.](https://redirect.github.com/rust-lang/rust/pull/137037)
To compile for pre-SSE2 32-bit x86, use a "i586" target instead.
## Internal Changes
These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.
- [Build the rustc on AArch64 Linux with ThinLTO + PGO.](https://redirect.github.com/rust-lang/rust/pull/133807)
The ARM 64-bit compiler (AArch64) on Linux is now optimized with ThinLTO and PGO, similar to the optimizations we have already performed for the x86-64 compiler on Linux. This should make it up to 30% faster.
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 **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.
---
- [ ] 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).
---
Cargo.toml | 2 ++
apps/oxlint/src/output_formatter/stylish.rs | 16 ++++++++++------
crates/oxc_codegen/src/comment.rs | 1 -
.../src/constant_evaluation/mod.rs | 4 ++--
crates/oxc_ecmascript/src/string_to_big_int.rs | 2 +-
crates/oxc_formatter/src/formatter/buffer.rs | 13 ++++---------
.../src/formatter/comments/mod.rs | 2 +-
.../src/formatter/format_element/document.rs | 4 ++--
.../oxc_formatter/src/formatter/printer/mod.rs | 2 --
crates/oxc_isolated_declarations/src/class.rs | 2 +-
crates/oxc_isolated_declarations/tests/mod.rs | 7 ++++---
.../oxc_language_server/src/linter/tester.rs | 18 +++++++++---------
crates/oxc_linter/src/ast_util.rs | 2 +-
.../src/loader/partial_loader/astro.rs | 5 +++--
.../src/loader/partial_loader/svelte.rs | 4 ++--
.../src/loader/partial_loader/vue.rs | 4 ++--
.../src/rules/eslint/default_case.rs | 2 +-
.../src/rules/eslint/guard_for_in.rs | 2 +-
.../src/rules/eslint/no_fallthrough.rs | 2 +-
.../src/rules/eslint/no_lone_blocks.rs | 2 +-
.../src/rules/eslint/no_loss_of_precision.rs | 2 +-
.../src/rules/eslint/no_object_constructor.rs | 2 +-
.../src/rules/eslint/no_regex_spaces.rs | 4 ++--
.../src/rules/eslint/no_useless_escape.rs | 2 +-
.../src/rules/eslint/prefer_object_has_own.rs | 2 +-
.../eslint/prefer_promise_reject_errors.rs | 6 +++---
.../src/rules/eslint/symbol_description.rs | 2 +-
.../oxc_linter/src/rules/import/no_commonjs.rs | 2 +-
.../src/rules/jest/no_large_snapshots.rs | 2 +-
.../oxc_linter/src/rules/jest/prefer_to_be.rs | 2 +-
.../src/rules/jest/require_to_throw_message.rs | 2 +-
.../src/rules/jest/valid_describe_callback.rs | 2 +-
.../src/rules/nextjs/inline_script_id.rs | 2 +-
...fore_interactive_script_outside_document.rs | 2 +-
.../src/rules/nextjs/no_unwanted_polyfillio.rs | 2 +-
.../src/rules/typescript/array_type.rs | 2 +-
.../typescript/consistent_type_imports.rs | 6 +++---
.../rules/typescript/no_empty_object_type.rs | 6 +++---
.../typescript/prefer_literal_enum_member.rs | 2 +-
.../src/rules/unicorn/consistent_date_clone.rs | 2 +-
.../unicorn/no_object_as_default_parameter.rs | 2 +-
.../src/rules/unicorn/no_static_only_class.rs | 4 ++--
.../src/rules/unicorn/no_thenable.rs | 2 +-
.../unicorn/no_useless_fallback_in_spread.rs | 2 +-
.../src/rules/unicorn/no_useless_undefined.rs | 2 +-
.../prefer_native_coercion_functions.rs | 6 +++---
.../src/rules/unicorn/prefer_query_selector.rs | 2 +-
.../src/rules/unicorn/prefer_spread.rs | 4 ++--
.../src/rules/unicorn/prefer_type_error.rs | 2 +-
.../src/rules/vitest/prefer_to_be_truthy.rs | 2 +-
crates/oxc_linter/src/utils/unicorn.rs | 6 +++---
.../oxc_macros/src/declare_all_lint_rules.rs | 2 +-
crates/oxc_parser/src/js/function.rs | 4 ++--
crates/oxc_parser/src/lexer/search.rs | 18 ++++++++++--------
crates/oxc_semantic/src/checker/javascript.rs | 2 +-
crates/oxc_semantic/src/checker/typescript.rs | 1 -
.../src/es2015/arrow_functions.rs | 4 ++--
.../es2022/class_properties/class_bindings.rs | 6 +++---
.../es2022/class_properties/private_field.rs | 15 ++++++++-------
rust-toolchain.toml | 2 +-
tasks/ast_tools/src/generators/typescript.rs | 8 ++++----
tasks/ast_tools/src/schema/derives.rs | 2 +-
tasks/common/src/test_file.rs | 2 +-
tasks/minsize/src/lib.rs | 15 +++++++++------
tasks/prettier_conformance/src/lib.rs | 12 ++++++++----
tasks/rulegen/src/main.rs | 4 ++--
tasks/transform_conformance/src/lib.rs | 3 ++-
tasks/website/src/linter/rules/html.rs | 3 +--
68 files changed, 148 insertions(+), 139 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index a9f07c4c1cb3c..8027f00e20eef 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -74,6 +74,8 @@ similar_names = "allow"
fn_params_excessive_bools = "allow"
complexity = { level = "warn", priority = -1 }
too_many_arguments = "allow"
+non_std_lazy_statics = "allow"
+needless_continue = "allow" # FIXME
# nursery
nursery = { level = "warn", priority = -1 }
# `const` functions do not make sense for our project because this is not a `const` library.
diff --git a/apps/oxlint/src/output_formatter/stylish.rs b/apps/oxlint/src/output_formatter/stylish.rs
index e2799de9c4cd7..891dc6db7a7a1 100644
--- a/apps/oxlint/src/output_formatter/stylish.rs
+++ b/apps/oxlint/src/output_formatter/stylish.rs
@@ -1,3 +1,5 @@
+use std::fmt::Write;
+
use oxc_diagnostics::{
Error, Severity,
reporter::{DiagnosticReporter, DiagnosticResult, Info},
@@ -70,7 +72,7 @@ fn format_stylish(diagnostics: &[Error]) -> String {
.max()
.unwrap_or(0);
- output.push_str(&format!("\n\u{1b}[4m{filename}\u{1b}[0m\n"));
+ let _ = write!(output, "\n\u{1b}[4m{filename}\u{1b}[0m\n");
for diagnostic in diagnostics {
match diagnostic.severity() {
@@ -87,8 +89,9 @@ fn format_stylish(diagnostics: &[Error]) -> String {
let info = Info::new(diagnostic);
let rule = diagnostic.code().map_or_else(String::new, |code| code.to_string());
let position = format!("{}:{}", info.start.line, info.start.column);
- output.push_str(
- &format!(" \u{1b}[2m{position:max_len_width$}\u{1b}[0m {severity_str} {diagnostic} \u{1b}[2m{rule}\u{1b}[0m\n"),
+ let _ = writeln!(
+ output,
+ " \u{1b}[2m{position:max_len_width$}\u{1b}[0m {severity_str} {diagnostic} \u{1b}[2m{rule}\u{1b}[0m"
);
}
}
@@ -96,12 +99,13 @@ fn format_stylish(diagnostics: &[Error]) -> String {
let total = total_errors + total_warnings;
if total > 0 {
let summary_color = if total_errors > 0 { "\u{1b}[31m" } else { "\u{1b}[33m" };
- output.push_str(&format!(
- "\n{summary_color}✖ {total} problem{} ({total_errors} error{}, {total_warnings} warning{})\u{1b}[0m\n",
+ let _ = writeln!(
+ output,
+ "\n{summary_color}✖ {total} problem{} ({total_errors} error{}, {total_warnings} warning{})\u{1b}[0m",
if total == 1 { "" } else { "s" },
if total_errors == 1 { "" } else { "s" },
if total_warnings == 1 { "" } else { "s" }
- ));
+ );
}
output
diff --git a/crates/oxc_codegen/src/comment.rs b/crates/oxc_codegen/src/comment.rs
index e8067a763f3dc..a220262bc818c 100644
--- a/crates/oxc_codegen/src/comment.rs
+++ b/crates/oxc_codegen/src/comment.rs
@@ -81,7 +81,6 @@ impl Codegen<'_> {
}
if Self::should_keep_leading_comment(&comment) {
leading_comments.push(comment);
- continue;
}
}
diff --git a/crates/oxc_ecmascript/src/constant_evaluation/mod.rs b/crates/oxc_ecmascript/src/constant_evaluation/mod.rs
index 7d459ae2ed0e5..622318532f8e9 100644
--- a/crates/oxc_ecmascript/src/constant_evaluation/mod.rs
+++ b/crates/oxc_ecmascript/src/constant_evaluation/mod.rs
@@ -32,8 +32,8 @@ pub trait ConstantEvaluation<'a>: MayHaveSideEffects {
/// Use the specific functions (e.g. [`ConstantEvaluation::evaluate_value_to_boolean`], [`ConstantEvaluation::evaluate_value`]).
///
/// - target_ty: How the result will be used.
- /// For example, if the result will be converted to a boolean,
- /// passing `Some(ValueType::Boolean)` will allow to utilize that information.
+ /// For example, if the result will be converted to a boolean,
+ /// passing `Some(ValueType::Boolean)` will allow to utilize that information.
fn evaluate_value_to(
&self,
ctx: &impl ConstantEvaluationCtx<'a>,
diff --git a/crates/oxc_ecmascript/src/string_to_big_int.rs b/crates/oxc_ecmascript/src/string_to_big_int.rs
index 36295819e5629..94befa2ab0e7d 100644
--- a/crates/oxc_ecmascript/src/string_to_big_int.rs
+++ b/crates/oxc_ecmascript/src/string_to_big_int.rs
@@ -33,7 +33,7 @@ impl StringToBigInt<'_> for &str {
return None;
}
- return BigInt::parse_bytes(s[2..].as_bytes(), radix);
+ return BigInt::parse_bytes(&s.as_bytes()[2..], radix);
}
BigInt::parse_bytes(s.as_bytes(), 10)
diff --git a/crates/oxc_formatter/src/formatter/buffer.rs b/crates/oxc_formatter/src/formatter/buffer.rs
index b2a2e1a158f50..bd2601df2401e 100644
--- a/crates/oxc_formatter/src/formatter/buffer.rs
+++ b/crates/oxc_formatter/src/formatter/buffer.rs
@@ -546,23 +546,18 @@ fn clean_interned(
match element {
FormatElement::Tag(Tag::StartConditionalContent(condition)) => {
condition_content_stack.push(condition.clone());
- continue;
}
FormatElement::Tag(Tag::EndConditionalContent) => {
condition_content_stack.pop();
- continue;
}
// All content within an expanded conditional gets dropped. If there's a
// matching flat variant, that will still get kept.
_ if condition_content_stack
.iter()
.last()
- .is_some_and(|condition| condition.mode == PrintMode::Expanded) =>
- {
- continue;
- }
+ .is_some_and(|condition| condition.mode == PrintMode::Expanded) => {}
- FormatElement::Line(LineMode::Soft) => continue,
+ FormatElement::Line(LineMode::Soft) => {}
FormatElement::Line(LineMode::SoftOrSpace) => {
cleaned.push(FormatElement::Space);
}
@@ -610,9 +605,9 @@ impl<'ast> Buffer<'ast> for RemoveSoftLinesBuffer<'_, 'ast> {
}
// All content within an expanded conditional gets dropped. If there's a
// matching flat variant, that will still get kept.
- _ if self.is_in_expanded_conditional_content() => continue,
+ _ if self.is_in_expanded_conditional_content() => {}
- FormatElement::Line(LineMode::Soft) => continue,
+ FormatElement::Line(LineMode::Soft) => {}
FormatElement::Line(LineMode::SoftOrSpace) => {
self.inner.write_element(FormatElement::Space)?;
}
diff --git a/crates/oxc_formatter/src/formatter/comments/mod.rs b/crates/oxc_formatter/src/formatter/comments/mod.rs
index e74df7df722d2..e9421d12eeec2 100644
--- a/crates/oxc_formatter/src/formatter/comments/mod.rs
+++ b/crates/oxc_formatter/src/formatter/comments/mod.rs
@@ -561,7 +561,7 @@ pub enum CommentPlacement {
/// Makes the comment a...
///
/// * [trailing comment] of the [`preceding_node`] if both the [`following_node`] and [`preceding_node`] are not [None]
- /// and the comment and [`preceding_node`] are only separated by a space (there's no token between the comment and [`preceding_node`]).
+ /// and the comment and [`preceding_node`] are only separated by a space (there's no token between the comment and [`preceding_node`]).
/// * [leading comment] of the [`following_node`] if the [`following_node`] is not [None]
/// * [trailing comment] of the [`preceding_node`] if the [`preceding_node`] is not [None]
/// * [dangling comment] of the [`enclosing_node`].
diff --git a/crates/oxc_formatter/src/formatter/format_element/document.rs b/crates/oxc_formatter/src/formatter/format_element/document.rs
index 0367bbebc153e..9d7013043c551 100644
--- a/crates/oxc_formatter/src/formatter/format_element/document.rs
+++ b/crates/oxc_formatter/src/formatter/format_element/document.rs
@@ -596,7 +596,7 @@ impl FormatElements for [FormatElement] {
element if ignore_depth == 0 && element.will_break() => {
return true;
}
- _ => continue,
+ _ => {}
}
}
@@ -628,7 +628,7 @@ impl FormatElements for [FormatElement] {
element if ignore_depth == 0 && element.may_directly_break() => {
return true;
}
- _ => continue,
+ _ => {}
}
}
diff --git a/crates/oxc_formatter/src/formatter/printer/mod.rs b/crates/oxc_formatter/src/formatter/printer/mod.rs
index a62bf5fabac9a..7200962ff3ad5 100644
--- a/crates/oxc_formatter/src/formatter/printer/mod.rs
+++ b/crates/oxc_formatter/src/formatter/printer/mod.rs
@@ -930,8 +930,6 @@ impl<'a, 'print> FitsMeasurer<'a, 'print> {
if predicate.is_end(element)? {
break;
}
-
- continue;
}
}
}
diff --git a/crates/oxc_isolated_declarations/src/class.rs b/crates/oxc_isolated_declarations/src/class.rs
index 0ca2f88127fd7..e970731d46955 100644
--- a/crates/oxc_isolated_declarations/src/class.rs
+++ b/crates/oxc_isolated_declarations/src/class.rs
@@ -332,7 +332,7 @@ impl<'a> IsolatedDeclarations<'a> {
method_annotations.insert(name, annotation);
}
}
- _ => continue,
+ _ => {}
}
}
}
diff --git a/crates/oxc_isolated_declarations/tests/mod.rs b/crates/oxc_isolated_declarations/tests/mod.rs
index 52ff00da3f15e..0c70faa5979dc 100644
--- a/crates/oxc_isolated_declarations/tests/mod.rs
+++ b/crates/oxc_isolated_declarations/tests/mod.rs
@@ -1,6 +1,6 @@
mod deno;
-use std::{fs, path::Path, sync::Arc};
+use std::{fmt::Write, fs, path::Path, sync::Arc};
use oxc_allocator::Allocator;
use oxc_codegen::CodeGenerator;
@@ -28,9 +28,10 @@ fn transform(path: &Path, source_text: &str) -> String {
.map(|d| d.clone().with_source_code(Arc::clone(&source)))
.fold(String::new(), |s, error| s + &format!("{error:?}"));
- snapshot.push_str(&format!(
+ let _ = write!(
+ snapshot,
"==================== Errors ====================\n{error_messages}\n\n```"
- ));
+ );
}
snapshot
diff --git a/crates/oxc_language_server/src/linter/tester.rs b/crates/oxc_language_server/src/linter/tester.rs
index 358968250300c..10c361f6cd13c 100644
--- a/crates/oxc_language_server/src/linter/tester.rs
+++ b/crates/oxc_language_server/src/linter/tester.rs
@@ -1,3 +1,5 @@
+use std::fmt::Write;
+
use oxc_linter::Linter;
use tower_lsp::lsp_types::{CodeDescription, NumberOrString, Url};
@@ -29,10 +31,8 @@ fn get_snapshot_from_report(report: &DiagnosticReport) -> String {
.enumerate()
.map(|(i, info)| {
let mut result = String::new();
- result.push_str(&format!(
- "related_information[{}].message: {:?}",
- i, info.message
- ));
+ let _ =
+ write!(result, "related_information[{}].message: {:?}", i, info.message);
// replace everything between `file://` and `oxc_language_server` with ``, to avoid
// the absolute path causing snapshot test failures in different environments
let mut location = info.location.uri.to_string();
@@ -46,13 +46,13 @@ fn get_snapshot_from_report(report: &DiagnosticReport) -> String {
"",
);
- result.push_str(&format!(
- "\nrelated_information[{i}].location.uri: {location:?}",
- ));
- result.push_str(&format!(
+ let _ =
+ write!(result, "\nrelated_information[{i}].location.uri: {location:?}",);
+ let _ = write!(
+ result,
"\nrelated_information[{}].location.range: {:?}",
i, info.location.range
- ));
+ );
result
})
.collect::>()
diff --git a/crates/oxc_linter/src/ast_util.rs b/crates/oxc_linter/src/ast_util.rs
index a4aec9ff4ca5d..377e58e2abfc0 100644
--- a/crates/oxc_linter/src/ast_util.rs
+++ b/crates/oxc_linter/src/ast_util.rs
@@ -791,7 +791,7 @@ pub fn get_static_property_name<'a>(parent_node: &AstNode<'a>) -> Option Some(Cow::Borrowed(bigint.raw.as_str())),
PropertyKey::TemplateLiteral(template) => {
- if template.expressions.len() == 0 && template.quasis.len() == 1 {
+ if template.expressions.is_empty() && template.quasis.len() == 1 {
if let Some(cooked) = &template.quasis[0].value.cooked {
return Some(Cow::Borrowed(cooked.as_str()));
}
diff --git a/crates/oxc_linter/src/loader/partial_loader/astro.rs b/crates/oxc_linter/src/loader/partial_loader/astro.rs
index bb0f7304927b3..9bce5c1a842e8 100644
--- a/crates/oxc_linter/src/loader/partial_loader/astro.rs
+++ b/crates/oxc_linter/src/loader/partial_loader/astro.rs
@@ -61,7 +61,8 @@ impl<'a> AstroPartialLoader<'a> {
let js_start;
let js_end;
// find opening "" if no self closing tag was found
} else if let Some(offset) =
- script_end_finder.find(self.source_text[pointer..].as_bytes())
+ script_end_finder.find(&self.source_text.as_bytes()[pointer..])
{
js_end = pointer + offset;
pointer += offset + SCRIPT_END.len();
diff --git a/crates/oxc_linter/src/loader/partial_loader/svelte.rs b/crates/oxc_linter/src/loader/partial_loader/svelte.rs
index f5881bc61b6d0..b272bab6f5ae2 100644
--- a/crates/oxc_linter/src/loader/partial_loader/svelte.rs
+++ b/crates/oxc_linter/src/loader/partial_loader/svelte.rs
@@ -24,7 +24,7 @@ impl<'a> SveltePartialLoader<'a> {
let mut pointer = 0;
// find opening ""
- let offset = script_end_finder.find(self.source_text[pointer..].as_bytes())?;
+ let offset = script_end_finder.find(&self.source_text.as_bytes()[pointer..])?;
let js_end = pointer + offset;
let source_text = &self.source_text[js_start..js_end];
diff --git a/crates/oxc_linter/src/loader/partial_loader/vue.rs b/crates/oxc_linter/src/loader/partial_loader/vue.rs
index 0a587b8459254..2d145479eb52b 100644
--- a/crates/oxc_linter/src/loader/partial_loader/vue.rs
+++ b/crates/oxc_linter/src/loader/partial_loader/vue.rs
@@ -35,7 +35,7 @@ impl<'a> VuePartialLoader<'a> {
let script_start_finder = Finder::new(SCRIPT_START);
// find opening ""
let script_end_finder = Finder::new(SCRIPT_END);
- let offset = script_end_finder.find(self.source_text[*pointer..].as_bytes())?;
+ let offset = script_end_finder.find(&self.source_text.as_bytes()[*pointer..])?;
let js_end = *pointer + offset;
*pointer += offset + SCRIPT_END.len();
diff --git a/crates/oxc_linter/src/rules/eslint/default_case.rs b/crates/oxc_linter/src/rules/eslint/default_case.rs
index 30977a2cc02a1..a5deb96593621 100644
--- a/crates/oxc_linter/src/rules/eslint/default_case.rs
+++ b/crates/oxc_linter/src/rules/eslint/default_case.rs
@@ -140,7 +140,7 @@ impl Rule for DefaultCase {
let has_default_comment = ctx
.semantic()
.comments_range(last_case.span.start..switch.span.end)
- .last()
+ .next_back()
.is_some_and(|comment| {
let raw = ctx.source_range(comment.content_span()).trim();
match &self.comment_pattern {
diff --git a/crates/oxc_linter/src/rules/eslint/guard_for_in.rs b/crates/oxc_linter/src/rules/eslint/guard_for_in.rs
index 896054eb7fcf3..8eb4945476932 100644
--- a/crates/oxc_linter/src/rules/eslint/guard_for_in.rs
+++ b/crates/oxc_linter/src/rules/eslint/guard_for_in.rs
@@ -76,7 +76,7 @@ impl Rule for GuardForIn {
{
return;
}
- Statement::BlockStatement(block_body) if block_body.body.len() >= 1 => {
+ Statement::BlockStatement(block_body) if !block_body.body.is_empty() => {
let block_statement = &block_body.body[0];
if let Statement::IfStatement(i) = block_statement {
if let Statement::ContinueStatement(_) = &i.consequent {
diff --git a/crates/oxc_linter/src/rules/eslint/no_fallthrough.rs b/crates/oxc_linter/src/rules/eslint/no_fallthrough.rs
index 9650118165109..acc460472da47 100644
--- a/crates/oxc_linter/src/rules/eslint/no_fallthrough.rs
+++ b/crates/oxc_linter/src/rules/eslint/no_fallthrough.rs
@@ -384,7 +384,7 @@ impl NoFallthrough {
let comment = semantic
.comments_range(range)
.map(|comment| ctx.source_range(comment.content_span()))
- .last()
+ .next_back()
.map(str::trim);
comment.is_some_and(|comment| self.is_comment_fall_through(comment))
diff --git a/crates/oxc_linter/src/rules/eslint/no_lone_blocks.rs b/crates/oxc_linter/src/rules/eslint/no_lone_blocks.rs
index cfeb0c8ae7639..76f58ff4ed277 100644
--- a/crates/oxc_linter/src/rules/eslint/no_lone_blocks.rs
+++ b/crates/oxc_linter/src/rules/eslint/no_lone_blocks.rs
@@ -63,7 +63,7 @@ impl Rule for NoLoneBlocks {
if stmt.body.is_empty() {
let is_comment_in_stmt =
- ctx.comments_range(stmt.span.start..stmt.span.end).last().is_some();
+ ctx.comments_range(stmt.span.start..stmt.span.end).next_back().is_some();
if !is_comment_in_stmt
&& !matches!(parent_node.kind(), AstKind::TryStatement(_) | AstKind::CatchClause(_))
diff --git a/crates/oxc_linter/src/rules/eslint/no_loss_of_precision.rs b/crates/oxc_linter/src/rules/eslint/no_loss_of_precision.rs
index d95f1eeb71458..7b89212f9437b 100644
--- a/crates/oxc_linter/src/rules/eslint/no_loss_of_precision.rs
+++ b/crates/oxc_linter/src/rules/eslint/no_loss_of_precision.rs
@@ -108,7 +108,7 @@ pub struct ScientificNotation<'a> {
impl PartialEq for ScientificNotation<'_> {
fn eq(&self, other: &Self) -> bool {
if self.int == other.int && self.frac == other.frac {
- if self.int == "0" && self.frac == "" {
+ if self.int == "0" && self.frac.is_empty() {
return true;
}
return self.exp == other.exp;
diff --git a/crates/oxc_linter/src/rules/eslint/no_object_constructor.rs b/crates/oxc_linter/src/rules/eslint/no_object_constructor.rs
index 6f2192a0fee8a..4f85dc47db4ad 100644
--- a/crates/oxc_linter/src/rules/eslint/no_object_constructor.rs
+++ b/crates/oxc_linter/src/rules/eslint/no_object_constructor.rs
@@ -64,7 +64,7 @@ impl Rule for NoObjectConstructor {
if ident.name == "Object"
&& ctx.is_reference_to_global_variable(ident)
- && arguments.len() == 0
+ && arguments.is_empty()
&& type_parameters.is_none()
{
ctx.diagnostic(no_object_constructor_diagnostic(span));
diff --git a/crates/oxc_linter/src/rules/eslint/no_regex_spaces.rs b/crates/oxc_linter/src/rules/eslint/no_regex_spaces.rs
index 79d31f2551760..ac7bf42f047fb 100644
--- a/crates/oxc_linter/src/rules/eslint/no_regex_spaces.rs
+++ b/crates/oxc_linter/src/rules/eslint/no_regex_spaces.rs
@@ -111,11 +111,11 @@ impl NoRegexSpaces {
}
fn is_regexp_new_expression(expr: &NewExpression<'_>) -> bool {
- expr.callee.is_specific_id("RegExp") && expr.arguments.len() > 0
+ expr.callee.is_specific_id("RegExp") && !expr.arguments.is_empty()
}
fn is_regexp_call_expression(expr: &CallExpression<'_>) -> bool {
- expr.callee.is_specific_id("RegExp") && expr.arguments.len() > 0
+ expr.callee.is_specific_id("RegExp") && !expr.arguments.is_empty()
}
// For skipping if there aren't any consecutive spaces in the source, to avoid reporting cases
diff --git a/crates/oxc_linter/src/rules/eslint/no_useless_escape.rs b/crates/oxc_linter/src/rules/eslint/no_useless_escape.rs
index 2679d525b89fb..bead498030314 100644
--- a/crates/oxc_linter/src/rules/eslint/no_useless_escape.rs
+++ b/crates/oxc_linter/src/rules/eslint/no_useless_escape.rs
@@ -232,7 +232,7 @@ fn check_string(string: &str) -> Vec {
}
let quote_char = string.chars().next().unwrap();
- let bytes = &string[1..string.len() - 1].as_bytes();
+ let bytes = &string.as_bytes()[1..string.len() - 1];
let escapes = memmem::find_iter(bytes, "\\").collect::>();
if escapes.is_empty() {
diff --git a/crates/oxc_linter/src/rules/eslint/prefer_object_has_own.rs b/crates/oxc_linter/src/rules/eslint/prefer_object_has_own.rs
index 11d27165363ac..5efdeddc2db0e 100644
--- a/crates/oxc_linter/src/rules/eslint/prefer_object_has_own.rs
+++ b/crates/oxc_linter/src/rules/eslint/prefer_object_has_own.rs
@@ -105,7 +105,7 @@ fn has_left_hand_object(node: &MemberExpression) -> bool {
let object = node.object().get_inner_expression();
if let Expression::ObjectExpression(object_expr) = object {
- return object_expr.properties.len() == 0;
+ return object_expr.properties.is_empty();
}
let object_node_to_check = match object.get_member_expr() {
diff --git a/crates/oxc_linter/src/rules/eslint/prefer_promise_reject_errors.rs b/crates/oxc_linter/src/rules/eslint/prefer_promise_reject_errors.rs
index 13cd702af61de..0701b6f902133 100644
--- a/crates/oxc_linter/src/rules/eslint/prefer_promise_reject_errors.rs
+++ b/crates/oxc_linter/src/rules/eslint/prefer_promise_reject_errors.rs
@@ -99,7 +99,7 @@ impl Rule for PreferPromiseRejectErrors {
return;
};
- if ident.name != "Promise" || new_expr.arguments.len() == 0 {
+ if ident.name != "Promise" || new_expr.arguments.is_empty() {
return;
}
@@ -125,11 +125,11 @@ impl Rule for PreferPromiseRejectErrors {
}
fn check_reject_call(call_expr: &CallExpression, ctx: &LintContext, allow_empty_reject: bool) {
- if call_expr.arguments.len() == 0 && allow_empty_reject {
+ if call_expr.arguments.is_empty() && allow_empty_reject {
return;
}
- if call_expr.arguments.len() == 0
+ if call_expr.arguments.is_empty()
|| call_expr.arguments[0].as_expression().is_some_and(|e| !could_be_error(ctx, e))
|| is_undefined(&call_expr.arguments[0])
{
diff --git a/crates/oxc_linter/src/rules/eslint/symbol_description.rs b/crates/oxc_linter/src/rules/eslint/symbol_description.rs
index 68f1d32fbd09f..cdd69e2cc6fbf 100644
--- a/crates/oxc_linter/src/rules/eslint/symbol_description.rs
+++ b/crates/oxc_linter/src/rules/eslint/symbol_description.rs
@@ -58,7 +58,7 @@ impl Rule for SymbolDescription {
};
if ident.name == "Symbol"
- && call_expr.arguments.len() == 0
+ && call_expr.arguments.is_empty()
&& ctx.scoping().root_unresolved_references().contains_key(ident.name.as_str())
{
ctx.diagnostic(symbol_description_diagnostic(call_expr.span));
diff --git a/crates/oxc_linter/src/rules/import/no_commonjs.rs b/crates/oxc_linter/src/rules/import/no_commonjs.rs
index d0575fefb11c3..97afbdbc85374 100644
--- a/crates/oxc_linter/src/rules/import/no_commonjs.rs
+++ b/crates/oxc_linter/src/rules/import/no_commonjs.rs
@@ -219,7 +219,7 @@ impl Rule for NoCommonjs {
}
if let Argument::TemplateLiteral(template_literal) = &call_expr.arguments[0] {
- if template_literal.expressions.len() != 0 {
+ if !template_literal.expressions.is_empty() {
return;
}
}
diff --git a/crates/oxc_linter/src/rules/jest/no_large_snapshots.rs b/crates/oxc_linter/src/rules/jest/no_large_snapshots.rs
index ad77afffa427c..da4f533b1465c 100644
--- a/crates/oxc_linter/src/rules/jest/no_large_snapshots.rs
+++ b/crates/oxc_linter/src/rules/jest/no_large_snapshots.rs
@@ -191,7 +191,7 @@ impl NoLargeSnapshots {
return;
};
- if jest_fn_call.args.len() > 0
+ if !jest_fn_call.args.is_empty()
&& jest_fn_call.members.iter().any(|member| {
member.is_name_equal("toMatchInlineSnapshot")
|| member.is_name_equal("toThrowErrorMatchingInlineSnapshot")
diff --git a/crates/oxc_linter/src/rules/jest/prefer_to_be.rs b/crates/oxc_linter/src/rules/jest/prefer_to_be.rs
index c40b0995636e2..4d2289ac9c37e 100644
--- a/crates/oxc_linter/src/rules/jest/prefer_to_be.rs
+++ b/crates/oxc_linter/src/rules/jest/prefer_to_be.rs
@@ -129,7 +129,7 @@ impl PreferToBe {
}
}
- if !is_equality_matcher(matcher) || jest_expect_fn_call.args.len() == 0 {
+ if !is_equality_matcher(matcher) || jest_expect_fn_call.args.is_empty() {
return;
}
diff --git a/crates/oxc_linter/src/rules/jest/require_to_throw_message.rs b/crates/oxc_linter/src/rules/jest/require_to_throw_message.rs
index 3b6f6beb7862a..e95412d279578 100644
--- a/crates/oxc_linter/src/rules/jest/require_to_throw_message.rs
+++ b/crates/oxc_linter/src/rules/jest/require_to_throw_message.rs
@@ -78,7 +78,7 @@ impl RequireToThrowMessage {
let has_not = jest_fn_call.modifiers().iter().any(|modifier| modifier.is_name_equal("not"));
- if jest_fn_call.args.len() == 0
+ if jest_fn_call.args.is_empty()
&& (matcher_name == "toThrow" || matcher_name == "toThrowError")
&& !has_not
{
diff --git a/crates/oxc_linter/src/rules/jest/valid_describe_callback.rs b/crates/oxc_linter/src/rules/jest/valid_describe_callback.rs
index 4d569dfeac5c4..f8b8fbc8596a0 100644
--- a/crates/oxc_linter/src/rules/jest/valid_describe_callback.rs
+++ b/crates/oxc_linter/src/rules/jest/valid_describe_callback.rs
@@ -148,7 +148,7 @@ fn run<'a>(possible_jest_node: &PossibleJestNode<'a, '_>, ctx: &LintContext<'a>)
diagnostic(ctx, arrow_expr.span, Message::UnexpectedDescribeArgument);
}
- if arrow_expr.expression && arrow_expr.body.statements.len() > 0 {
+ if arrow_expr.expression && !arrow_expr.body.statements.is_empty() {
let stmt = &arrow_expr.body.statements[0];
let Statement::ExpressionStatement(expr_stmt) = stmt else {
return;
diff --git a/crates/oxc_linter/src/rules/nextjs/inline_script_id.rs b/crates/oxc_linter/src/rules/nextjs/inline_script_id.rs
index 939fe06fc1189..ddbccc17c9f25 100644
--- a/crates/oxc_linter/src/rules/nextjs/inline_script_id.rs
+++ b/crates/oxc_linter/src/rules/nextjs/inline_script_id.rs
@@ -100,7 +100,7 @@ impl Rule for InlineScriptId {
continue;
}
- if jsx_element.children.len() > 0
+ if !jsx_element.children.is_empty()
|| prop_names_hash_set.contains("dangerouslySetInnerHTML")
{
ctx.diagnostic(inline_script_id_diagnostic(jsx_opening_element.name.span()));
diff --git a/crates/oxc_linter/src/rules/nextjs/no_before_interactive_script_outside_document.rs b/crates/oxc_linter/src/rules/nextjs/no_before_interactive_script_outside_document.rs
index fef9c7dba54b0..39d8a2a3f82f5 100644
--- a/crates/oxc_linter/src/rules/nextjs/no_before_interactive_script_outside_document.rs
+++ b/crates/oxc_linter/src/rules/nextjs/no_before_interactive_script_outside_document.rs
@@ -49,7 +49,7 @@ impl Rule for NoBeforeInteractiveScriptOutsideDocument {
let Some(tag_name) = jsx_el.name.get_identifier_name() else {
return;
};
- if jsx_el.attributes.len() == 0 {
+ if jsx_el.attributes.is_empty() {
return;
}
diff --git a/crates/oxc_linter/src/rules/nextjs/no_unwanted_polyfillio.rs b/crates/oxc_linter/src/rules/nextjs/no_unwanted_polyfillio.rs
index 6679919a5351c..142d3eded565f 100644
--- a/crates/oxc_linter/src/rules/nextjs/no_unwanted_polyfillio.rs
+++ b/crates/oxc_linter/src/rules/nextjs/no_unwanted_polyfillio.rs
@@ -128,7 +128,7 @@ impl Rule for NoUnwantedPolyfillio {
}
}
- if jsx_el.attributes.len() == 0 {
+ if jsx_el.attributes.is_empty() {
return;
}
diff --git a/crates/oxc_linter/src/rules/typescript/array_type.rs b/crates/oxc_linter/src/rules/typescript/array_type.rs
index 49972c3eca9ab..0836554225d81 100644
--- a/crates/oxc_linter/src/rules/typescript/array_type.rs
+++ b/crates/oxc_linter/src/rules/typescript/array_type.rs
@@ -316,7 +316,7 @@ fn check_and_report_error_array(
let class_name = if is_readonly_array_type { "ReadonlyArray" } else { "Array" };
let type_params = &ts_type_reference.type_arguments;
- if type_params.is_none() || type_params.as_ref().unwrap().params.len() == 0 {
+ if type_params.is_none() || type_params.as_ref().unwrap().params.is_empty() {
let diagnostic = match config {
ArrayOption::Array => array(readonly_prefix, class_name, "any", ts_type_reference.span),
_ => array_simple(
diff --git a/crates/oxc_linter/src/rules/typescript/consistent_type_imports.rs b/crates/oxc_linter/src/rules/typescript/consistent_type_imports.rs
index 99684cd9ef2f5..5332c28590d77 100644
--- a/crates/oxc_linter/src/rules/typescript/consistent_type_imports.rs
+++ b/crates/oxc_linter/src/rules/typescript/consistent_type_imports.rs
@@ -1,4 +1,4 @@
-use std::{borrow::Cow, error::Error, ops::Deref};
+use std::{borrow::Cow, error::Error, fmt::Write, ops::Deref};
use itertools::Itertools;
use oxc_ast::{
@@ -285,9 +285,9 @@ fn format_word_list<'a>(words: &[Cow<'a, str>]) -> Cow<'a, str> {
let mut result = String::with_capacity(words.len() * 2);
for (i, word) in words.iter().enumerate() {
if i == words.len() - 1 {
- result.push_str(&format!("and {word}"));
+ let _ = write!(result, "and {word}");
} else {
- result.push_str(&format!("{word}, "));
+ let _ = write!(result, "{word}, ");
}
}
Cow::Owned(result)
diff --git a/crates/oxc_linter/src/rules/typescript/no_empty_object_type.rs b/crates/oxc_linter/src/rules/typescript/no_empty_object_type.rs
index 38d1053326051..644004097d7ba 100644
--- a/crates/oxc_linter/src/rules/typescript/no_empty_object_type.rs
+++ b/crates/oxc_linter/src/rules/typescript/no_empty_object_type.rs
@@ -121,7 +121,7 @@ impl Rule for NoEmptyObjectType {
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
match node.kind() {
- AstKind::TSInterfaceDeclaration(interface) if interface.body.body.len() == 0 => {
+ AstKind::TSInterfaceDeclaration(interface) if interface.body.body.is_empty() => {
check_interface_declaration(
ctx,
interface,
@@ -129,7 +129,7 @@ impl Rule for NoEmptyObjectType {
&self.allow_with_name,
);
}
- AstKind::TSTypeLiteral(typeliteral) if typeliteral.members.len() == 0 => {
+ AstKind::TSTypeLiteral(typeliteral) if typeliteral.members.is_empty() => {
check_type_literal(
ctx,
typeliteral,
@@ -167,7 +167,7 @@ fn check_interface_declaration(
"Do not use an empty interface declaration.",
)),
},
- Some(extends) if extends.len() == 0 => {
+ Some(extends) if extends.is_empty() => {
ctx.diagnostic(no_empty_object_type_diagnostic(
interface.body.span,
"Do not use an empty interface declaration.",
diff --git a/crates/oxc_linter/src/rules/typescript/prefer_literal_enum_member.rs b/crates/oxc_linter/src/rules/typescript/prefer_literal_enum_member.rs
index b7654803c8a73..a6a7e38b3b3cd 100644
--- a/crates/oxc_linter/src/rules/typescript/prefer_literal_enum_member.rs
+++ b/crates/oxc_linter/src/rules/typescript/prefer_literal_enum_member.rs
@@ -71,7 +71,7 @@ impl Rule for PreferLiteralEnumMember {
}
if let Expression::TemplateLiteral(template) = initializer {
- if template.expressions.len() == 0 {
+ if template.expressions.is_empty() {
return;
}
}
diff --git a/crates/oxc_linter/src/rules/unicorn/consistent_date_clone.rs b/crates/oxc_linter/src/rules/unicorn/consistent_date_clone.rs
index 76fb77a67faca..e418c033fcd9e 100644
--- a/crates/oxc_linter/src/rules/unicorn/consistent_date_clone.rs
+++ b/crates/oxc_linter/src/rules/unicorn/consistent_date_clone.rs
@@ -66,7 +66,7 @@ impl Rule for ConsistentDateClone {
};
if callee.property.name.as_str() == "getTime"
- && expr.arguments.len() == 0
+ && expr.arguments.is_empty()
&& !expr.optional
&& !callee.optional
{
diff --git a/crates/oxc_linter/src/rules/unicorn/no_object_as_default_parameter.rs b/crates/oxc_linter/src/rules/unicorn/no_object_as_default_parameter.rs
index 3f3d6c82e71e8..304e6d47fced9 100644
--- a/crates/oxc_linter/src/rules/unicorn/no_object_as_default_parameter.rs
+++ b/crates/oxc_linter/src/rules/unicorn/no_object_as_default_parameter.rs
@@ -56,7 +56,7 @@ impl Rule for NoObjectAsDefaultParameter {
return;
};
- if object_expr.properties.len() == 0 {
+ if object_expr.properties.is_empty() {
return;
}
diff --git a/crates/oxc_linter/src/rules/unicorn/no_static_only_class.rs b/crates/oxc_linter/src/rules/unicorn/no_static_only_class.rs
index e2e0ebd6c94a6..25e43f81a7cfd 100644
--- a/crates/oxc_linter/src/rules/unicorn/no_static_only_class.rs
+++ b/crates/oxc_linter/src/rules/unicorn/no_static_only_class.rs
@@ -66,10 +66,10 @@ impl Rule for NoStaticOnlyClass {
if class.super_class.is_some() {
return;
}
- if class.decorators.len() > 0 {
+ if !class.decorators.is_empty() {
return;
}
- if class.body.body.len() == 0 {
+ if class.body.body.is_empty() {
return;
}
if class.body.body.iter().any(|node| {
diff --git a/crates/oxc_linter/src/rules/unicorn/no_thenable.rs b/crates/oxc_linter/src/rules/unicorn/no_thenable.rs
index c7c431b9e1238..3cf86c7ed1aa6 100644
--- a/crates/oxc_linter/src/rules/unicorn/no_thenable.rs
+++ b/crates/oxc_linter/src/rules/unicorn/no_thenable.rs
@@ -178,7 +178,7 @@ fn check_call_expression(expr: &CallExpression, ctx: &LintContext) {
for inner in &outer.elements {
// inner item is array
if let ArrayExpressionElement::ArrayExpression(inner) = inner {
- if inner.elements.len() > 0
+ if !inner.elements.is_empty()
&& !matches!(inner.elements[0], ArrayExpressionElement::SpreadElement(_))
{
if let Some(expr) = inner.elements[0].as_expression() {
diff --git a/crates/oxc_linter/src/rules/unicorn/no_useless_fallback_in_spread.rs b/crates/oxc_linter/src/rules/unicorn/no_useless_fallback_in_spread.rs
index 463e17e621bc8..6fb9f600b9d2c 100644
--- a/crates/oxc_linter/src/rules/unicorn/no_useless_fallback_in_spread.rs
+++ b/crates/oxc_linter/src/rules/unicorn/no_useless_fallback_in_spread.rs
@@ -58,7 +58,7 @@ impl Rule for NoUselessFallbackInSpread {
return;
};
- if object_expression.properties.len() != 0 {
+ if !object_expression.properties.is_empty() {
return;
}
diff --git a/crates/oxc_linter/src/rules/unicorn/no_useless_undefined.rs b/crates/oxc_linter/src/rules/unicorn/no_useless_undefined.rs
index 0e87f54789149..9fbd4b90a9d8a 100644
--- a/crates/oxc_linter/src/rules/unicorn/no_useless_undefined.rs
+++ b/crates/oxc_linter/src/rules/unicorn/no_useless_undefined.rs
@@ -185,7 +185,7 @@ impl Rule for NoUselessUndefined {
|fixer| {
let delete_span = if let Some(comment) = ctx
.comments_range(ret_stmt.span.start..ret_stmt.span.end)
- .last()
+ .next_back()
{
Span::new(comment.span.end, undefined_literal.span.end)
} else {
diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_native_coercion_functions.rs b/crates/oxc_linter/src/rules/unicorn/prefer_native_coercion_functions.rs
index af8eeb379cadd..59d57f8b6d832 100644
--- a/crates/oxc_linter/src/rules/unicorn/prefer_native_coercion_functions.rs
+++ b/crates/oxc_linter/src/rules/unicorn/prefer_native_coercion_functions.rs
@@ -60,7 +60,7 @@ impl Rule for PreferNativeCoercionFunctions {
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
match node.kind() {
AstKind::ArrowFunctionExpression(arrow_expr) => {
- if arrow_expr.r#async || arrow_expr.params.items.len() == 0 {
+ if arrow_expr.r#async || arrow_expr.params.items.is_empty() {
return;
}
@@ -81,7 +81,7 @@ impl Rule for PreferNativeCoercionFunctions {
}
}
AstKind::Function(func) => {
- if func.r#async || func.generator || func.params.items.len() == 0 {
+ if func.r#async || func.generator || func.params.items.is_empty() {
return;
}
if let Some(parent) = ctx.nodes().parent_node(node.id()) {
@@ -168,7 +168,7 @@ fn is_matching_native_coercion_function_call(
return None;
};
- if call_expr.optional || call_expr.arguments.len() == 0 {
+ if call_expr.optional || call_expr.arguments.is_empty() {
return None;
}
diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_query_selector.rs b/crates/oxc_linter/src/rules/unicorn/prefer_query_selector.rs
index ad118b7fcc74e..c884538e1572a 100644
--- a/crates/oxc_linter/src/rules/unicorn/prefer_query_selector.rs
+++ b/crates/oxc_linter/src/rules/unicorn/prefer_query_selector.rs
@@ -109,7 +109,7 @@ impl Rule for PreferQuerySelector {
let literal_value = match argument_expr {
Expression::StringLiteral(literal) => Some(literal.value.trim()),
Expression::TemplateLiteral(literal) => {
- if literal.expressions.len() == 0 {
+ if literal.expressions.is_empty() {
literal.quasis.first().unwrap().value.cooked.as_deref().map(str::trim)
} else {
None
diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs b/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs
index d2d479ef0a694..6bc5e93f52465 100644
--- a/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs
+++ b/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs
@@ -136,7 +136,7 @@ fn check_unicorn_prefer_spread(call_expr: &CallExpression, ctx: &LintContext) {
}
// `array.toSpliced()`
"toSpliced" => {
- if call_expr.arguments.len() != 0 {
+ if !call_expr.arguments.is_empty() {
return;
}
@@ -160,7 +160,7 @@ fn check_unicorn_prefer_spread(call_expr: &CallExpression, ctx: &LintContext) {
return;
};
- if string_lit.value != "" {
+ if !string_lit.value.is_empty() {
return;
}
diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_type_error.rs b/crates/oxc_linter/src/rules/unicorn/prefer_type_error.rs
index 7c94c48f38f6f..1100b57413a9b 100644
--- a/crates/oxc_linter/src/rules/unicorn/prefer_type_error.rs
+++ b/crates/oxc_linter/src/rules/unicorn/prefer_type_error.rs
@@ -123,7 +123,7 @@ fn is_type_checking_expr(expr: &Expression) -> bool {
}
fn is_typechecking_call_expr(call_expr: &CallExpression) -> bool {
- if call_expr.arguments.len() == 0 {
+ if call_expr.arguments.is_empty() {
return false;
}
diff --git a/crates/oxc_linter/src/rules/vitest/prefer_to_be_truthy.rs b/crates/oxc_linter/src/rules/vitest/prefer_to_be_truthy.rs
index c031d68fd13bf..0c49a59a9343a 100644
--- a/crates/oxc_linter/src/rules/vitest/prefer_to_be_truthy.rs
+++ b/crates/oxc_linter/src/rules/vitest/prefer_to_be_truthy.rs
@@ -29,7 +29,7 @@ pub fn prefer_to_be_simply_bool<'a>(
let Some(matcher) = vitest_expect_fn_call.matcher() else {
return;
};
- if !is_equality_matcher(matcher) || vitest_expect_fn_call.args.len() == 0 {
+ if !is_equality_matcher(matcher) || vitest_expect_fn_call.args.is_empty() {
return;
}
let Some(arg_expr) = vitest_expect_fn_call.args.first().and_then(Argument::as_expression)
diff --git a/crates/oxc_linter/src/utils/unicorn.rs b/crates/oxc_linter/src/utils/unicorn.rs
index 49fecf7169866..22a24727edc44 100644
--- a/crates/oxc_linter/src/utils/unicorn.rs
+++ b/crates/oxc_linter/src/utils/unicorn.rs
@@ -72,7 +72,7 @@ pub fn is_prototype_property(
// `{}.method`
Some("Object") => {
if let Expression::ObjectExpression(obj_expr) = member_expr.object() {
- obj_expr.properties.len() == 0
+ obj_expr.properties.is_empty()
} else {
false
}
@@ -83,7 +83,7 @@ pub fn is_prototype_property(
pub fn is_empty_array_expression(expr: &Expression) -> bool {
if let Expression::ArrayExpression(array_expr) = expr {
- array_expr.elements.len() == 0
+ array_expr.elements.is_empty()
} else {
false
}
@@ -91,7 +91,7 @@ pub fn is_empty_array_expression(expr: &Expression) -> bool {
pub fn is_empty_object_expression(expr: &Expression) -> bool {
if let Expression::ObjectExpression(object_expr) = expr {
- object_expr.properties.len() == 0
+ object_expr.properties.is_empty()
} else {
false
}
diff --git a/crates/oxc_macros/src/declare_all_lint_rules.rs b/crates/oxc_macros/src/declare_all_lint_rules.rs
index 1265f4905c3e3..79ab383f4812c 100644
--- a/crates/oxc_macros/src/declare_all_lint_rules.rs
+++ b/crates/oxc_macros/src/declare_all_lint_rules.rs
@@ -30,7 +30,7 @@ impl Parse for LintRuleMeta {
let enum_name = syn::parse_str(&combined)?;
let rule_name = syn::parse_str(
- &path.segments.iter().last().unwrap().ident.to_string().to_case(Case::Pascal),
+ &path.segments.iter().next_back().unwrap().ident.to_string().to_case(Case::Pascal),
)?;
Ok(Self { rule_name, enum_name, path })
}
diff --git a/crates/oxc_parser/src/js/function.rs b/crates/oxc_parser/src/js/function.rs
index bb0942ea43139..55464b997c746 100644
--- a/crates/oxc_parser/src/js/function.rs
+++ b/crates/oxc_parser/src/js/function.rs
@@ -146,14 +146,14 @@ impl<'a> ParserImpl<'a> {
FunctionType::FunctionDeclaration
}
}
- FunctionKind::Expression { .. } => {
+ FunctionKind::Expression => {
if body.is_none() {
FunctionType::TSEmptyBodyFunctionExpression
} else {
FunctionType::FunctionExpression
}
}
- FunctionKind::TSDeclaration { .. } => FunctionType::TSDeclareFunction,
+ FunctionKind::TSDeclaration => FunctionType::TSDeclareFunction,
};
if FunctionType::TSDeclareFunction == function_type
diff --git a/crates/oxc_parser/src/lexer/search.rs b/crates/oxc_parser/src/lexer/search.rs
index 33fa35b990a1e..9be53f09693f1 100644
--- a/crates/oxc_parser/src/lexer/search.rs
+++ b/crates/oxc_parser/src/lexer/search.rs
@@ -124,16 +124,18 @@ pub(crate) use byte_match_table;
/// To make this guarantee, one of the following must be true:
///
/// 1. Table contains `true` for all byte values 192 - 247
-/// i.e. first byte of any multi-byte Unicode character matches.
-/// (NB: 248 - 255 cannot occur in UTF-8 strings)
-/// e.g. `safe_byte_match_table!(|b| b >= 192)`
-/// `safe_byte_match_table!(|b| !b.is_ascii())`
+/// i.e. first byte of any multi-byte Unicode character matches.
+/// (NB: 248 - 255 cannot occur in UTF-8 strings)
+/// e.g.
+/// `safe_byte_match_table!(|b| b >= 192)`
+/// `safe_byte_match_table!(|b| !b.is_ascii())`
///
/// 2. Table contains `false` for all byte values 128 - 191
-/// i.e. the continuation bytes of any multi-byte Unicode chars will be consumed in full.
-/// e.g. `safe_byte_match_table!(|b| b < 128 || b >= 192)`
-/// `safe_byte_match_table!(|b| b.is_ascii())`
-/// `safe_byte_match_table!(|b| b == ' ' || b == '\t')`
+/// i.e. the continuation bytes of any multi-byte Unicode chars will be consumed in full.
+/// e.g.
+/// `safe_byte_match_table!(|b| b < 128 || b >= 192)`
+/// `safe_byte_match_table!(|b| b.is_ascii())`
+/// `safe_byte_match_table!(|b| b == ' ' || b == '\t')`
///
/// This is statically checked by `SafeByteMatchTable::new`, and will fail to compile if match
/// pattern does not satisfy one of the above.
diff --git a/crates/oxc_semantic/src/checker/javascript.rs b/crates/oxc_semantic/src/checker/javascript.rs
index 37468c92c5cf0..90f13766bf531 100644
--- a/crates/oxc_semantic/src/checker/javascript.rs
+++ b/crates/oxc_semantic/src/checker/javascript.rs
@@ -446,7 +446,7 @@ pub fn check_function_declaration_in_labeled_statement<'a>(
for kind in ctx.nodes.ancestor_kinds(node.id()).skip(1) {
match kind {
// Nested labeled statement
- AstKind::LabeledStatement(_) => continue,
+ AstKind::LabeledStatement(_) => {}
AstKind::ForOfStatement(_)
| AstKind::ForInStatement(_)
| AstKind::ForStatement(_)
diff --git a/crates/oxc_semantic/src/checker/typescript.rs b/crates/oxc_semantic/src/checker/typescript.rs
index 01b079f94bc0e..09fbf03d6e774 100644
--- a/crates/oxc_semantic/src/checker/typescript.rs
+++ b/crates/oxc_semantic/src/checker/typescript.rs
@@ -269,7 +269,6 @@ pub fn check_ts_module_declaration<'a>(decl: &TSModuleDeclaration<'a>, ctx: &Sem
AstKind::ExportNamedDeclaration(_) | AstKind::ModuleDeclaration(_) => {
// export namespace N {}
// We need to check the parent of the parent
- continue;
}
_ => {
ctx.error(not_allowed_namespace_declaration(decl.span));
diff --git a/crates/oxc_transformer/src/es2015/arrow_functions.rs b/crates/oxc_transformer/src/es2015/arrow_functions.rs
index 6d6d8821d3dbf..d8dd43907611b 100644
--- a/crates/oxc_transformer/src/es2015/arrow_functions.rs
+++ b/crates/oxc_transformer/src/es2015/arrow_functions.rs
@@ -16,8 +16,8 @@
//! * Error on arrow functions in class properties.
//!
//! or we can support it:
-//! `class C { x = () => this; }`
-//! -> `class C { x = (function(_this) { return () => _this; })(this); }`
+//! `class C { x = () => this; }`
+//! -> `class C { x = (function(_this) { return () => _this; })(this); }`
//! * Error on `super` in arrow functions.
//!
//!
diff --git a/crates/oxc_transformer/src/es2022/class_properties/class_bindings.rs b/crates/oxc_transformer/src/es2022/class_properties/class_bindings.rs
index d6760a1e9b949..656036fc4efd4 100644
--- a/crates/oxc_transformer/src/es2022/class_properties/class_bindings.rs
+++ b/crates/oxc_transformer/src/es2022/class_properties/class_bindings.rs
@@ -15,11 +15,11 @@ use oxc_traverse::{BoundIdentifier, TraverseCtx};
/// e.g. `C = class { static x = 1; }`
/// * Class declaration has static properties and one of the static prop's initializers contains:
/// a. `this`
-/// e.g. `class C { static x = this; }`
+/// e.g. `class C { static x = this; }`
/// b. Reference to class name
-/// e.g. `class C { static x = C; }`
+/// e.g. `class C { static x = C; }`
/// c. A private field referring to one of the class's static private props.
-/// e.g. `class C { static #x; static y = obj.#x; }`
+/// e.g. `class C { static #x; static y = obj.#x; }`
///
/// The logic for when transpiled private fields use a reference to class name or class temp var
/// is unfortunately rather complicated.
diff --git a/crates/oxc_transformer/src/es2022/class_properties/private_field.rs b/crates/oxc_transformer/src/es2022/class_properties/private_field.rs
index 910dadf246502..953d8be0855e1 100644
--- a/crates/oxc_transformer/src/es2022/class_properties/private_field.rs
+++ b/crates/oxc_transformer/src/es2022/class_properties/private_field.rs
@@ -1542,16 +1542,17 @@ impl<'a> ClassProperties<'a, '_> {
///
/// * Callee without a private field:
/// `Foo?.bar()?.zoo?.().#x;`
- /// -> `(_Foo$bar$zoo = (_Foo$bar = Foo?.bar())?.zoo) === null || _Foo$bar$zoo === void 0 ? void 0
- /// : babelHelpers.assertClassBrand(Foo, _Foo$bar$zoo.call(_Foo$bar), _x)._;`
+ /// ->
+ /// `(_Foo$bar$zoo = (_Foo$bar = Foo?.bar())?.zoo) === null || _Foo$bar$zoo === void 0 ? void 0
+ /// : babelHelpers.assertClassBrand(Foo, _Foo$bar$zoo.call(_Foo$bar), _x)._;`
///
/// * Callee has a private field:
/// `o?.Foo.#self.getSelf?.().#m?.();`
- /// -> `(_ref = o === null || o === void 0 ? void 0 : (_babelHelpers$assertC =
- /// babelHelpers.assertClassBrand(Foo, o.Foo, _self)._).getSelf) === null ||
- /// _ref === void 0 ? void 0 : babelHelpers.assertClassBrand(Foo, _ref$call
- /// = _ref.call(_babelHelpers$assertC), _m)._?.call(_ref$call);`
- ///
+ /// ->
+ /// `(_ref = o === null || o === void 0 ? void 0 : (_babelHelpers$assertC =
+ /// babelHelpers.assertClassBrand(Foo, o.Foo, _self)._).getSelf) === null ||
+ /// _ref === void 0 ? void 0 : babelHelpers.assertClassBrand(Foo, _ref$call
+ /// = _ref.call(_babelHelpers$assertC), _m)._?.call(_ref$call);`
fn transform_call_expression_to_bind_proper_context(
&mut self,
expr: &mut Expression<'a>,
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
index 86343e3c27fcb..4bd1ff459ffe6 100644
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,3 +1,3 @@
[toolchain]
-channel = "1.85.1"
+channel = "1.86.0"
profile = "default"
diff --git a/tasks/ast_tools/src/generators/typescript.rs b/tasks/ast_tools/src/generators/typescript.rs
index 81c603b9acad1..33203d1f347e3 100644
--- a/tasks/ast_tools/src/generators/typescript.rs
+++ b/tasks/ast_tools/src/generators/typescript.rs
@@ -1,6 +1,6 @@
//! Generator for TypeScript type definitions for all AST types.
-use std::borrow::Cow;
+use std::{borrow::Cow, fmt::Write};
use itertools::Itertools;
@@ -117,7 +117,7 @@ fn generate_ts_type_def_for_struct(
if should_add_type_field_to_struct(struct_def) {
let type_name = struct_def.estree.rename.as_deref().unwrap_or_else(|| struct_def.name());
- fields_str.push_str(&format!("\n\ttype: '{type_name}';"));
+ let _ = write!(fields_str, "\n\ttype: '{type_name}';");
}
if !struct_def.estree.no_type {
@@ -272,7 +272,7 @@ fn generate_ts_type_def_for_struct_field_impl<'s>(
let field_camel_name = get_struct_field_name(field);
let question_mark = if field.estree.is_ts { "?" } else { "" };
- fields_str.push_str(&format!("\n\t{field_camel_name}{question_mark}: {field_type_name};"));
+ let _ = write!(fields_str, "\n\t{field_camel_name}{question_mark}: {field_type_name};");
}
/// Generate Typescript type definition for an extra struct field
@@ -288,7 +288,7 @@ fn generate_ts_type_def_for_added_struct_field(
panic!("No `ts_type` provided for ESTree converter `{converter_name}`");
};
let question_mark = if converter.estree.is_ts { "?" } else { "" };
- fields_str.push_str(&format!("\n\t{field_name}{question_mark}: {ts_type};"));
+ let _ = write!(fields_str, "\n\t{field_name}{question_mark}: {ts_type};");
}
/// Get the TS type definition for a converter.
diff --git a/tasks/ast_tools/src/schema/derives.rs b/tasks/ast_tools/src/schema/derives.rs
index 8ea7d05982daf..58d287ac3bd99 100644
--- a/tasks/ast_tools/src/schema/derives.rs
+++ b/tasks/ast_tools/src/schema/derives.rs
@@ -6,7 +6,7 @@ use std::{
use crate::{DERIVES, codegen::DeriveId};
/// Number of bytes required for bit set which can represent all [`DeriveId`]s.
-const NUM_BYTES: usize = (DERIVES.len() + 7) / 8;
+const NUM_BYTES: usize = (DERIVES.len() + 7).div_ceil(8);
/// Bit set with a bit for each [`DeriveId`].
#[derive(Clone, Copy)]
diff --git a/tasks/common/src/test_file.rs b/tasks/common/src/test_file.rs
index c555f855fda03..b060dabc91326 100644
--- a/tasks/common/src/test_file.rs
+++ b/tasks/common/src/test_file.rs
@@ -98,7 +98,7 @@ impl TestFile {
return Err(format!("Not an https url: {lib:?}"));
}
let filename =
- lib.split('/').last().ok_or_else(|| "lib url has no segments".to_string())?;
+ lib.split('/').next_back().ok_or_else(|| "lib url has no segments".to_string())?;
let file = project_root().join("target").join(filename);
diff --git a/tasks/minsize/src/lib.rs b/tasks/minsize/src/lib.rs
index 23ad603fe787d..8e566ff36817c 100644
--- a/tasks/minsize/src/lib.rs
+++ b/tasks/minsize/src/lib.rs
@@ -1,6 +1,7 @@
#![expect(clippy::print_stdout)]
use std::{
+ fmt::Write as _,
fs::{self, File},
io::{self, Write},
path::Path,
@@ -67,24 +68,26 @@ pub fn run() -> Result<(), io::Error> {
let mut out = String::new();
let width = 10;
- out.push_str(&format!(
- "{:width$} | {:width$} | {:width$} | {:width$} | {:width$} |\n",
+ let _ = writeln!(
+ out,
+ "{:width$} | {:width$} | {:width$} | {:width$} | {:width$} |",
"",
"Oxc",
"ESBuild",
"Oxc",
"ESBuild",
width = width,
- ));
- out.push_str(&format!(
- "{:width$} | {:width$} | {:width$} | {:width$} | {:width$} | Fixture\n",
+ );
+ let _ = writeln!(
+ out,
+ "{:width$} | {:width$} | {:width$} | {:width$} | {:width$} | Fixture",
"Original",
"minified",
"minified",
"gzip",
"gzip",
width = width,
- ));
+ );
let fixture_width = files
.files()
diff --git a/tasks/prettier_conformance/src/lib.rs b/tasks/prettier_conformance/src/lib.rs
index 1c81bcaf57251..d71a08a6987c0 100644
--- a/tasks/prettier_conformance/src/lib.rs
+++ b/tasks/prettier_conformance/src/lib.rs
@@ -4,7 +4,10 @@ mod ignore_list;
pub mod options;
mod spec;
-use std::path::{Path, PathBuf};
+use std::{
+ fmt::Write,
+ path::{Path, PathBuf},
+};
use cow_utils::CowUtils;
use rustc_hash::FxHashSet;
@@ -86,13 +89,14 @@ impl TestRunner {
total_failed_file_count += failed_test_files.len();
for (path, (failed, passed, ratio)) in failed_test_files {
- failed_reports.push_str(&format!(
- "| {} | {}{} | {:.2}% |\n",
+ let _ = writeln!(
+ failed_reports,
+ "| {} | {}{} | {:.2}% |",
path.strip_prefix(fixtures_root()).unwrap().to_string_lossy(),
"💥".repeat(failed),
"✨".repeat(passed),
ratio * 100.0
- ));
+ );
}
}
diff --git a/tasks/rulegen/src/main.rs b/tasks/rulegen/src/main.rs
index a600f69dd4774..9301ca143880e 100644
--- a/tasks/rulegen/src/main.rs
+++ b/tasks/rulegen/src/main.rs
@@ -292,9 +292,9 @@ impl<'a> Visit<'a> for TestCase {
json::convert_config_to_json_literal(language_options);
self.language_options = Some(language_options);
}
- _ => continue,
+ _ => {}
},
- ObjectPropertyKind::SpreadProperty(_) => continue,
+ ObjectPropertyKind::SpreadProperty(_) => {}
}
}
}
diff --git a/tasks/transform_conformance/src/lib.rs b/tasks/transform_conformance/src/lib.rs
index f0878276d28f8..09fb4289135ca 100644
--- a/tasks/transform_conformance/src/lib.rs
+++ b/tasks/transform_conformance/src/lib.rs
@@ -6,6 +6,7 @@ mod exec;
mod test_case;
use std::{
+ fmt::Write,
fs,
path::{Path, PathBuf},
};
@@ -156,7 +157,7 @@ impl TestRunner {
} else {
snapshot.push_str("# ");
snapshot.push_str(&case);
- snapshot.push_str(&format!(" ({}/{})\n", passed.len(), num_of_tests));
+ let _ = writeln!(snapshot, " ({}/{})", passed.len(), num_of_tests);
for test_case in failed {
if self.options.r#override {
test_case.write_override_output();
diff --git a/tasks/website/src/linter/rules/html.rs b/tasks/website/src/linter/rules/html.rs
index aa2a0d715077f..3bc666cdb5c24 100644
--- a/tasks/website/src/linter/rules/html.rs
+++ b/tasks/website/src/linter/rules/html.rs
@@ -61,8 +61,7 @@ impl HtmlWriter {
///
/// - `tag`: The HTML tag name
/// - `attrs`: Raw `attr="value"` string to insert into the opening tag
- /// - `inner`: A closure that produces content to render in between the opening and closing
- /// tags
+ /// - `inner`: A closure that produces content to render in between the opening and closing tags
pub fn html(&self, tag: &'static str, attrs: &str, inner: F) -> fmt::Result
where
F: FnOnce(&Self) -> fmt::Result,