Skip to content

Commit

Permalink
Clean up other modules
Browse files Browse the repository at this point in the history
  • Loading branch information
saethlin committed Jan 21, 2024
1 parent 2a86d79 commit b3adb6e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 22 deletions.
13 changes: 12 additions & 1 deletion src/backtrace/libunwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,20 @@
//!
//! This is the default unwinding API for all non-Windows platforms currently.
use super::super::Bomb;
use core::ffi::c_void;

struct Bomb {
enabled: bool,
}

impl Drop for Bomb {
fn drop(&mut self) {
if self.enabled {
panic!("cannot panic during the backtrace function");
}
}
}

pub enum Frame {
Raw(*mut uw::_Unwind_Context),
Cloned {
Expand Down
2 changes: 1 addition & 1 deletion src/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub struct BacktraceFrame {
#[derive(Clone)]
enum Frame {
Raw(crate::Frame),
#[allow(dead_code)]
#[cfg_attr(not(feature = "serialize-rustc"), allow(dead_code))]
Deserialized {
ip: usize,
symbol_address: usize,
Expand Down
16 changes: 0 additions & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
// When we're building as part of libstd, silence all warnings since they're
// irrelevant as this crate is developed out-of-tree.
#![cfg_attr(backtrace_in_libstd, allow(warnings))]
#![cfg_attr(not(feature = "std"), allow(dead_code))]
// We know this is deprecated, it's only here for back-compat reasons.
#![cfg_attr(feature = "rustc-serialize", allow(deprecated))]

Expand Down Expand Up @@ -140,21 +139,6 @@ cfg_if::cfg_if! {
}
}

#[allow(dead_code)]
struct Bomb {
enabled: bool,
}

#[allow(dead_code)]
impl Drop for Bomb {
fn drop(&mut self) {
if self.enabled {
panic!("cannot panic during the backtrace function");
}
}
}

#[allow(dead_code)]
#[cfg(feature = "std")]
mod lock {
use std::boxed::Box;
Expand Down
3 changes: 2 additions & 1 deletion src/symbolize/gimli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ struct Mapping {
}

enum Either<A, B> {
#[allow(dead_code)]
A(A),
B(B),
}
Expand Down Expand Up @@ -319,6 +318,7 @@ fn create_mapping(lib: &Library) -> Option<Mapping> {
}

// unsafe because this is required to be externally synchronized
#[cfg(feature = "std")]
pub unsafe fn clear_symbol_cache() {
Cache::with_global(|cache| cache.mappings.clear());
}
Expand Down Expand Up @@ -522,6 +522,7 @@ impl Symbol<'_> {
}
}

#[cfg(feature = "std")]
pub fn filename(&self) -> Option<&Path> {
match self {
Symbol::Frame { location, .. } => {
Expand Down
4 changes: 1 addition & 3 deletions src/symbolize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ pub enum ResolveWhat<'a> {
}

impl<'a> ResolveWhat<'a> {
#[allow(dead_code)]
fn address_or_ip(&self) -> *mut c_void {
match self {
ResolveWhat::Address(a) => adjust_ip(*a),
Expand Down Expand Up @@ -313,11 +312,10 @@ cfg_if::cfg_if! {

/// A wrapper around a symbol name to provide ergonomic accessors to the
/// demangled name, the raw bytes, the raw string, etc.
// Allow dead code for when the `cpp_demangle` feature is not enabled.
#[allow(dead_code)]
pub struct SymbolName<'a> {
bytes: &'a [u8],
demangled: Option<Demangle<'a>>,
#[cfg_attr(not(feature = "cpp_demangle"), allow(dead_code))]
cpp_demangled: OptionCppSymbol<'a>,
}

Expand Down

0 comments on commit b3adb6e

Please sign in to comment.