diff --git a/bin/node/bench/src/import.rs b/bin/node/bench/src/import.rs index e49a359fb6af1..ae28a20089e10 100644 --- a/bin/node/bench/src/import.rs +++ b/bin/node/bench/src/import.rs @@ -133,8 +133,10 @@ impl core::Benchmark for ImportBenchmark { let elapsed = start.elapsed(); // Sanity checks. - context.client.state_at(&BlockId::number(1)).expect("state_at failed for block#1") - .inspect_with(|| { + context.client + .state_at(&BlockId::number(1)) + .expect("state_at failed for block#1") + .inspect_state(|| { match self.block_type { BlockType::RandomTransfersKeepAlive => { // should be 5 per signed extrinsic + 1 per unsigned diff --git a/primitives/state-machine/src/read_only.rs b/primitives/state-machine/src/read_only.rs index 99023ec772ec3..1b70958145c70 100644 --- a/primitives/state-machine/src/read_only.rs +++ b/primitives/state-machine/src/read_only.rs @@ -37,11 +37,13 @@ pub trait InspectState> { /// /// Self will be set as read-only externalities and inspection /// closure will be run against it. - fn inspect_with(&self, f: F); + /// + /// Returns the result of the closure. + fn inspect_state R, R>(&self, f: F) -> R; } impl> InspectState for B { - fn inspect_with(&self, f: F) { + fn inspect_state R, R>(&self, f: F) -> R { ReadOnlyExternalities::from(self).execute_with(f) } }