Consistently name comment own line/end-of-line line_position() (#5215)

## Summary

Previously, `DecoratedComment` used `text_position()` and
`SourceComment` used `position()`. This PR unifies this to
`line_position` everywhere.

## Test Plan

This is a rename refactoring.
This commit is contained in:
konstin 2023-06-21 11:04:56 +02:00 committed by GitHub
parent 1336ca601b
commit db301c14bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 53 additions and 52 deletions

View file

@ -1,4 +1,4 @@
use crate::comments::{dangling_comments, CommentTextPosition, Comments};
use crate::comments::{dangling_comments, CommentLinePosition, Comments};
use crate::expression::parentheses::{
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
};
@ -30,11 +30,12 @@ impl FormatNodeRule<ExprList> for FormatExprList {
// ```
// In all other cases comments get assigned to a list element
if elts.is_empty() {
let end_of_line_split = dangling
.partition_point(|comment| comment.position() == CommentTextPosition::EndOfLine);
let end_of_line_split = dangling.partition_point(|comment| {
comment.line_position() == CommentLinePosition::EndOfLine
});
debug_assert!(dangling[end_of_line_split..]
.iter()
.all(|comment| comment.position() == CommentTextPosition::OwnLine));
.all(|comment| comment.line_position() == CommentLinePosition::OwnLine));
return write!(
f,
[group(&format_args![