Re-add deprecated --execution arg on benchmark pallet (#14567)

* Add DeferGuard::new

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Re-add deprecated 'execution' arg to benchmark pallet cmd.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Extend tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove from tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Oliver Tale-Yazdi authored and GitHub committed 2023-07-13 17:41:56 +00:00
1 parent c4e880c155
commit ee0be2bab7
7 files changed
+34 -7

No files matched your search

+7
View File
@@ -25,6 +25,13 @@
#[must_use]
pub struct DeferGuard<F: FnOnce()>(pub Option<F>);
impl<F: FnOnce()> DeferGuard<F> {
/// Creates a new `DeferGuard` with the given closure.
pub fn new(f: F) -> Self {
Self(Some(f))
}
}
impl<F: FnOnce()> Drop for DeferGuard<F> {
fn drop(&mut self) {
self.0.take().map(|f| f());