فهرست منبع

Fixed warnings

Cesar Rodas 2 ماه پیش
والد
کامیت
291f1f422e

+ 1 - 1
crates/cdk-common/src/database/mint/test/mint.rs

@@ -1257,7 +1257,7 @@ where
 
     // Add blind signature
     let mut tx = Database::begin_transaction(&db).await.unwrap();
-    tx.add_blind_signatures(&[blinded_message], &[sig.clone()], None)
+    tx.add_blind_signatures(&[blinded_message], std::slice::from_ref(&sig), None)
         .await
         .unwrap();
     tx.commit().await.unwrap();

+ 9 - 11
crates/cdk-common/src/database/mint/test/proofs.rs

@@ -468,19 +468,17 @@ where
 
     // Check that at least we get a proper response
     // States may or may not be present depending on how the database stores proofs
-    for state in &states {
-        if let Some(s) = state {
-            // If state is present, it should be a valid state
-            match s {
-                State::Unspent
-                | State::Reserved
-                | State::Pending
-                | State::Spent
-                | State::PendingSpent => {}
-            }
+    for s in states.iter().flatten() {
+        // If state is present, it should be a valid state
+        match s {
+            State::Unspent
+            | State::Reserved
+            | State::Pending
+            | State::Spent
+            | State::PendingSpent => {}
         }
-        // It's OK if state is None for some implementations
     }
+    // It's OK if state is None for some implementations
 }
 
 /// Test getting states for non-existent proofs

+ 6 - 6
crates/cdk-common/src/database/mint/test/signatures.rs

@@ -85,10 +85,10 @@ where
 
     // Add both signatures
     let mut tx = Database::begin_transaction(&db).await.unwrap();
-    tx.add_blind_signatures(&[blinded_message1], &[sig1.clone()], None)
+    tx.add_blind_signatures(&[blinded_message1], std::slice::from_ref(&sig1), None)
         .await
         .unwrap();
-    tx.add_blind_signatures(&[blinded_message2], &[sig2.clone()], None)
+    tx.add_blind_signatures(&[blinded_message2], std::slice::from_ref(&sig2), None)
         .await
         .unwrap();
     tx.commit().await.unwrap();
@@ -141,14 +141,14 @@ where
     let mut tx = Database::begin_transaction(&db).await.unwrap();
     tx.add_blind_signatures(
         &[blinded_message1],
-        &[sig1.clone()],
+        std::slice::from_ref(&sig1),
         Some(quote_id1.clone()),
     )
     .await
     .unwrap();
     tx.add_blind_signatures(
         &[blinded_message2],
-        &[sig2.clone()],
+        std::slice::from_ref(&sig2),
         Some(quote_id2.clone()),
     )
     .await
@@ -252,7 +252,7 @@ where
 
     // Add signature first time
     let mut tx = Database::begin_transaction(&db).await.unwrap();
-    tx.add_blind_signatures(&[blinded_message], &[sig.clone()], None)
+    tx.add_blind_signatures(&[blinded_message], std::slice::from_ref(&sig), None)
         .await
         .unwrap();
     tx.commit().await.unwrap();
@@ -260,7 +260,7 @@ where
     // Try to add duplicate - should fail
     let mut tx = Database::begin_transaction(&db).await.unwrap();
     let result = tx
-        .add_blind_signatures(&[blinded_message], &[sig], None)
+        .add_blind_signatures(&[blinded_message], std::slice::from_ref(&sig), None)
         .await;
     assert!(result.is_err());
     tx.rollback().await.unwrap();