Forráskód Böngészése

feat: bump msrv from 1.75.0 to 1.85.0

thesimplekid 2 hónapja
szülő
commit
ec9108d69d

+ 2 - 0
CHANGELOG.md

@@ -41,6 +41,8 @@
 - cdk-integration-tests: Updated integration tests to use proper temp directory management ([thesimplekid]).
 - cdk-integration-tests: Simplified regtest shell scripts to use new binaries ([thesimplekid]).
 - crates/cdk-mintd: Moved mintd library functions to separate module for better organization and testability ([thesimplekid]).
+- Updated MSRV to 1.85.0 ([thesimplekid]).
+- dev: Simplified Nix flake configuration by removing specific dependency version constraints from MSRV shell hook ([thesimplekid]).
 
 ### Fixed
 - cashu: Fixed CurrencyUnit custom units preserving original case instead of being converted to uppercase ([thesimplekid]).

+ 1 - 1
Cargo.toml

@@ -29,7 +29,7 @@ bare_urls = "warn"
 
 [workspace.package]
 edition = "2021"
-rust-version = "1.75.0"
+rust-version = "1.85.0"
 license = "MIT"
 homepage = "https://github.com/cashubtc/cdk"
 repository = "https://github.com/cashubtc/cdk.git"

+ 2 - 5
crates/cashu/src/nuts/nut04.rs

