]> git.lizzy.rs Git - rust.git/commitdiff
code review fixes
authorgaurikholkar <f2013002@goa.bits-pilani.ac.in>
Thu, 22 Jun 2017 17:56:05 +0000 (10:56 -0700)
committergaurikholkar <f2013002@goa.bits-pilani.ac.in>
Thu, 29 Jun 2017 13:37:18 +0000 (06:37 -0700)
src/librustc/infer/error_reporting/named_anon_conflict.rs

index a63ae186f61d856ccd7beb93ef02ba47bd9ceb17..4a1f4b418ae4a1555089d4f566c7d7da846f385f 100644 (file)
@@ -43,39 +43,36 @@ fn find_arg_with_anonymous_region
                 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