Browse Source

Reformat code

luojia65 3 years ago
parent
commit
a49a4a3411
3 changed files with 11 additions and 7 deletions
  1. 8 5
      src/hart_mask.rs
  2. 1 1
      src/privileged.rs
  3. 2 1
      src/util.rs

+ 8 - 5
src/hart_mask.rs

@@ -12,14 +12,17 @@ impl HartMask {
             inner: MaskInner::BitVector {
                 hart_mask,
                 hart_mask_base,
-            }
+            },
         }
     }
     /// Check if the `hart_id` is included in this hart mask structure.
     #[inline]
     pub fn has_bit(&self, hart_id: usize) -> bool {
         match self.inner {
-            MaskInner::BitVector { hart_mask, hart_mask_base } => {
+            MaskInner::BitVector {
+                hart_mask,
+                hart_mask_base,
+            } => {
                 if hart_mask_base == usize::MAX {
                     // If `hart_mask_base` equals `usize::MAX`, that means `hart_mask` is ignored
                     // and all available harts must be considered.
@@ -36,10 +39,10 @@ impl HartMask {
                     return false;
                 }
                 hart_mask & (1 << idx) != 0
-            },
+            }
             MaskInner::Legacy { legacy_bit_vector } => {
                 slow_legacy_has_bit(legacy_bit_vector, hart_id)
-            },
+            }
         }
     }
 
@@ -52,7 +55,7 @@ impl HartMask {
         HartMask {
             inner: MaskInner::Legacy {
                 legacy_bit_vector: vaddr as *const _,
-            }
+            },
         }
     }
 }

+ 1 - 1
src/privileged.rs

@@ -43,6 +43,6 @@ pub unsafe fn enter_privileged(mhartid: usize, opaque: usize) -> ! {
         () => {
             let _ = (mhartid, opaque);
             unimplemented!("not RISC-V architecture")
-        },
+        }
     }
 }

+ 2 - 1
src/util.rs

@@ -100,7 +100,8 @@ impl<T: ?Sized> OnceFatBox<T> {
                 options(nostack)
             );
             // critical section begin
-            if (*self.thin_ptr.get()).is_null() { // not 'self.thin_ptr.get().is_null()'
+            if (*self.thin_ptr.get()).is_null() {
+                // not 'self.thin_ptr.get().is_null()'
                 *self.thin_ptr.get() = data_address;
                 *(self.meta.as_ptr() as *mut _) = ptr::metadata(fat_ptr);
                 ans = Ok(())