]> git.lizzy.rs Git - rust.git/commitdiff
mir/borrowck: remove redundant returns
authorljedrz <ljedrz@gmail.com>
Tue, 16 Oct 2018 13:25:18 +0000 (15:25 +0200)
committerljedrz <ljedrz@gmail.com>
Wed, 17 Oct 2018 12:40:47 +0000 (14:40 +0200)
src/librustc_mir/borrow_check/mod.rs

index ce0cc20f6de34bf0a8023559e53930b69b1ac8c4..aeb77c67317a08e69fbe351f8d0b899c707f8524 100644 (file)
@@ -1589,7 +1589,7 @@ fn move_path_closest_to<'a>(
             Place::Local(_) => panic!("should have move path for every Local"),
             Place::Projection(_) => panic!("PrefixSet::All meant don't stop for Projection"),
             Place::Promoted(_) |
-            Place::Static(_) => return Err(NoMovePathFound::ReachedStatic),
+            Place::Static(_) => Err(NoMovePathFound::ReachedStatic),
         }
     }
 
@@ -1881,7 +1881,7 @@ fn check_access_permissions(
         }
 
         // at this point, we have set up the error reporting state.
-        if previously_initialized {
+        return if previously_initialized {
             self.report_mutability_error(
                 place,
                 span,
@@ -1889,10 +1889,10 @@ fn check_access_permissions(
                 error_access,
                 location,
             );
-            return true;
+            true
         } else {
-            return false;
-        }
+            false
+        };
     }
 
     fn is_local_ever_initialized(&self,
@@ -1907,7 +1907,7 @@ fn is_local_ever_initialized(&self,
                 return Some(index);
             }
         }
-        return None;
+        None
     }
 
     /// Adds the place into the used mutable variables set