code review fixes

This commit is contained in:
gaurikholkar 2017-08-20 17:55:07 +05:30
parent 8b89f3168d
commit 2ff1734c61

View File

@ -131,42 +131,29 @@ pub fn find_anon_type(&self, region: Region<'tcx>, br: &ty::BoundRegion) -> Opti
if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) { if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) {
let ret_ty = self.tcx.type_of(def_id); let ret_ty = self.tcx.type_of(def_id);
if let ty::TyFnDef(_, _) = ret_ty.sty { if let ty::TyFnDef(_, _) = ret_ty.sty {
if let hir_map::NodeItem(it) = self.tcx.hir.get(node_id) { let inputs: &[_] =
if let hir::ItemFn(ref fndecl, _, _, _, _, _) = it.node { match self.tcx.hir.get(node_id) {
return fndecl hir_map::NodeItem(&hir::Item {
.inputs node: hir::ItemFn(ref fndecl, ..), ..
.iter() }) => &fndecl.inputs,
.filter_map(|arg| { hir_map::NodeTraitItem(&hir::TraitItem {
self.find_component_for_bound_region(&**arg, node: hir::TraitItemKind::Method(ref fndecl, ..),
br) ..
}) }) => &fndecl.decl.inputs,
.next(); hir_map::NodeImplItem(&hir::ImplItem {
} node: hir::ImplItemKind::Method(ref fndecl, ..),
} else if let hir_map::NodeTraitItem(it) = self.tcx.hir.get(node_id) { ..
if let hir::TraitItemKind::Method(ref fndecl, _) = it.node { }) => &fndecl.decl.inputs,
return fndecl
.decl _ => &[],
.inputs };
.iter()
.filter_map(|arg| { return inputs
self.find_component_for_bound_region(&**arg, .iter()
br) .filter_map(|arg| {
}) self.find_component_for_bound_region(&**arg, br)
.next(); })
} .next();
} else if let hir_map::NodeImplItem(it) = self.tcx.hir.get(node_id) {
if let hir::ImplItemKind::Method(ref fndecl, _) = it.node {
return fndecl
.decl
.inputs
.iter()
.filter_map(|arg| {
self.find_component_for_bound_region(&**arg,
br)
})
.next();
}
}
} }
} }
} }