File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -524,7 +524,8 @@ pub(crate) fn cleanup_failed_wallet(metadata: &WalletMetadata) -> Vec<String> {
524524
525525fn import_labels ( id : & WalletId , jsonl : & str ) -> Result < ( ) , BackupError > {
526526 let manager = LabelManager :: new ( id. clone ( ) ) ;
527- manager. import ( jsonl) . map ( drop) . map_err ( |e| BackupError :: Restore ( e. to_string ( ) ) )
527+ manager. import ( jsonl) . map_err ( |e| BackupError :: Restore ( e. to_string ( ) ) ) ?;
528+ Ok ( ( ) )
528529}
529530
530531pub ( crate ) fn restore_wallet_labels (
@@ -542,8 +543,8 @@ pub(crate) fn restore_wallet_labels(
542543 LabelRestoreBehavior :: MarkCloudBackupDirty => import_labels ( wallet_id, jsonl) ,
543544 LabelRestoreBehavior :: PreserveCloudBackupClean => manager
544545 . import_without_cloud_backup_dirty ( jsonl)
545- . map ( drop )
546- . map_err ( |error| BackupError :: Restore ( error . to_string ( ) ) ) ,
546+ . map_err ( |error| BackupError :: Restore ( error . to_string ( ) ) )
547+ . map ( |_| ( ) ) ,
547548 } ;
548549
549550 match import_result {
Original file line number Diff line number Diff line change @@ -238,7 +238,7 @@ impl LabelManager {
238238 }
239239
240240 #[ uniffi:: method( name = "importLabels" ) ]
241- pub fn _import_labels (
241+ pub fn ffi_import_labels (
242242 & self ,
243243 labels : Arc < Bip329Labels > ,
244244 ) -> Result < LabelParseReport , LabelManagerError > {
@@ -315,17 +315,15 @@ impl LabelManager {
315315 labels : impl Into < Labels > ,
316316 ) -> Result < LabelParseReport , LabelManagerError > {
317317 let labels = labels. into ( ) ;
318- // Count only supported variants — insert_label_with_write_txn silently drops
318+ // count only supported variants — insert_label_with_write_txn silently drops
319319 // PublicKey and ExtendedPublicKey, so labels.len() would overstate the import count.
320- let supported = labels
321- . iter ( )
322- . filter ( |l| {
323- matches ! (
324- l,
325- Label :: Transaction ( _) | Label :: Address ( _) | Label :: Input ( _) | Label :: Output ( _)
326- )
327- } )
328- . count ( ) as u32 ;
320+ let is_supported = |l : & & Label | {
321+ matches ! (
322+ l,
323+ Label :: Transaction ( _) | Label :: Address ( _) | Label :: Input ( _) | Label :: Output ( _)
324+ )
325+ } ;
326+ let supported = labels. iter ( ) . filter ( is_supported) . count ( ) as u32 ;
329327 let skipped = labels. len ( ) as u32 - supported;
330328 let report = LabelParseReport { imported : supported, skipped } ;
331329 self . save_imported_labels ( labels, report, true )
You can’t perform that action at this time.
0 commit comments