@@ -18,6 +18,7 @@ use clean;
1818use html:: render:: { cache_key, current_location_key} ;
1919
2020pub struct VisSpace ( Option < ast:: visibility > ) ;
21+ pub struct PuritySpace ( ast:: purity ) ;
2122pub struct Method < ' self > ( & ' self clean:: SelfTy , & ' self clean:: FnDecl ) ;
2223
2324impl fmt:: Default for clean:: Generics {
@@ -228,11 +229,7 @@ impl fmt::Default for clean::Type {
228229 None => { }
229230 }
230231 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) ,
236233 match decl. onceness {
237234 ast:: Once => "once " ,
238235 ast:: Many => "" ,
@@ -242,11 +239,7 @@ impl fmt::Default for clean::Type {
242239 }
243240 clean:: BareFunction ( ref decl) => {
244241 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) ,
250243 match decl. abi {
251244 ~"" | ~"\" Rust \" " => ~"",
252245 ref s => " " + * s + " " ,
@@ -362,3 +355,13 @@ impl fmt::Default for VisSpace {
362355 }
363356 }
364357}
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