@@ -18,6 +18,7 @@ use clean;
18
18
use html:: render:: { cache_key, current_location_key} ;
19
19
20
20
pub struct VisSpace ( Option < ast:: visibility > ) ;
21
+ pub struct PuritySpace ( ast:: purity ) ;
21
22
pub struct Method < ' self > ( & ' self clean:: SelfTy , & ' self clean:: FnDecl ) ;
22
23
23
24
impl fmt:: Default for clean:: Generics {
@@ -228,11 +229,7 @@ impl fmt::Default for clean::Type {
228
229
None => { }
229
230
}
230
231
write ! ( f. buf, "{}{}fn{}" ,
231
- match decl. purity {
232
- ast:: unsafe_fn => "unsafe " ,
233
- ast:: extern_fn => "extern " ,
234
- ast:: impure_fn => ""
235
- } ,
232
+ PuritySpace ( decl. purity) ,
236
233
match decl. onceness {
237
234
ast:: Once => "once " ,
238
235
ast:: Many => "" ,
@@ -242,11 +239,7 @@ impl fmt::Default for clean::Type {
242
239
}
243
240
clean:: BareFunction ( ref decl) => {
244
241
write ! ( f. buf, "{}{}fn{}{}" ,
245
- match decl. purity {
246
- ast:: unsafe_fn => "unsafe " ,
247
- ast:: extern_fn => "extern " ,
248
- ast:: impure_fn => ""
249
- } ,
242
+ PuritySpace ( decl. purity) ,
250
243
match decl. abi {
251
244
~"" | ~"\" Rust \" " => ~"",
252
245
ref s => " " + * s + " " ,
@@ -362,3 +355,13 @@ impl fmt::Default for VisSpace {
362
355
}
363
356
}
364
357
}
358
+
359
+ impl fmt:: Default for PuritySpace {
360
+ fn fmt ( p : & PuritySpace , f : & mut fmt:: Formatter ) {
361
+ match * * p {
362
+ ast:: unsafe_fn => write ! ( f. buf, "unsafe " ) ,
363
+ ast:: extern_fn => write ! ( f. buf, "extern " ) ,
364
+ ast:: impure_fn => { }
365
+ }
366
+ }
367
+ }
0 commit comments