diff --git a/.changeset/cool-teeth-doubt.md b/.changeset/cool-teeth-doubt.md new file mode 100644 index 0000000..cb337a8 --- /dev/null +++ b/.changeset/cool-teeth-doubt.md @@ -0,0 +1,5 @@ +--- +'@codama/renderers-rust': patch +--- + +resolve io_other_error and uninlined_format_args warnings diff --git a/e2e/anchor/src/generated/accounts/guard_v1.rs b/e2e/anchor/src/generated/accounts/guard_v1.rs index a26a2b6..56d2479 100644 --- a/e2e/anchor/src/generated/accounts/guard_v1.rs +++ b/e2e/anchor/src/generated/accounts/guard_v1.rs @@ -67,14 +67,13 @@ pub fn fetch_all_guard_v1( ) -> Result>, std::io::Error> { let accounts = rpc .get_multiple_accounts(addresses) - .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + .map_err(|e| std::io::Error::other(e.to_string()))?; let mut decoded_accounts: Vec> = Vec::new(); for i in 0..addresses.len() { let address = addresses[i]; - let account = accounts[i].as_ref().ok_or(std::io::Error::new( - std::io::ErrorKind::Other, - format!("Account not found: {}", address), - ))?; + let account = accounts[i].as_ref().ok_or(std::io::Error::other(format!( + "Account not found: {address}" + )))?; let data = GuardV1::from_bytes(&account.data)?; decoded_accounts.push(crate::shared::DecodedAccount { address, @@ -101,7 +100,7 @@ pub fn fetch_all_maybe_guard_v1( ) -> Result>, std::io::Error> { let accounts = rpc .get_multiple_accounts(addresses) - .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + .map_err(|e| std::io::Error::other(e.to_string()))?; let mut decoded_accounts: Vec> = Vec::new(); for i in 0..addresses.len() { let address = addresses[i]; diff --git a/e2e/system/src/generated/accounts/nonce.rs b/e2e/system/src/generated/accounts/nonce.rs index 48b96d1..bf7de61 100644 --- a/e2e/system/src/generated/accounts/nonce.rs +++ b/e2e/system/src/generated/accounts/nonce.rs @@ -64,14 +64,13 @@ pub fn fetch_all_nonce( ) -> Result>, std::io::Error> { let accounts = rpc .get_multiple_accounts(addresses) - .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + .map_err(|e| std::io::Error::other(e.to_string()))?; let mut decoded_accounts: Vec> = Vec::new(); for i in 0..addresses.len() { let address = addresses[i]; - let account = accounts[i].as_ref().ok_or(std::io::Error::new( - std::io::ErrorKind::Other, - format!("Account not found: {}", address), - ))?; + let account = accounts[i].as_ref().ok_or(std::io::Error::other(format!( + "Account not found: {address}" + )))?; let data = Nonce::from_bytes(&account.data)?; decoded_accounts.push(crate::shared::DecodedAccount { address, @@ -98,7 +97,7 @@ pub fn fetch_all_maybe_nonce( ) -> Result>, std::io::Error> { let accounts = rpc .get_multiple_accounts(addresses) - .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + .map_err(|e| std::io::Error::other(e.to_string()))?; let mut decoded_accounts: Vec> = Vec::new(); for i in 0..addresses.len() { let address = addresses[i]; diff --git a/public/templates/accountsPage.njk b/public/templates/accountsPage.njk index ec61569..7df99be 100644 --- a/public/templates/accountsPage.njk +++ b/public/templates/accountsPage.njk @@ -145,12 +145,12 @@ pub fn fetch_all_{{ account.name | snakeCase }}( addresses: &[solana_pubkey::Pubkey], ) -> Result>, std::io::Error> { let accounts = rpc.get_multiple_accounts(addresses) - .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + .map_err(|e| std::io::Error::other(e.to_string()))?; let mut decoded_accounts: Vec> = Vec::new(); for i in 0..addresses.len() { let address = addresses[i]; let account = accounts[i].as_ref() - .ok_or(std::io::Error::new(std::io::ErrorKind::Other, format!("Account not found: {}", address)))?; + .ok_or(std::io::Error::other(format!("Account not found: {address}")))?; let data = {{ account.name | pascalCase }}::from_bytes(&account.data)?; decoded_accounts.push(crate::shared::DecodedAccount { address, account: account.clone(), data }); } @@ -172,7 +172,7 @@ pub fn fetch_all_maybe_{{ account.name | snakeCase }}( addresses: &[solana_pubkey::Pubkey], ) -> Result>, std::io::Error> { let accounts = rpc.get_multiple_accounts(addresses) - .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))?; + .map_err(|e| std::io::Error::other(e.to_string()))?; let mut decoded_accounts: Vec> = Vec::new(); for i in 0..addresses.len() { let address = addresses[i];