]> Repositorios git - scryer-prolog.git/commitdiff
run cargo fmt
authorMark Thom <[email protected]>
Sat, 1 Mar 2025 21:58:50 +0000 (13:58 -0800)
committerMark Thom <[email protected]>
Tue, 8 Jul 2025 05:02:27 +0000 (22:02 -0700)
src/heap_iter.rs
src/lib.rs
src/machine/gc.rs
src/machine/mock_wam.rs

index fd9b1b0c419c8864516e94b58180ed1063cc9a1b..2b0e44c12a62168e6c23139a0cea36cf79618db4 100644 (file)
@@ -2220,10 +2220,16 @@ mod tests {
             assert_eq!(iter.next(), None);
         }
 
-        assert_eq!(wam.machine_st.heap.slice_to_str(0, "a string".len()), "a string");
-        assert_eq!(wam.machine_st.heap[1], HeapCellValue::build_with(HeapCellValueTag::Cons, 0));
+        assert_eq!(
+            wam.machine_st.heap.slice_to_str(0, "a string".len()),
+            "a string"
+        );
+        assert_eq!(
+            wam.machine_st.heap[1],
+            HeapCellValue::build_with(HeapCellValueTag::Cons, 0)
+        );
 
-        for idx in 2 ..= 3 {
+        for idx in 2..=3 {
             assert!(!wam.machine_st.heap[idx].get_mark_bit());
             assert!(!wam.machine_st.heap[idx].get_forwarding_bit());
         }
@@ -2970,7 +2976,6 @@ mod tests {
         assert_eq!(wam.machine_st.heap[4], heap_loc_as_cell!(0));
 
         wam.machine_st.heap.clear();
-
     }
 
     #[test]
index ffd532f7278d79bb0ef73a66690063729dac0763..1926c7df5265d166be0b2ef29ede9f9f7bbf06fd 100644 (file)
@@ -2,7 +2,6 @@
 #![recursion_limit = "4112"]
 #![deny(missing_docs)]
 
-
 #[macro_use]
 extern crate static_assertions;
 
index b18b5300a72b874faaf2be4bf8b4966d2a81c47e..cb46f8614eec79527b423f5b925bc180450405de 100644 (file)
@@ -130,7 +130,7 @@ impl PStrLocValuesMap {
     }
 
     fn progress_pstr_marking(&mut self, heap_slice: &[u8], pstr_loc: usize) -> usize {
-        match self.hit_set.range(..= pstr_loc).next_back() {
+        match self.hit_set.range(..=pstr_loc).next_back() {
             Some((_prev_pstr_loc, &tail_idx)) if pstr_loc < heap_index!(tail_idx) => {
                 return tail_idx;
             }
@@ -142,7 +142,10 @@ impl PStrLocValuesMap {
             None => heap_slice.len(),
         };
 
-        match heap_slice[pstr_loc..delimiter].iter().position(|b| *b == 0u8) {
+        match heap_slice[pstr_loc..delimiter]
+            .iter()
+            .position(|b| *b == 0u8)
+        {
             Some(zero_byte_offset) => {
                 let tail_idx = if (zero_byte_offset + 1) % Heap::heap_cell_alignment() == 0 {
                     cell_index!(pstr_loc + zero_byte_offset) + 2
@@ -354,7 +357,8 @@ impl<'a, UMP: UnmarkPolicy> StacklessPreOrderHeapIter<'a, UMP> {
                             .pstr_loc_values
                             .progress_pstr_marking(self.heap.as_slice(), pstr_loc);
 
-                        self.pstr_loc_values.insert_pstr_loc_value(self.current, pstr_loc);
+                        self.pstr_loc_values
+                            .insert_pstr_loc_value(self.current, pstr_loc);
 
                         if self.heap[tail_idx].get_forwarding_bit() {
                             return Some(self.backward_and_return());
@@ -379,10 +383,18 @@ impl<'a, UMP: UnmarkPolicy> StacklessPreOrderHeapIter<'a, UMP> {
                         }
                     }
                     HeapCellValueTag::Cons => {
-                        match self.pstr_loc_values.hit_set.range(.. heap_index!(self.current + 1)).next_back() {
+                        match self
+                            .pstr_loc_values
+                            .hit_set
+                            .range(..heap_index!(self.current + 1))
+                            .next_back()
+                        {
                             Some((_prev_pstr_loc, &tail_idx)) if self.current + 1 == tail_idx => {
                                 let pstr_loc_loc = self.heap[self.current].get_value() as usize;
-                                let pstr_loc_val = self.pstr_loc_values.pstr_loc_loc_value(pstr_loc_loc).unwrap();
+                                let pstr_loc_val = self
+                                    .pstr_loc_values
+                                    .pstr_loc_loc_value(pstr_loc_loc)
+                                    .unwrap();
 
                                 self.heap[self.current].set_value(self.next);
 
index 71f74f0c29cb64f2e71a90b478baa577726a4890..32c4cf59fb2dffefcebb98e0ea822e1e033cb1da 100644 (file)
@@ -439,14 +439,23 @@ mod tests {
 
         assert!(!wam.fail);
 
-        assert_eq!(wam.heap.slice_to_str(heap_index!(0), "this is a string".len()),
-                   "this is a string");
+        assert_eq!(
+            wam.heap
+                .slice_to_str(heap_index!(0), "this is a string".len()),
+            "this is a string"
+        );
         assert_eq!(wam.heap[3], pstr_loc_as_cell!(heap_index!(8)));
-        assert_eq!(wam.heap.slice_to_str(heap_index!(4), "this is a string".len()),
-                   "this is a string");
+        assert_eq!(
+            wam.heap
+                .slice_to_str(heap_index!(4), "this is a string".len()),
+            "this is a string"
+        );
         assert_eq!(wam.heap[7], pstr_loc_as_cell!(heap_index!(8)));
-        assert_eq!(wam.heap.slice_to_str(heap_index!(8), "this is a string".len()),
-                   "this is a string");
+        assert_eq!(
+            wam.heap
+                .slice_to_str(heap_index!(8), "this is a string".len()),
+            "this is a string"
+        );
         assert_eq!(wam.heap[11], pstr_loc_as_cell!(heap_index!(8)));
 
         wam.heap.clear();