]> git.lizzy.rs Git - rust.git/commitdiff
Apply suggestions from code review
authorAman Arora <arora-aman@users.noreply.github.com>
Fri, 9 Jul 2021 17:45:26 +0000 (13:45 -0400)
committerAman Arora <me@aman-arora.com>
Fri, 9 Jul 2021 19:12:24 +0000 (15:12 -0400)
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
compiler/rustc_typeck/src/check/upvar.rs

index 6a086370713b35c6cae2fbf25da2adb3cf225c32..e0f0215a58c61fe233d7b3b2411ded9af5866fc2 100644 (file)
@@ -306,7 +306,7 @@ fn final_upvar_tys(&self, closure_id: DefId) -> Vec<Ty<'tcx>> {
             .collect()
     }
 
-    /// Adjusts the closure capture information to ensure that the operations aren't unasfe,
+    /// Adjusts the closure capture information to ensure that the operations aren't unsafe,
     /// and that the path can be captured with required capture kind (depending on use in closure,
     /// move closure etc.)
     ///
@@ -319,7 +319,7 @@ fn final_upvar_tys(&self, closure_id: DefId) -> Vec<Ty<'tcx>> {
     /// for generators we don't even implement the closure traits
     /// really).
     ///
-    /// If we inferred that the closure needs to be FnMut/FnOnce, last element of the returned tuplle
+    /// If we inferred that the closure needs to be FnMut/FnOnce, last element of the returned tuple
     /// contains a `Some()` with the `Place` that caused us to do so.
     fn process_collected_capture_information(
         &self,
@@ -331,7 +331,7 @@ fn process_collected_capture_information(
         let mut closure_kind = ty::ClosureKind::LATTICE_BOTTOM;
         let mut origin: Option<(Span, Place<'tcx>)> = None;
 
-        for (place, mut capture_info) in capture_information.into_iter() {
+        for (place, mut capture_info) in capture_information {
             // Apply rules for safety before inferring closure kind
             let place = restrict_capture_precision(place);
 
@@ -1541,8 +1541,6 @@ fn adjust_upvar_deref(
             ty::ImmBorrow => false,
         });
 
-        // let tcx = self.fcx.tcx;
-
         // if this is an implicit deref of an
         // upvar, then we need to modify the
         // borrow_kind of the upvar to make sure it