Skip to content

Commit 0e5464c

Browse files
committed
pretty-print Safety
1 parent c9534a0 commit 0e5464c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

crates/formality-prove/src/decls.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::fmt;
2+
13
use formality_core::{set, Set, Upcast};
24
use formality_macros::term;
35
use formality_types::grammar::{
@@ -141,13 +143,23 @@ pub struct NegImplDeclBoundData {
141143
}
142144

143145
#[term]
146+
#[customize(debug)]
144147
#[derive(Default)]
145148
pub enum Safety {
146149
#[default]
147150
Safe,
148151
Unsafe,
149152
}
150153

154+
impl fmt::Debug for Safety {
155+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
156+
match self {
157+
Safety::Safe => write!(f, "safe"),
158+
Safety::Unsafe => write!(f, "unsafe"),
159+
}
160+
}
161+
}
162+
151163
/// A "trait declaration" declares a trait that exists, its generics, and its where-clauses.
152164
/// It doesn't capture the trait items, which will be transformed into other sorts of rules.
153165
///

0 commit comments

Comments
 (0)