-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[refurb
] Preserve comments (FURB171
)
#15521
base: main
Are you sure you want to change the base?
Conversation
|
let iterable_start_to_item_start = TextRange::new(iterable.start(), item_range.start()); | ||
let item_end_to_iterable_end = TextRange::new(item_range.end(), iterable.end()); | ||
|
||
tokens |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we should add more token based fixes. They add a fair amount of complexity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unaware of a better solution (how else can I collect the comments from a range?). What do you suggest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked at the fix in detail but my general preference is to accept the removal of comments and instead mark the fix as unsafe if it removes a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wouldn't be resolving #10063, then. Might as well close it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some discussion around comment handling in fixes here: #9790
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair, although there's a reference to the discussion #9790 that wasn't resolved back then.
I'm still leaning towards making the fix as unsafe if there's a comment over implementing all this token handling. While impressive, it's just a lot of complexity, especially if we add it to every rule.
Summary
Resolves #10063.
Test Plan
cargo nextest run
andcargo insta test
.