Merge pull request #3186 from flip1995/pedantic_filter_map

Fix pedantic filter_map warnings
This commit is contained in:
Philipp Hansch 2018-09-14 19:47:50 +01:00 committed by GitHub
commit 4aaef72fa0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View file

@ -78,8 +78,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
let mut impl_spans = impls
.iter()
.filter_map(|impl_def| self.impls.get(impl_def))
.filter(|(_, generics)| generics.params.len() == 0)
.map(|(span, _)| span);
.filter_map(|(span, generics)| if generics.params.len() == 0 {
Some(span)
} else {
None
});
if let Some(initial_span) = impl_spans.nth(0) {
impl_spans.for_each(|additional_span| {
span_lint_and_then(

View file

@ -78,8 +78,11 @@ pub fn main() {
args.extend(
extra_args
.split("__CLIPPY_HACKERY__")
.filter(|s| !s.is_empty())
.map(str::to_owned),
.filter_map(|s| if s.is_empty() {
None
} else {
Some(s.to_string())
})
);
}
}