diff options
| author | gaurikholkar <f2013002@goa.bits-pilani.ac.in> | 2017-06-22 10:56:05 -0700 |
|---|---|---|
| committer | gaurikholkar <f2013002@goa.bits-pilani.ac.in> | 2017-06-29 06:37:18 -0700 |
| commit | 82f25b32ae568986de275d87fe355ec63307d8cb (patch) | |
| tree | 29a76aaf2e859226f4d8eb3c24e6f66def806bbe | |
| parent | a851e1e543c944b38472751d251593f3c593cc3a (diff) | |
| download | rust-82f25b32ae568986de275d87fe355ec63307d8cb.tar.gz rust-82f25b32ae568986de275d87fe355ec63307d8cb.zip | |
code review fixes
| -rw-r--r-- | src/librustc/infer/error_reporting/named_anon_conflict.rs | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/src/librustc/infer/error_reporting/named_anon_conflict.rs b/src/librustc/infer/error_reporting/named_anon_conflict.rs index a63ae186f61..4a1f4b418ae 100644 --- a/src/librustc/infer/error_reporting/named_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/named_anon_conflict.rs @@ -43,39 +43,36 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let body_id = self.tcx.hir.maybe_body_owned_by(node_id).unwrap(); let mut is_first = false; let body = self.tcx.hir.body(body_id); - body.arguments - .iter() - .filter_map(|arg| if let Some(tables) = self.in_progress_tables { - let ty = tables.borrow().node_id_to_type(arg.id); - let mut found_anon_region = false; - let new_arg_ty = self.tcx - .fold_regions(&ty, - &mut false, - |r, _| if *r == *anon_region { - found_anon_region = true; - named_region - } else { - r - }); - if found_anon_region { - if body.arguments.iter().nth(0) == Some(&arg) { - is_first = true; - } - return Some((arg, - new_arg_ty, - free_region.bound_region, - is_first)); - } else { - None - } + if let Some(tables) = self.in_progress_tables { + body.arguments + .iter() + .filter_map(|arg| { + let ty = tables.borrow().node_id_to_type(arg.id); + let mut found_anon_region = false; + let new_arg_ty = self.tcx + .fold_regions(&ty, &mut false, |r, _| if *r == *anon_region { + found_anon_region = true; + named_region } else { - None - }) - .next() + r + }); + if found_anon_region { + if body.arguments.iter().nth(0) == Some(&arg) { + is_first = true; + } + Some((arg, new_arg_ty, free_region.bound_region, is_first)) + } else { + None + } + }) + .next() + } else { + None + } } _ => None, - } + } } // This method generates the error message for the case when |
