about summary refs log tree commit diff
path: root/src/librustc_data_structures/snapshot_map
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2019-12-22 17:42:04 -0500
committerMark Rousskov <mark.simulacrum@gmail.com>2019-12-22 17:42:47 -0500
commita06baa56b95674fc626b3c3fd680d6a65357fe60 (patch)
treecd9d867c2ca3cff5c1d6b3bd73377c44649fb075 /src/librustc_data_structures/snapshot_map
parent8eb7c58dbb7b32701af113bc58722d0d1fefb1eb (diff)
Format the world
Diffstat (limited to 'src/librustc_data_structures/snapshot_map')
-rw-r--r--src/librustc_data_structures/snapshot_map/mod.rs29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/librustc_data_structures/snapshot_map/mod.rs b/src/librustc_data_structures/snapshot_map/mod.rs
index bdd3dc96656..b71163a8f94 100644
--- a/src/librustc_data_structures/snapshot_map/mod.rs
+++ b/src/librustc_data_structures/snapshot_map/mod.rs
@@ -1,13 +1,14 @@
 use crate::fx::FxHashMap;
 use std::hash::Hash;
-use std::ops;
 use std::mem;
+use std::ops;
 
 #[cfg(test)]
 mod tests;
 
 pub struct SnapshotMap<K, V>
-    where K: Clone + Eq
+where
+    K: Clone + Eq,
 {
     map: FxHashMap<K, V>,
     undo_log: Vec<UndoLog<K, V>>,
@@ -16,14 +17,11 @@ pub struct SnapshotMap<K, V>
 
 // HACK(eddyb) manual impl avoids `Default` bounds on `K` and `V`.
 impl<K, V> Default for SnapshotMap<K, V>
-    where K: Hash + Clone + Eq
+where
+    K: Hash + Clone + Eq,
 {
     fn default() -> Self {
-        SnapshotMap {
-            map: Default::default(),
-            undo_log: Default::default(),
-            num_open_snapshots: 0,
-        }
+        SnapshotMap { map: Default::default(), undo_log: Default::default(), num_open_snapshots: 0 }
     }
 }
 
@@ -38,7 +36,8 @@ enum UndoLog<K, V> {
 }
 
 impl<K, V> SnapshotMap<K, V>
-    where K: Hash + Clone + Eq
+where
+    K: Hash + Clone + Eq,
 {
     pub fn clear(&mut self) {
         self.map.clear();
@@ -107,13 +106,12 @@ impl<K, V> SnapshotMap<K, V>
         self.num_open_snapshots -= 1;
     }
 
-    pub fn partial_rollback<F>(&mut self,
-                               snapshot: &Snapshot,
-                               should_revert_key: &F)
-        where F: Fn(&K) -> bool
+    pub fn partial_rollback<F>(&mut self, snapshot: &Snapshot, should_revert_key: &F)
+    where
+        F: Fn(&K) -> bool,
     {
         self.assert_open_snapshot(snapshot);
-        for i in (snapshot.len .. self.undo_log.len()).rev() {
+        for i in (snapshot.len..self.undo_log.len()).rev() {
             let reverse = match self.undo_log[i] {
                 UndoLog::Purged => false,
                 UndoLog::Inserted(ref k) => should_revert_key(k),
@@ -153,7 +151,8 @@ impl<K, V> SnapshotMap<K, V>
 }
 
 impl<'k, K, V> ops::Index<&'k K> for SnapshotMap<K, V>
-    where K: Hash + Clone + Eq
+where
+    K: Hash + Clone + Eq,
 {
     type Output = V;
     fn index(&self, key: &'k K) -> &V {