Skip to content

Commit

Permalink
refactor(linter): call str::ends_with with array not slice (#7526)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
overlookmotel committed Nov 28, 2024
1 parent d21448b commit f847d0f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f847d0f

Please sign in to comment.