Skip to content

Commit

Permalink
replace some allow dead_code with feature == "serde"
Browse files Browse the repository at this point in the history
  • Loading branch information
klensy committed May 6, 2024
1 parent 0968bea commit 58d4b13
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/capture.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#[cfg(feature = "serde")]
use crate::resolve;
use crate::PrintFmt;
use crate::{resolve, resolve_frame, trace, BacktraceFmt, Symbol, SymbolName};
use crate::{resolve_frame, trace, BacktraceFmt, Symbol, SymbolName};
use std::ffi::c_void;
use std::fmt;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -50,7 +52,7 @@ pub struct BacktraceFrame {
#[derive(Clone)]
enum Frame {
Raw(crate::Frame),
#[allow(dead_code)]
#[cfg(feature = "serde")]
Deserialized {
ip: usize,
symbol_address: usize,
Expand All @@ -62,20 +64,23 @@ impl Frame {
fn ip(&self) -> *mut c_void {
match *self {
Frame::Raw(ref f) => f.ip(),
#[cfg(feature = "serde")]
Frame::Deserialized { ip, .. } => ip as *mut c_void,
}
}

fn symbol_address(&self) -> *mut c_void {
match *self {
Frame::Raw(ref f) => f.symbol_address(),
#[cfg(feature = "serde")]
Frame::Deserialized { symbol_address, .. } => symbol_address as *mut c_void,
}
}

fn module_base_address(&self) -> Option<*mut c_void> {
match *self {
Frame::Raw(ref f) => f.module_base_address(),
#[cfg(feature = "serde")]
Frame::Deserialized {
module_base_address,
..
Expand All @@ -97,6 +102,7 @@ impl Frame {
};
match *self {
Frame::Raw(ref f) => resolve_frame(f, sym),
#[cfg(feature = "serde")]
Frame::Deserialized { ip, .. } => {
resolve(ip as *mut c_void, sym);
}
Expand Down

0 comments on commit 58d4b13

Please sign in to comment.