Skip to content

Commit b43f5bb

Browse files
authored
chore(cast): remove unclear pretty arg for print_storage (#11976)
- Remove useless/unclear `pretty` args for `fetch_and_print_storage` && `print_storage` - Directly call `shell::is_json()` and shell::is_markdown() in `print_storage`
1 parent 1c6ade9 commit b43f5bb

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

crates/cast/src/cmd/storage.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,7 @@ impl StorageArgs {
136136
artifact.get_deployed_bytecode_bytes().is_some_and(|b| *b == address_code)
137137
});
138138
if let Some((_, artifact)) = artifact {
139-
return fetch_and_print_storage(
140-
provider,
141-
address,
142-
block,
143-
artifact,
144-
!shell::is_json(),
145-
)
146-
.await;
139+
return fetch_and_print_storage(provider, address, block, artifact).await;
147140
}
148141
}
149142

@@ -224,7 +217,7 @@ impl StorageArgs {
224217
// Clear temp directory
225218
root.close()?;
226219

227-
fetch_and_print_storage(provider, address, block, artifact, !shell::is_json()).await
220+
fetch_and_print_storage(provider, address, block, artifact).await
228221
}
229222
}
230223

@@ -272,15 +265,14 @@ async fn fetch_and_print_storage<P: Provider<AnyNetwork>>(
272265
address: Address,
273266
block: Option<BlockId>,
274267
artifact: &ConfigurableContractArtifact,
275-
pretty: bool,
276268
) -> Result<()> {
277269
if is_storage_layout_empty(&artifact.storage_layout) {
278270
sh_warn!("Storage layout is empty.")?;
279271
Ok(())
280272
} else {
281273
let layout = artifact.storage_layout.as_ref().unwrap().clone();
282274
let values = fetch_storage_slots(provider, address, block, &layout).await?;
283-
print_storage(layout, values, pretty)
275+
print_storage(layout, values)
284276
}
285277
}
286278

@@ -305,8 +297,8 @@ async fn fetch_storage_slots<P: Provider<AnyNetwork>>(
305297
futures::future::try_join_all(requests).await
306298
}
307299

308-
fn print_storage(layout: StorageLayout, values: Vec<StorageValue>, pretty: bool) -> Result<()> {
309-
if !pretty {
300+
fn print_storage(layout: StorageLayout, values: Vec<StorageValue>) -> Result<()> {
301+
if shell::is_json() {
310302
let values: Vec<_> = layout
311303
.storage
312304
.iter()

0 commit comments

Comments
 (0)