@@ -180,12 +180,12 @@ pub fn path_to_str(&&p: @ast::path, intr: @ident_interner) -> ~str {
180180 to_str ( p, |a, b| print_path ( a, b, false ) , intr)
181181}
182182
183- pub fn fun_to_str ( decl : & ast:: fn_decl , name : ast:: ident ,
183+ pub fn fun_to_str ( decl : & ast:: fn_decl , purity : ast :: purity , name : ast:: ident ,
184184 opt_self_ty : Option < ast:: self_ty_ > ,
185185 generics : & ast:: Generics , intr : @ident_interner ) -> ~str {
186186 do io:: with_str_writer |wr| {
187187 let s = rust_printer ( wr, intr) ;
188- print_fn ( s, decl, None , name, generics, opt_self_ty, ast:: inherited) ;
188+ print_fn ( s, decl, purity , name, generics, opt_self_ty, ast:: inherited) ;
189189 end ( s) ; // Close the head box
190190 end ( s) ; // Close the outer box
191191 eof ( s. s ) ;
@@ -441,7 +441,7 @@ pub fn print_foreign_item(s: @ps, item: @ast::foreign_item) {
441441 print_outer_attributes(s, item.attrs);
442442 match item.node {
443443 ast::foreign_item_fn(ref decl, purity, ref generics) => {
444- print_fn(s, decl, Some( purity) , item.ident, generics, None,
444+ print_fn(s, decl, purity, item.ident, generics, None,
445445 ast::inherited);
446446 end(s); // end head-ibox
447447 word(s.s, ~" ; ");
@@ -484,7 +484,7 @@ pub fn print_item(s: @ps, &&item: @ast::item) {
484484 print_fn(
485485 s,
486486 decl,
487- Some( purity) ,
487+ purity,
488488 item.ident,
489489 typarams,
490490 None,
@@ -815,7 +815,7 @@ pub fn print_method(s: @ps, meth: @ast::method) {
815815 hardbreak_if_not_bol(s);
816816 maybe_print_comment(s, meth.span.lo);
817817 print_outer_attributes(s, meth.attrs);
818- print_fn(s, &meth.decl, Some( meth.purity) ,
818+ print_fn(s, &meth.decl, meth.purity,
819819 meth.ident, &meth.generics, Some(meth.self_ty.node),
820820 meth.vis);
821821 word(s.s, ~" ");
@@ -1663,7 +1663,7 @@ pub fn print_self_ty(s: @ps, self_ty: ast::self_ty_) -> bool {
16631663
16641664pub fn print_fn(s: @ps,
16651665 decl: &ast::fn_decl,
1666- purity: Option< ast::purity> ,
1666+ purity: ast::purity,
16671667 name: ast::ident,
16681668 generics: &ast::Generics,
16691669 opt_self_ty: Option<ast::self_ty_>,
@@ -2158,16 +2158,6 @@ pub fn next_comment(s: @ps) -> Option<comments::cmnt> {
21582158 }
21592159}
21602160
2161- pub fn print_opt_purity( s: @ps, opt_purity: Option <ast:: purity>) {
2162- match opt_purity {
2163- Some ( ast:: impure_fn) => { }
2164- Some ( purity) => {
2165- word_nbsp( s, purity_to_str( purity) ) ;
2166- }
2167- None => { }
2168- }
2169- }
2170-
21712161pub fn print_opt_abi( s: @ps, opt_abi: Option <ast:: Abi >) {
21722162 match opt_abi {
21732163 Some ( ast:: RustAbi ) => { word_nbsp( s, ~"extern "); }
@@ -2186,12 +2176,12 @@ pub fn print_opt_sigil(s: @ps, opt_sigil: Option<ast::Sigil>) {
21862176
21872177pub fn print_fn_header_info( s: @ps,
21882178 opt_sty: Option <ast:: self_ty_>,
2189- opt_purity : Option < ast:: purity> ,
2179+ purity : ast:: purity,
21902180 onceness: ast:: Onceness ,
21912181 opt_sigil: Option <ast:: Sigil >,
21922182 vis: ast:: visibility) {
21932183 word ( s. s , visibility_qualified ( vis, ~"") ) ;
2194- print_opt_purity ( s, opt_purity ) ;
2184+ print_purity ( s, purity ) ;
21952185 print_onceness ( s, onceness) ;
21962186 word ( s. s , ~"fn ") ;
21972187 print_opt_sigil ( s, opt_sigil) ;
@@ -2264,8 +2254,9 @@ pub mod test {
22642254 cf : ast:: return_val
22652255 } ;
22662256 let generics = ast_util:: empty_generics ( ) ;
2267- assert_eq ! ( & fun_to_str( & decl, abba_ident, None , & generics, mock_interner) ,
2268- & ~"fn abba( ) ");
2257+ assert_eq ! ( & fun_to_str( & decl, ast:: impure_fn, abba_ident,
2258+ None , & generics, mock_interner) ,
2259+ & ~"fn abba( ) ");
22692260 }
22702261
22712262 #[test]
0 commit comments