@@ -331,7 +331,7 @@ mod tests {
 
         match settings.options {
             Some(MintMethodOptions::Bolt11 { description }) => {
-                assert_eq!(description, true);
+                assert!(description);
             }
             _ => panic!("Expected Bolt11 options with description = true"),
         }
@@ -363,10 +363,7 @@ mod tests {
 
         match settings.options {
             Some(MintMethodOptions::Bolt11 { description }) => {
-                assert_eq!(
-                    description, true,
-                    "Top-level description should take precedence"
-                );
+                assert!(description, "Top-level description should take precedence");
             }
             _ => panic!("Expected Bolt11 options with description = true"),
         }

+ 2 - 5
crates/cashu/src/nuts/nut05.rs

@@ -405,7 +405,7 @@ mod tests {
 
         match settings.options {
             Some(MeltMethodOptions::Bolt11 { amountless }) => {
-                assert_eq!(amountless, true);
+                assert!(amountless);
             }
             _ => panic!("Expected Bolt11 options with amountless = true"),
         }
@@ -437,10 +437,7 @@ mod tests {
 
         match settings.options {
             Some(MeltMethodOptions::Bolt11 { amountless }) => {
-                assert_eq!(
-                    amountless, true,
-                    "Top-level amountless should take precedence"
-                );
+                assert!(amountless, "Top-level amountless should take precedence");
             }
             _ => panic!("Expected Bolt11 options with amountless = true"),
         }

+ 1 - 1
crates/cashu/src/nuts/nut18/payment_request.rs

@@ -404,7 +404,7 @@ mod tests {
         let bolt11 = Bolt11Invoice::from_str(bolt11).unwrap();
 
         let nut10 = SpendingConditions::HTLCConditions {
-            data: bolt11.payment_hash().clone(),
+            data: *bolt11.payment_hash(),
             conditions: None,
         };
 

+ 1 - 2
crates/cdk-cln/src/lib.rs

@@ -97,9 +97,8 @@ impl MintPayment for Cln {
             self.rpc_socket
         );
 
-        let last_pay_index = self.get_last_pay_index().await?.map(|idx| {
+        let last_pay_index = self.get_last_pay_index().await?.inspect(|&idx| {
             tracing::info!("CLN: Found last payment index: {}", idx);
-            idx
         });
 
         tracing::debug!("CLN: Connecting to CLN node...");

+ 8 - 12
crates/cdk-sql-common/src/mint/mod.rs

@@ -564,9 +564,8 @@ where
         .bind("quote_id", quote_id.as_hyphenated().to_string())
         .fetch_one(&self.inner)
         .await
-        .map_err(|err| {
-            tracing::error!("SQLite could not get mint quote amount_paid");
-            err
+        .inspect_err(|err| {
+            tracing::error!("SQLite could not get mint quote amount_paid: {}", err);
         })?;
 
         let current_amount_paid = if let Some(current_amount) = current_amount {
@@ -593,9 +592,8 @@ where
         .bind("quote_id", quote_id.as_hyphenated().to_string())
         .execute(&self.inner)
         .await
-        .map_err(|err| {
-            tracing::error!("SQLite could not update mint quote amount_paid");
-            err
+        .inspect_err(|err| {
+            tracing::error!("SQLite could not update mint quote amount_paid: {}", err);
         })?;
 
         // Add payment_id to mint_quote_payments table
@@ -638,9 +636,8 @@ where
         .bind("quote_id", quote_id.as_hyphenated().to_string())
         .fetch_one(&self.inner)
         .await
-        .map_err(|err| {
-            tracing::error!("SQLite could not get mint quote amount_issued");
-            err
+        .inspect_err(|err| {
+            tracing::error!("SQLite could not get mint quote amount_issued: {}", err);
         })?;
 
         let current_amount_issued = if let Some(current_amount) = current_amount {
@@ -668,9 +665,8 @@ where
         .bind("quote_id", quote_id.as_hyphenated().to_string())
         .execute(&self.inner)
         .await
-        .map_err(|err| {
-            tracing::error!("SQLite could not update mint quote amount_issued");
-            err
+        .inspect_err(|err| {
+            tracing::error!("SQLite could not update mint quote amount_issued: {}", err);
         })?;
 
         let current_time = unix_time();

+ 10 - 12
crates/cdk/src/wallet/subscription/ws.rs

@@ -46,19 +46,17 @@ pub async fn ws_main(
     mut on_drop: mpsc::Receiver<SubId>,
     wallet: Arc<Wallet>,
 ) {
-    let url = mint_url
+    let mut url = mint_url
         .join_paths(&["v1", "ws"])
-        .as_mut()
-        .map(|url| {
-            if url.scheme() == "https" {
-                url.set_scheme("wss").expect("Could not set scheme");
-            } else {
-                url.set_scheme("ws").expect("Could not set scheme");
-            }
-            url
-        })
-        .expect("Could not join paths")
-        .to_string();
+        .expect("Could not join paths");
+
+    if url.scheme() == "https" {
+        url.set_scheme("wss").expect("Could not set scheme");
+    } else {
+        url.set_scheme("ws").expect("Could not set scheme");
+    }
+
+    let url = url.to_string();
 
     let mut active_subscriptions = HashMap::<SubId, mpsc::Sender<_>>::new();
     let mut failure_count = 0;

+ 1 - 12
flake.nix

@@ -55,7 +55,7 @@
         };
 
         # MSRV stable
-        msrv_toolchain = pkgs.rust-bin.stable."1.75.0".default.override {
+        msrv_toolchain = pkgs.rust-bin.stable."1.85.0".default.override {
           targets = [ "wasm32-unknown-unknown" ]; # wasm
         };
 
@@ -139,17 +139,6 @@
             msrv = pkgs.mkShell ({
               shellHook = "
               ${_shellHook}
-              cargo update
-              # cargo update -p async-compression --precise 0.4.3
-              cargo update -p home --precise 0.5.9
-              cargo update -p zerofrom --precise 0.1.5
-              cargo update -p half --precise 2.4.1
-              cargo update -p base64ct --precise 1.7.3
-              cargo update -p url --precise 2.5.2
-              cargo update -p pest_derive --precise 2.8.0
-              cargo update -p pest_generator --precise 2.8.0
-              cargo update -p pest_meta --precise 2.8.0
-              cargo update -p pest --precise 2.8.0
               ";
               buildInputs = buildInputs ++ [ msrv_toolchain ];
               inherit nativeBuildInputs;