From f847d0f16190ba468c0bf7ce48c36f1cfebed59d Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:08:12 +0000 Subject: [PATCH] refactor(linter): call `str::ends_with` with array not slice (#7526) Arrays are more performant than slices where it's possible to use them. Caught by newly enabled lint rule in Rust 1.82.0 in #6649. --- crates/oxc_linter/src/rules/eslint/prefer_object_has_own.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b382f3bb64cfc..92011949b7467 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 @@ -90,7 +90,7 @@ impl Rule for PreferObjectHasOwn { let needs_space = replace_target_span.start > 1 && !ctx .source_range(Span::new(0, replace_target_span.start)) - .ends_with(&[' ', '=', '/', '(']); + .ends_with([' ', '=', '/', '(']); let replacement = if needs_space { " Object.hasOwn" } else { "Object.hasOwn" }; fixer.replace(replace_target_span, replacement)