Skip to content

Commit

Permalink
Final clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
citizen-stig committed Jun 7, 2023
1 parent 01a15e8 commit 00cd9aa
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 31 deletions.
5 changes: 4 additions & 1 deletion adapters/celestia/src/da_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ mod tests {
.expect("iterator should contain exactly one blob");

let found_data: Vec<u8> = first_blob.data().collect();
assert!(&found_data == r#"{"key": "testkey", "value": "testvalue"}"#.as_bytes());
assert_eq!(
found_data,
r#"{"key": "testkey", "value": "testvalue"}"#.as_bytes()
);

assert!(blobs.next().is_none());
}
Expand Down
12 changes: 9 additions & 3 deletions full-node/db/sov-db/src/schema/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,15 @@ macro_rules! u64_wrapper {
)]
pub struct $name(pub u64);

impl Into<u64> for $name {
fn into(self) -> u64 {
self.0
impl From<u64> for $name {
fn from(value: u64) -> Self {
Self(value)
}
}

impl From<$name> for u64 {
fn from(value: $name) -> Self {
value.0
}
}
};
Expand Down
30 changes: 12 additions & 18 deletions module-system/module-implementations/sov-bank/tests/freeze_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ fn freeze_token() {
token_address: token_address_2.clone(),
};

let freeze = bank.call(
freeze_message,
&unauthorized_context,
&mut working_set,
);
let freeze = bank.call(freeze_message, &unauthorized_context, &mut working_set);
assert!(freeze.is_err());
let unauthorized_minter_msg = format!(
"Sender {} is not an authorized minter",
Expand All @@ -111,17 +107,16 @@ fn freeze_token() {
let mint_message = CallMessage::Mint {
coins: Coins {
amount: mint_amount,
token_address: token_address,
token_address,
},
minter_address: new_holder,
};

let query_total_supply = |token_address: Address,
working_set: &mut WorkingSet<Storage>|
-> Option<u64> {
let total_supply: TotalSupplyResponse = bank.supply_of(token_address, working_set);
total_supply.amount
};
let query_total_supply =
|token_address: Address, working_set: &mut WorkingSet<Storage>| -> Option<u64> {
let total_supply: TotalSupplyResponse = bank.supply_of(token_address, working_set);
total_supply.amount
};

let minted = bank.call(mint_message, &minter_context, &mut working_set);
assert!(minted.is_err());
Expand Down Expand Up @@ -150,12 +145,11 @@ fn freeze_token() {
let total_supply = query_total_supply(token_address_2.clone(), &mut working_set);
assert_eq!(Some(initial_balance + mint_amount), total_supply);

let query_user_balance = |token_address: Address,
user_address: Address,
working_set: &mut WorkingSet<Storage>|
-> Option<u64> {
bank.get_balance_of(user_address, token_address, working_set)
};
let query_user_balance =
|token_address: Address,
user_address: Address,
working_set: &mut WorkingSet<Storage>|
-> Option<u64> { bank.get_balance_of(user_address, token_address, working_set) };
let bal = query_user_balance(token_address_2, minter_address, &mut working_set);

assert_eq!(Some(110), bal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fn transfer_initial_token() {
to: receiver_address.clone(),
coins: Coins {
amount: 1,
token_address: token_address,
token_address,
},
};

Expand Down
14 changes: 6 additions & 8 deletions module-system/sov-modules-macros/src/dispatch/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,12 @@ pub fn get_attribute_values(item: &syn::DeriveInput, attribute_name: &str) -> Ve
.iter()
.find(|attr| attr.path.is_ident(attribute_name))
{
if let Ok(meta) = attr.parse_meta() {
if let Meta::List(list) = meta {
values.extend(list.nested.iter().map(|n| {
let mut tokens = TokenStream::new();
n.to_tokens(&mut tokens);
tokens
}));
}
if let Ok(Meta::List(list)) = attr.parse_meta() {
values.extend(list.nested.iter().map(|n| {
let mut tokens = TokenStream::new();
n.to_tokens(&mut tokens);
tokens
}));
}
}

Expand Down
1 change: 1 addition & 0 deletions rollup-interface/src/node/services/da.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub trait DaService {
/// For example, this method might return all of the blob transactions in rollup's namespace on Celestia,
/// together with a range proof against the root of the namespaced-merkle-tree, demonstrating that the entire
/// rollup namespace has been covered.
#[allow(clippy::type_complexity)]
fn extract_relevant_txs_with_proof(
&self,
block: Self::FilteredBlock,
Expand Down

0 comments on commit 00cd9aa

Please sign in to comment.