about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2018-08-23 11:08:07 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2018-08-23 16:06:16 +1000
commit7f4c168a9dd2195b45998ddfecdac111663b26d1 (patch)
tree10791a1710b5fe27d3ba6ef8c65d93c0828a4824 /src
parentd0d81b7fc1421859ba0218e8a437af29ae3b0967 (diff)
downloadrust-7f4c168a9dd2195b45998ddfecdac111663b26d1.tar.gz
rust-7f4c168a9dd2195b45998ddfecdac111663b26d1.zip
Rename the fields in `SparseBitMatrix`.
The new names are clearer.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_data_structures/bitvec.rs38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/librustc_data_structures/bitvec.rs b/src/librustc_data_structures/bitvec.rs
index 49ab3e58812..1ac32af55f6 100644
--- a/src/librustc_data_structures/bitvec.rs
+++ b/src/librustc_data_structures/bitvec.rs
@@ -326,23 +326,23 @@ where
     R: Idx,
     C: Idx,
 {
-    columns: usize,
-    vector: IndexVec<R, BitArray<C>>,
+    num_columns: usize,
+    rows: IndexVec<R, BitArray<C>>,
 }
 
 impl<R: Idx, C: Idx> SparseBitMatrix<R, C> {
     /// Create a new empty sparse bit matrix with no rows or columns.
-    pub fn new(columns: usize) -> Self {
+    pub fn new(num_columns: usize) -> Self {
         Self {
-            columns,
-            vector: IndexVec::new(),
+            num_columns,
+            rows: IndexVec::new(),
         }
     }
 
     fn ensure_row(&mut self, row: R) {
-        let columns = self.columns;
-        self.vector
-            .ensure_contains_elem(row, || BitArray::new(columns));
+        let num_columns = self.num_columns;
+        self.rows
+            .ensure_contains_elem(row, || BitArray::new(num_columns));
     }
 
     /// Sets the cell at `(row, column)` to true. Put another way, insert
@@ -351,7 +351,7 @@ impl<R: Idx, C: Idx> SparseBitMatrix<R, C> {
     /// Returns true if this changed the matrix, and false otherwise.
     pub fn add(&mut self, row: R, column: C) -> bool {
         self.ensure_row(row);
-        self.vector[row].insert(column)
+        self.rows[row].insert(column)
     }
 
     /// Do the bits from `row` contain `column`? Put another way, is
@@ -359,7 +359,7 @@ impl<R: Idx, C: Idx> SparseBitMatrix<R, C> {
     /// if the matrix represents (transitive) reachability, can
     /// `row` reach `column`?
     pub fn contains(&self, row: R, column: C) -> bool {
-        self.vector.get(row).map_or(false, |r| r.contains(column))
+        self.rows.get(row).map_or(false, |r| r.contains(column))
     }
 
     /// Add the bits from row `read` to the bits from row `write`,
@@ -370,49 +370,49 @@ impl<R: Idx, C: Idx> SparseBitMatrix<R, C> {
     /// `write` can reach everything that `read` can (and
     /// potentially more).
     pub fn merge(&mut self, read: R, write: R) -> bool {
-        if read == write || self.vector.get(read).is_none() {
+        if read == write || self.rows.get(read).is_none() {
             return false;
         }
 
         self.ensure_row(write);
-        let (bitvec_read, bitvec_write) = self.vector.pick2_mut(read, write);
+        let (bitvec_read, bitvec_write) = self.rows.pick2_mut(read, write);
         bitvec_write.merge(bitvec_read)
     }
 
     /// Merge a row, `from`, into the `into` row.
     pub fn merge_into(&mut self, into: R, from: &BitArray<C>) -> bool {
         self.ensure_row(into);
-        self.vector[into].merge(from)
+        self.rows[into].merge(from)
     }
 
     /// Add all bits to the given row.
     pub fn add_all(&mut self, row: R) {
         self.ensure_row(row);
-        self.vector[row].insert_all();
+        self.rows[row].insert_all();
     }
 
     /// Number of elements in the matrix.
     pub fn len(&self) -> usize {
-        self.vector.len()
+        self.rows.len()
     }
 
     pub fn rows(&self) -> impl Iterator<Item = R> {
-        self.vector.indices()
+        self.rows.indices()
     }
 
     /// Iterates through all the columns set to true in a given row of
     /// the matrix.
     pub fn iter<'a>(&'a self, row: R) -> impl Iterator<Item = C> + 'a {
-        self.vector.get(row).into_iter().flat_map(|r| r.iter())
+        self.rows.get(row).into_iter().flat_map(|r| r.iter())
     }
 
     /// Iterates through each row and the accompanying bit set.
     pub fn iter_enumerated<'a>(&'a self) -> impl Iterator<Item = (R, &'a BitArray<C>)> + 'a {
-        self.vector.iter_enumerated()
+        self.rows.iter_enumerated()
     }
 
     pub fn row(&self, row: R) -> Option<&BitArray<C>> {
-        self.vector.get(row)
+        self.rows.get(row)
     }
 }