Add trailing space around readlines#18542
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.
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.
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.
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.
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)
};## Summary Post-merge feedback from #18542.
Closes #17683.