Skip to content

Commit 52da886

Browse files
committed
rustc/infer: miscellaneous minor code improvements
1 parent 70eeb05 commit 52da886

File tree

3 files changed

+6
-8
lines changed
  • src/librustc/infer

3 files changed

+6
-8
lines changed

src/librustc/infer/error_reporting/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
406406
errors.clone()
407407
} else {
408408
errors
409-
.iter()
410-
.filter(|&e| !is_bound_failure(e))
411-
.cloned()
412-
.collect()
409+
.iter()
410+
.filter(|&e| !is_bound_failure(e))
411+
.cloned()
412+
.collect()
413413
};
414414

415415
// sort the errors by span, for better error message stability.

src/librustc/infer/lexical_region_resolve/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> {
147147
fn construct_var_data(&self, tcx: TyCtxt<'_, '_, 'tcx>) -> LexicalRegionResolutions<'tcx> {
148148
LexicalRegionResolutions {
149149
error_region: tcx.types.re_static,
150-
values: (0..self.num_vars())
151-
.map(|_| VarValue::Value(tcx.types.re_empty))
152-
.collect(),
150+
values: IndexVec::from_elem_n(VarValue::Value(tcx.types.re_empty), self.num_vars())
153151
}
154152
}
155153

src/librustc/infer/region_constraints/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
443443
assert!(self.undo_log[snapshot.length] == OpenSnapshot);
444444

445445
if snapshot.length == 0 {
446-
self.undo_log.truncate(0);
446+
self.undo_log.clear();
447447
} else {
448448
(*self.undo_log)[snapshot.length] = CommitedSnapshot;
449449
}

0 commit comments

Comments
 (0)