-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingE-hardCall for participation: This a hard problem and requires more experience or effort to work onCall for participation: This a hard problem and requires more experience or effort to work onI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
cargo clippy -V
clippy 0.0.212 (e3cb40e 2019-06-25)
A warning is produced from
#[warn(clippy::unnecessary_filter_map)]
let errors: Vec<ServerError> = server_errors
.into_iter()
.filter_map(|se| match se.severity() {
Severity::Warning => {
self.warnings.push(se);
None
}
_ => Some(se),
})
.collect();
The code splits moves some items from one collection into a second. If I'd use filter, as recommended, then I would have to clone the se
s, and discard the original instances.
goffrie and 197g
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingE-hardCall for participation: This a hard problem and requires more experience or effort to work onCall for participation: This a hard problem and requires more experience or effort to work onI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have