]> git.lizzy.rs Git - rust.git/commitdiff
rustc/infer: miscellaneous minor code improvements
authorljedrz <ljedrz@gmail.com>
Fri, 28 Sep 2018 15:38:02 +0000 (17:38 +0200)
committerljedrz <ljedrz@gmail.com>
Sat, 29 Sep 2018 12:57:42 +0000 (14:57 +0200)
src/librustc/infer/error_reporting/mod.rs
src/librustc/infer/lexical_region_resolve/mod.rs
src/librustc/infer/region_constraints/mod.rs

index a24eeb328427f64897a88f20532f71f4cd35e67a..6b9bb852a54f2ebaf4541a1c9a7cf433cec0b742 100644 (file)
@@ -406,10 +406,10 @@ fn process_errors(
             errors.clone()
         } else {
             errors
-                .iter()
-                .filter(|&e| !is_bound_failure(e))
-                .cloned()
-                .collect()
+            .iter()
+            .filter(|&e| !is_bound_failure(e))
+            .cloned()
+            .collect()
         };
 
         // sort the errors by span, for better error message stability.
index a8fbfc3b64dfd1e1d63ec40bc02b415bc3bdf882..c2e75bedf0aed931ca5421c208eb14cab958b401 100644 (file)
@@ -147,9 +147,7 @@ fn num_vars(&self) -> usize {
     fn construct_var_data(&self, tcx: TyCtxt<'_, '_, 'tcx>) -> LexicalRegionResolutions<'tcx> {
         LexicalRegionResolutions {
             error_region: tcx.types.re_static,
-            values: (0..self.num_vars())
-                .map(|_| VarValue::Value(tcx.types.re_empty))
-                .collect(),
+            values: IndexVec::from_elem_n(VarValue::Value(tcx.types.re_empty), self.num_vars())
         }
     }
 
index 1a79ca211283b8a5d5b8090a66985ec542ceb98b..f6192efb79ec1e10d1d42870e74cfe1ab54a5a90 100644 (file)
@@ -443,7 +443,7 @@ pub fn commit(&mut self, snapshot: RegionSnapshot) {
         assert!(self.undo_log[snapshot.length] == OpenSnapshot);
 
         if snapshot.length == 0 {
-            self.undo_log.truncate(0);
+            self.undo_log.clear();
         } else {
             (*self.undo_log)[snapshot.length] = CommitedSnapshot;
         }