mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 20:42:10 +00:00
Remove unnecessary Comment#slice
calls (#6997)
This commit is contained in:
parent
34e8de738e
commit
b404e54f33
11 changed files with 23 additions and 39 deletions
|
@ -38,8 +38,7 @@ impl FormatNodeRule<Comprehension> for FormatComprehension {
|
|||
let comments = f.context().comments().clone();
|
||||
let dangling_item_comments = comments.dangling(item);
|
||||
let (before_target_comments, before_in_comments) = dangling_item_comments.split_at(
|
||||
dangling_item_comments
|
||||
.partition_point(|comment| comment.slice().end() < target.start()),
|
||||
dangling_item_comments.partition_point(|comment| comment.end() < target.start()),
|
||||
);
|
||||
|
||||
let trailing_in_comments = comments.dangling(iter);
|
||||
|
|
|
@ -127,7 +127,7 @@ impl FormatNodeRule<Parameters> for FormatParameters {
|
|||
let assignment = assign_argument_separator_comment_placement(
|
||||
slash.as_ref(),
|
||||
star.as_ref(),
|
||||
comment.slice().range(),
|
||||
comment.range(),
|
||||
comment.line_position(),
|
||||
)
|
||||
.expect("Unexpected dangling comment type in function parameters");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue