Kaynağa Gözat

chore: clippy

skoupidi 9 ay önce
ebeveyn
işleme
38db539bf5
1 değiştirilmiş dosya ile 8 ekleme ve 10 silme
  1. 8 10
      examples/benchmark.rs

+ 8 - 10
examples/benchmark.rs

@@ -30,8 +30,8 @@ impl AtomicHash {
     }
 
     fn xor_with(&self, update: &[u64; 4]) {
-        for i in 0..4 {
-            self.hash[i].fetch_xor(update[i], Ordering::SeqCst);
+        for (i, hash) in self.hash.iter().enumerate() {
+            hash.fetch_xor(update[i], Ordering::SeqCst);
         }
     }
 
@@ -151,7 +151,7 @@ fn cpuid_from_mask(mask: u64, index: usize) -> i32 {
     for i in 0..64 {
         if (mask & (1u64 << i)) != 0 {
             if count == index {
-                return i as i32;
+                return i;
             }
             count += 1;
         }
@@ -288,12 +288,10 @@ fn main() {
         if commit {
             println!(" - hash commitments");
         }
+    } else if commit {
+        println!(" - hash commitments");
     } else {
-        if commit {
-            println!(" - hash commitments");
-        } else {
-            println!(" - batch mode");
-        }
+        println!(" - batch mode");
     }
 
     print!("Initializing");
@@ -369,8 +367,8 @@ fn main() {
 
     if thread_count > 1 {
         let mut handles = vec![];
-        for i in 0..thread_count {
-            let vm = vms[i].clone();
+        for (i, vm) in vms.iter().enumerate() {
+            let vm = vm.clone();
             let atomic_nonce = atomic_nonce.clone();
             let result = result.clone();
             let cpuid = if thread_affinity != 0 {