From 029f617737fc128ccaa4d37927e1668c369004ec Mon Sep 17 00:00:00 2001 From: bristinWild Date: Tue, 2 Jun 2026 02:36:51 +0530 Subject: [PATCH] style: fix rustfmt trailing newline and replace unwrap with expect for clippy --- programs/integration_tests/tests/token.rs | 45 +++++++++++++++++++---- programs/token/src/set_authority.rs | 2 +- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/programs/integration_tests/tests/token.rs b/programs/integration_tests/tests/token.rs index 0d91b8a..61ad335 100644 --- a/programs/integration_tests/tests/token.rs +++ b/programs/integration_tests/tests/token.rs @@ -61,7 +61,12 @@ impl Accounts { name: String::from("Gold"), total_supply: 1_000_000_u128, metadata_id: None, - mint_authority: Some(Ids::token_definition().as_ref().try_into().unwrap()), + mint_authority: Some( + Ids::token_definition() + .as_ref() + .try_into() + .expect("AccountId is always 32 bytes"), + ), }), nonce: Nonce(0), } @@ -75,7 +80,12 @@ impl Accounts { name: String::from("Gold"), total_supply: 1_000_000_u128, metadata_id: None, - mint_authority: Some(Ids::token_definition().as_ref().try_into().unwrap()), + mint_authority: Some( + Ids::token_definition() + .as_ref() + .try_into() + .expect("AccountId is always 32 bytes"), + ), }), nonce: Nonce(0), } @@ -418,7 +428,12 @@ fn token_burn() { name: String::from("Gold"), total_supply: 800_000_u128, metadata_id: None, - mint_authority: Some(Ids::token_definition().as_ref().try_into().unwrap()), + mint_authority: Some( + Ids::token_definition() + .as_ref() + .try_into() + .expect("AccountId is always 32 bytes") + ), }), nonce: Nonce(0), } @@ -468,7 +483,12 @@ fn token_mint() { name: String::from("Gold"), total_supply: 1_500_000_u128, metadata_id: None, - mint_authority: Some(Ids::token_definition().as_ref().try_into().unwrap()), + mint_authority: Some( + Ids::token_definition() + .as_ref() + .try_into() + .expect("AccountId is always 32 bytes") + ), }), nonce: Nonce(1), } @@ -590,7 +610,12 @@ fn token_mint_fresh_authorized_public_recipient() { name: String::from("Gold"), total_supply: 1_500_000_u128, metadata_id: None, - mint_authority: Some(Ids::token_definition().as_ref().try_into().unwrap()), + mint_authority: Some( + Ids::token_definition() + .as_ref() + .try_into() + .expect("AccountId is always 32 bytes") + ), }), nonce: Nonce(1), } @@ -926,7 +951,10 @@ fn token_deshielded_transfer() { fn token_new_fungible_definition_with_authority() { let mut state = V03State::new_with_genesis_accounts(&[], vec![], 0); deploy_token(&mut state); - let authority_key: [u8; 32] = Ids::token_definition().as_ref().try_into().unwrap(); + let authority_key: [u8; 32] = Ids::token_definition() + .as_ref() + .try_into() + .expect("AccountId is always 32 bytes"); let instruction = token_core::Instruction::NewFungibleDefinitionWithAuthority { name: String::from("AuthCoin"), initial_supply: 1_000_000_u128, @@ -965,7 +993,10 @@ fn token_new_fungible_definition_with_authority() { fn token_set_authority_revoke() { let mut state = V03State::new_with_genesis_accounts(&[], vec![], 0); deploy_token(&mut state); - let authority_key: [u8; 32] = Ids::token_definition().as_ref().try_into().unwrap(); + let authority_key: [u8; 32] = Ids::token_definition() + .as_ref() + .try_into() + .expect("AccountId is always 32 bytes"); // Create token with authority let instruction = token_core::Instruction::NewFungibleDefinitionWithAuthority { diff --git a/programs/token/src/set_authority.rs b/programs/token/src/set_authority.rs index a4ae7ff..b324a6f 100644 --- a/programs/token/src/set_authority.rs +++ b/programs/token/src/set_authority.rs @@ -43,4 +43,4 @@ pub fn set_authority( definition_post.data = Data::from(&definition); vec![AccountPostState::new(definition_post)] -} \ No newline at end of file +}