Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cool-teeth-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@codama/renderers-rust': patch
---

resolve io_other_error and uninlined_format_args warnings
11 changes: 5 additions & 6 deletions e2e/anchor/src/generated/accounts/guard_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,13 @@ pub fn fetch_all_guard_v1(
) -> Result<Vec<crate::shared::DecodedAccount<GuardV1>>, 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<crate::shared::DecodedAccount<GuardV1>> = 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,
Expand All @@ -101,7 +100,7 @@ pub fn fetch_all_maybe_guard_v1(
) -> Result<Vec<crate::shared::MaybeAccount<GuardV1>>, 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<crate::shared::MaybeAccount<GuardV1>> = Vec::new();
for i in 0..addresses.len() {
let address = addresses[i];
Expand Down
11 changes: 5 additions & 6 deletions e2e/system/src/generated/accounts/nonce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,13 @@ pub fn fetch_all_nonce(
) -> Result<Vec<crate::shared::DecodedAccount<Nonce>>, 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<crate::shared::DecodedAccount<Nonce>> = 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,
Expand All @@ -98,7 +97,7 @@ pub fn fetch_all_maybe_nonce(
) -> Result<Vec<crate::shared::MaybeAccount<Nonce>>, 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<crate::shared::MaybeAccount<Nonce>> = Vec::new();
for i in 0..addresses.len() {
let address = addresses[i];
Expand Down
6 changes: 3 additions & 3 deletions public/templates/accountsPage.njk
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ pub fn fetch_all_{{ account.name | snakeCase }}(
addresses: &[solana_pubkey::Pubkey],
) -> Result<Vec<crate::shared::DecodedAccount<{{ account.name | pascalCase }}>>, 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<crate::shared::DecodedAccount<{{ account.name | pascalCase }}>> = 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 });
}
Expand All @@ -172,7 +172,7 @@ pub fn fetch_all_maybe_{{ account.name | snakeCase }}(
addresses: &[solana_pubkey::Pubkey],
) -> Result<Vec<crate::shared::MaybeAccount<{{ account.name | pascalCase }}>>, 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<crate::shared::MaybeAccount<{{ account.name | pascalCase }}>> = Vec::new();
for i in 0..addresses.len() {
let address = addresses[i];
Expand Down