Fix warnings in clippy_lints

This commit is contained in:
Michael Wright 2018-09-27 06:29:48 +02:00
parent 2f364d9ac5
commit 4b4d758ce0
2 changed files with 7 additions and 10 deletions

View file

@ -103,9 +103,9 @@ fn check_fn_inner<'a, 'tcx>(
} }
let mut bounds_lts = Vec::new(); let mut bounds_lts = Vec::new();
let types = generics.params.iter().filter_map(|param| match param.kind { let types = generics.params.iter().filter(|param| match param.kind {
GenericParamKind::Type { .. } => Some(param), GenericParamKind::Type { .. } => true,
GenericParamKind::Lifetime { .. } => None, GenericParamKind::Lifetime { .. } => false,
}); });
for typ in types { for typ in types {
for bound in &typ.bounds { for bound in &typ.bounds {

View file

@ -682,13 +682,10 @@ impl LimitStack {
} }
pub fn get_attr<'a>(attrs: &'a [ast::Attribute], name: &'static str) -> impl Iterator<Item = &'a ast::Attribute> { pub fn get_attr<'a>(attrs: &'a [ast::Attribute], name: &'static str) -> impl Iterator<Item = &'a ast::Attribute> {
attrs.iter().filter_map(move |attr| { attrs.iter().filter(move |attr|
if attr.path.segments.len() == 2 && attr.path.segments[0].ident.to_string() == "clippy" && attr.path.segments[1].ident.to_string() == name { attr.path.segments.len() == 2 &&
Some(attr) attr.path.segments[0].ident.to_string() == "clippy" &&
} else { attr.path.segments[1].ident.to_string() == name)
None
}
})
} }
fn parse_attrs<F: FnMut(u64)>(sess: &Session, attrs: &[ast::Attribute], name: &'static str, mut f: F) { fn parse_attrs<F: FnMut(u64)>(sess: &Session, attrs: &[ast::Attribute], name: &'static str, mut f: F) {