Implement Ranged on more structs (#6639)

## Summary

I noticed some inconsistencies around uses of `.range.start()`, structs
that have a `TextRange` field but don't implement `Ranged`, etc.

## Test Plan

`cargo test`
This commit is contained in:
Charlie Marsh 2023-08-17 11:22:39 -04:00 committed by GitHub
parent a70807e1e1
commit db1c556508
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 221 additions and 176 deletions

View file

@ -39,7 +39,7 @@ impl FormatNodeRule<Comprehension> for FormatComprehension {
let dangling_item_comments = comments.dangling_comments(item);
let (before_target_comments, before_in_comments) = dangling_item_comments.split_at(
dangling_item_comments
.partition_point(|comment| comment.slice().end() < target.range().start()),
.partition_point(|comment| comment.slice().end() < target.start()),
);
let trailing_in_comments = comments.dangling_comments(iter);

View file

@ -79,7 +79,7 @@ fn is_match_case_pattern_parenthesized(
) -> FormatResult<bool> {
let mut tokenizer = SimpleTokenizer::new(
context.source(),
TextRange::new(case.range().start(), pattern.range().start()),
TextRange::new(case.start(), pattern.start()),
)
.skip_trivia();

View file

@ -416,7 +416,7 @@ pub(crate) fn find_parameter_separators(
debug_assert!(star.kind() == SimpleTokenKind::Star, "{star:?}");
Some(ParameterSeparator {
preceding_end: parameters.range.start(),
preceding_end: parameters.start(),
separator: star.range,
following_start: first_keyword_argument.start(),
})