Skip to content

Commit

Permalink
Make enum print::PrintFmt non-exhaustive (#651)
Browse files Browse the repository at this point in the history
Per workingjubilee's [comment](#649 (comment))
  • Loading branch information
nyurik committed Aug 24, 2024
1 parent 59cf05f commit 95c3bac
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ pub struct BacktraceFmt<'a, 'b> {

/// The styles of printing that we can print
#[derive(Copy, Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum PrintFmt {
/// Prints a terser backtrace which ideally only contains relevant information
Short,
/// Prints a backtrace that contains all possible information
Full,
#[doc(hidden)]
__Nonexhaustive,
}

impl<'a, 'b> BacktraceFmt<'a, 'b> {
Expand Down Expand Up @@ -254,7 +253,7 @@ impl BacktraceFrameFmt<'_, '_, '_> {
match (symbol_name, &self.fmt.format) {
(Some(name), PrintFmt::Short) => write!(self.fmt.fmt, "{name:#}")?,
(Some(name), PrintFmt::Full) => write!(self.fmt.fmt, "{name}")?,
(None, _) | (_, PrintFmt::__Nonexhaustive) => write!(self.fmt.fmt, "<unknown>")?,
(None, _) => write!(self.fmt.fmt, "<unknown>")?,
}
self.fmt.fmt.write_str("\n")?;

Expand Down

0 comments on commit 95c3bac

Please sign in to comment.