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