fix compilation errors on release mode due to missing #[cfg(debug_assertions)] with parser event tracing

This commit is contained in:
liquidex 2024-09-01 19:20:09 +02:00
parent 1543534101
commit a30c36c92a

View file

@ -228,6 +228,7 @@ impl Event {
fn new(kind: EventKind) -> Event { fn new(kind: EventKind) -> Event {
Event { Event {
kind, kind,
#[cfg(debug_assertions)]
from: core::panic::Location::caller(), from: core::panic::Location::caller(),
} }
} }
@ -235,14 +236,24 @@ impl Event {
impl fmt::Debug for Event { impl fmt::Debug for Event {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!( #[cfg(debug_assertions)]
f, {
"{:?} @ {}:{}:{}", write!(
self.kind, f,
self.from.file(), "{:?} @ {}:{}:{}",
self.from.line(), self.kind,
self.from.column() self.from.file(),
) self.from.line(),
self.from.column()
)?;
}
#[cfg(not(debug_assertions))]
{
write!(f, "{:?}", self.kind,)?;
}
Ok(())
} }
} }