Remove unnecessary Comment#slice calls (#6997)

This commit is contained in:
Charlie Marsh 2023-08-29 20:44:11 -04:00 committed by GitHub
parent 34e8de738e
commit b404e54f33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 23 additions and 39 deletions

View file

@ -212,7 +212,7 @@ impl Format<PyFormatContext<'_>> for FormatStringContinuation<'_> {
// )
// ```
let leading_comments_end = dangling_comments
.partition_point(|comment| comment.slice().start() <= token_range.start());
.partition_point(|comment| comment.start() <= token_range.start());
let (leading_part_comments, rest) =
dangling_comments.split_at(leading_comments_end);
@ -227,7 +227,7 @@ impl Format<PyFormatContext<'_>> for FormatStringContinuation<'_> {
comment.line_position().is_end_of_line()
&& !locator.contains_line_break(TextRange::new(
token_range.end(),
comment.slice().start(),
comment.start(),
))
});