mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
Merge pull request #3186 from flip1995/pedantic_filter_map
Fix pedantic filter_map warnings
This commit is contained in:
commit
4aaef72fa0
2 changed files with 10 additions and 4 deletions
|
@ -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(
|
||||
|
|
|
@ -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())
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue