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