-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thinggood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
Version
$ cargo clippy -V
0.0.212
Code & Confusion
Hopefully sufficient extract:
fn next(&mut self) -> Option<Self::Item> {
// Fail quickly when at the end
if self.current_row.is_none() {
return None;
};
// More code could follow here.
// Hier hingegen könnte ihre Werbung stehen.
}
When linting this, Clippy remarks:
this block may be rewritten with the
?
operator
[…]
help: replace_it_with:self.current_row?;
Hence, we obtain:
fn next(&mut self) -> Option<Self::Item> {
// Fail quickly when at the end
self.current_row?;
// More code (but only if we want).
// Advertising with us is cheap!
// Only one quatloo per comment that roughly three people will read.
// (When we include me in the count. Twice.)
}
Then, the compiler complains:
error[E0507]: cannot move out of borrowed content
Speculation
Until someone tells me otherwise, I'll assume that the ?
operator is not compatible with borrowed content and Clippy fails to check for this.
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thinggood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy