Skip to content

Commit

Permalink
Fmt, bump futures-util
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M committed Dec 31, 2024
1 parent d0b177e commit 96eaaa2
Show file tree
Hide file tree
Showing 17 changed files with 211 additions and 230 deletions.
76 changes: 38 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ pub(crate) fn sdruc_not_expired(output: &Output, current_time: u32) -> Option<&S
.map_or(false, |expiration| current_time >= expiration.timestamp());

Check failure on line 27 in sdk/src/client/api/block_builder/input_selection/core/requirement/amount.rs

View workflow job for this annotation

GitHub Actions / Clippy Results for the Rust Core

this `map_or` is redundant

error: this `map_or` is redundant --> sdk/src/client/api/block_builder/input_selection/core/requirement/amount.rs:25:23 | 25 | let expired = unlock_conditions | _______________________^ 26 | | .expiration() 27 | | .map_or(false, |expiration| current_time >= expiration.timestamp()); | |_______________________________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or help: use is_some_and instead | 25 ~ let expired = unlock_conditions 26 ~ .expiration().is_some_and(|expiration| current_time >= expiration.timestamp()); |

// We only have to send the storage deposit return back if the output is not expired
if !expired { Some(sdr) } else { None }
if !expired {
Some(sdr)
} else {
None
}
})
}

Expand Down
11 changes: 5 additions & 6 deletions sdk/src/types/api/plugins/participation/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,11 @@ impl Participations {

/// Serialize to bytes.
pub fn to_bytes(&self) -> Result<Vec<u8>, Error> {
let mut bytes = vec![
self.participations
.len()
.try_into()
.map_err(|_| Error::InvalidParticipations)?,
];
let mut bytes = vec![self
.participations
.len()
.try_into()
.map_err(|_| Error::InvalidParticipations)?];

for participation in &self.participations {
let event_id: Vec<u8> = participation.event_id.pack_to_vec();
Expand Down
6 changes: 5 additions & 1 deletion sdk/src/types/block/output/alias_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ impl From<&OutputId> for AliasId {
impl AliasId {
///

Check failure on line 21 in sdk/src/types/block/output/alias_id.rs

View workflow job for this annotation

GitHub Actions / Clippy Results for the Rust Core

empty doc comment

error: empty doc comment --> sdk/src/types/block/output/alias_id.rs:21:5 | 21 | /// | ^^^ | = help: consider removing or filling it = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_docs
pub fn or_from_output_id(self, output_id: &OutputId) -> Self {
if self.is_null() { Self::from(output_id) } else { self }
if self.is_null() {
Self::from(output_id)
} else {
self
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion sdk/src/types/block/output/nft_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ impl From<&OutputId> for NftId {
impl NftId {
///

Check failure on line 21 in sdk/src/types/block/output/nft_id.rs

View workflow job for this annotation

GitHub Actions / Clippy Results for the Rust Core

empty doc comment

error: empty doc comment --> sdk/src/types/block/output/nft_id.rs:21:5 | 21 | /// | ^^^ | = help: consider removing or filling it = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_docs
pub fn or_from_output_id(self, output_id: &OutputId) -> Self {
if self.is_null() { Self::from(output_id) } else { self }
if self.is_null() {
Self::from(output_id)
} else {
self
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion sdk/src/types/block/rand/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ use crate::types::block::rand::bool::rand_bool;

/// Generates a random generic option.
pub fn rand_option<T>(inner: T) -> Option<T> {
if rand_bool() { Some(inner) } else { None }
if rand_bool() {
Some(inner)
} else {
None
}
}
6 changes: 5 additions & 1 deletion sdk/src/wallet/account/operations/output_finder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ where
.map(|a| {
// If the index is 1, then we only have the single address before we got during account creation
// To also sync that, we set the index to 0
if a.key_index == 1 { 0 } else { a.key_index }
if a.key_index == 1 {
0
} else {
a.key_index
}
})
// +1, because we don't want to sync the latest address again
.unwrap_or(highest_public_address_index + 1);
Expand Down
20 changes: 8 additions & 12 deletions sdk/src/wallet/storage/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,17 @@ mod tests {
#[tokio::test]
async fn save_get_wallet_data() {
let storage_manager = StorageManager::new(Memory::default(), None).await.unwrap();
assert!(
WalletBuilder::<SecretManager>::load(&storage_manager)
.await
.unwrap()
.is_none()
);
assert!(WalletBuilder::<SecretManager>::load(&storage_manager)
.await
.unwrap()
.is_none());

let wallet_builder = WalletBuilder::<SecretManager>::new();
wallet_builder.save(&storage_manager).await.unwrap();

assert!(
WalletBuilder::<SecretManager>::load(&storage_manager)
.await
.unwrap()
.is_some()
);
assert!(WalletBuilder::<SecretManager>::load(&storage_manager)
.await
.unwrap()
.is_some());
}
}
Loading

0 comments on commit 96eaaa2

Please sign in to comment.