瀏覽代碼

cargo fmt

Cesar Rodas 1 月之前
父節點
當前提交
6e3e0e706e
共有 3 個文件被更改,包括 17 次插入20 次删除
  1. 2 2
      crates/cdk-redb/src/wallet/mod.rs
  2. 2 3
      crates/cdk-sql-common/build.rs
  3. 13 15
      crates/cdk/src/wallet/keysets.rs

+ 2 - 2
crates/cdk-redb/src/wallet/mod.rs

@@ -88,7 +88,7 @@ impl WalletRedbDatabase {
                 if !parent.exists() {
                     return Err(Error::Io(std::io::Error::new(
                         std::io::ErrorKind::NotFound,
-                        format!("Parent directory does not exist: {:?}", parent),
+                        format!("Parent directory does not exist: {parent:?}"),
                     )));
                 }
             }
@@ -196,7 +196,7 @@ impl WalletRedbDatabase {
             if !parent.exists() {
                 return Err(Error::Io(std::io::Error::new(
                     std::io::ErrorKind::NotFound,
-                    format!("Parent directory does not exist: {:?}", parent),
+                    format!("Parent directory does not exist: {parent:?}"),
                 )));
             }
         }

+ 2 - 3
crates/cdk-sql-common/build.rs

@@ -23,7 +23,7 @@ fn main() {
             .unwrap_or("default")
             .replace("/", "_")
             .replace("\\", "_");
-        let dest_path = out_dir.join(format!("migrations_{}.rs", migration_name));
+        let dest_path = out_dir.join(format!("migrations_{migration_name}.rs"));
         let mut out_file = File::create(&dest_path).expect("Failed to create migrations.rs");
 
         let skip_name = migration_path.to_str().unwrap_or_default().len();
@@ -115,8 +115,7 @@ fn main() {
             let relative_to_out_dir = relative_path.to_str().unwrap().replace("\\", "/");
             writeln!(
                 out_file,
-                "    (\"{prefix}\", \"{rel_name}\", include_str!(r#\"{}\"#)),",
-                relative_to_out_dir
+                "    (\"{prefix}\", \"{rel_name}\", include_str!(r#\"{relative_to_out_dir}\"#)),"
             )
             .unwrap();
             println!("cargo:rerun-if-changed={}", path.display());

+ 13 - 15
crates/cdk/src/wallet/keysets.rs

@@ -35,24 +35,22 @@ impl Wallet {
                 tx.add_keys(keys.clone()).await?;
                 keys.keys
             }
+        } else if let Some(keys) = self.localstore.get_keys(&keyset_id).await? {
+            keys
         } else {
-            if let Some(keys) = self.localstore.get_keys(&keyset_id).await? {
-                keys
-            } else {
-                tracing::debug!(
-                    "Keyset {} not in db fetching from mint {}",
-                    keyset_id,
-                    self.mint_url
-                );
+            tracing::debug!(
+                "Keyset {} not in db fetching from mint {}",
+                keyset_id,
+                self.mint_url
+            );
 
-                let keys = self.client.get_mint_keyset(keyset_id).await?;
+            let keys = self.client.get_mint_keyset(keyset_id).await?;
 
-                keys.verify_id()?;
-                let mut tx = self.localstore.begin_db_transaction().await?;
-                tx.add_keys(keys.clone()).await?;
-                tx.commit().await?;
-                keys.keys
-            }
+            keys.verify_id()?;
+            let mut tx = self.localstore.begin_db_transaction().await?;
+            tx.add_keys(keys.clone()).await?;
+            tx.commit().await?;
+            keys.keys
         };
 
         Ok(keys)