-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add trailing space around readlines
#18542
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
Conversation
|
| print([line for line in f.readlines()and True]) | ||
| print([line for line in f.readlines()or True]) | ||
| print([line for line in f.readlines()in ["test"]]) |
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.
Sorry for the late review, but these three cases don't actually trigger FURB129, so I'm not sure if they're necessary. I noticed this while rebasing the 0.12 branch.
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 think this is sort of marginal -- I see some value / little cost in having these kinds of pathological cases here just to make sure they don't cause a panic, but taking that attitude to the extreme is obviously untenable :) I can remove since I'll be doing a follow-up PR anyway, but if I weren't changing the other piece in readlines_in_for.rs, I'd probably opt to just leave these here.
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.
Makes sense, I can see the value too! I was just afraid I dropped a few diagnostics while rebasing until I realized they weren't meant to trigger. I'm happy either way in both cases here.
| } else { | ||
| Edit::range_replacement(padded, deletion_range) | ||
| } |
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.
While I'm here, I also think this section would be a bit nicer as:
let deletion_range = if let Some(parenthesized_range) = parenthesized_range(
expr_attr.value.as_ref().into(),
expr_attr.into(),
checker.comment_ranges(),
checker.source(),
) {
expr_call.range().add_start(parenthesized_range.len())
} else {
expr_call.range().add_start(expr_attr.value.range().len())
};
let padded = pad_end(String::new(), deletion_range.end(), checker.locator());
let edit = if padded.is_empty() {
Edit::range_deletion(deletion_range)
} else {
Edit::range_replacement(padded, deletion_range)
};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.
Will change!
## Summary Post-merge feedback from #18542.
Closes #17683.