Skip to content

Commit 030b97d

Browse files
authored
chore(cheatocodes): remove as_debug (#11395)
Upcasting was stabilized since then, so we can just add it as a super trait.
1 parent a966fba commit 030b97d

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

crates/cheatcodes/src/inspector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2400,7 +2400,7 @@ fn apply_dispatch(
24002400
let cheat = calls_as_dyn_cheatcode(calls);
24012401

24022402
let _guard = debug_span!(target: "cheatcodes", "apply", id = %cheat.id()).entered();
2403-
trace!(target: "cheatcodes", cheat = ?cheat.as_debug(), "applying");
2403+
trace!(target: "cheatcodes", ?cheat, "applying");
24042404

24052405
if let spec::Status::Deprecated(replacement) = *cheat.status() {
24062406
ccx.state.deprecated.insert(cheat.signature(), replacement);

crates/cheatcodes/src/lib.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,9 @@ pub(crate) trait Cheatcode: CheatcodeDef + DynCheatcode {
9292
}
9393
}
9494

95-
pub(crate) trait DynCheatcode: 'static {
95+
pub(crate) trait DynCheatcode: 'static + std::fmt::Debug {
9696
fn cheatcode(&self) -> &'static spec::Cheatcode<'static>;
9797

98-
fn as_debug(&self) -> &dyn std::fmt::Debug;
99-
10098
fn dyn_apply(&self, ccx: &mut CheatsCtxt, executor: &mut dyn CheatcodesExecutor) -> Result;
10199
}
102100

@@ -106,11 +104,6 @@ impl<T: Cheatcode> DynCheatcode for T {
106104
Self::CHEATCODE
107105
}
108106

109-
#[inline]
110-
fn as_debug(&self) -> &dyn std::fmt::Debug {
111-
self
112-
}
113-
114107
#[inline]
115108
fn dyn_apply(&self, ccx: &mut CheatsCtxt, executor: &mut dyn CheatcodesExecutor) -> Result {
116109
self.apply_full(ccx, executor)

0 commit comments

Comments
 (0)