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.
This commit is contained in:
overlookmotel 2024-11-28 12:08:12 +00:00
parent d21448bf65
commit f847d0f161

View file

@ -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)