@@ -180,12 +180,12 @@ pub fn path_to_str(&&p: @ast::path, intr: @ident_interner) -> ~str {
180
180
to_str ( p, |a, b| print_path ( a, b, false ) , intr)
181
181
}
182
182
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 ,
184
184
opt_self_ty : Option < ast:: self_ty_ > ,
185
185
generics : & ast:: Generics , intr : @ident_interner ) -> ~str {
186
186
do io:: with_str_writer |wr| {
187
187
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) ;
189
189
end ( s) ; // Close the head box
190
190
end ( s) ; // Close the outer box
191
191
eof ( s. s ) ;
@@ -441,7 +441,7 @@ pub fn print_foreign_item(s: @ps, item: @ast::foreign_item) {
441
441
print_outer_attributes(s, item.attrs);
442
442
match item.node {
443
443
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,
445
445
ast::inherited);
446
446
end(s); // end head-ibox
447
447
word(s.s, ~" ; ");
@@ -484,7 +484,7 @@ pub fn print_item(s: @ps, &&item: @ast::item) {
484
484
print_fn(
485
485
s,
486
486
decl,
487
- Some( purity) ,
487
+ purity,
488
488
item.ident,
489
489
typarams,
490
490
None,
@@ -815,7 +815,7 @@ pub fn print_method(s: @ps, meth: @ast::method) {
815
815
hardbreak_if_not_bol(s);
816
816
maybe_print_comment(s, meth.span.lo);
817
817
print_outer_attributes(s, meth.attrs);
818
- print_fn(s, &meth.decl, Some( meth.purity) ,
818
+ print_fn(s, &meth.decl, meth.purity,
819
819
meth.ident, &meth.generics, Some(meth.self_ty.node),
820
820
meth.vis);
821
821
word(s.s, ~" ");
@@ -1663,7 +1663,7 @@ pub fn print_self_ty(s: @ps, self_ty: ast::self_ty_) -> bool {
1663
1663
1664
1664
pub fn print_fn(s: @ps,
1665
1665
decl: &ast::fn_decl,
1666
- purity: Option< ast::purity> ,
1666
+ purity: ast::purity,
1667
1667
name: ast::ident,
1668
1668
generics: &ast::Generics,
1669
1669
opt_self_ty: Option<ast::self_ty_>,
@@ -2158,16 +2158,6 @@ pub fn next_comment(s: @ps) -> Option<comments::cmnt> {
2158
2158
}
2159
2159
}
2160
2160
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
-
2171
2161
pub fn print_opt_abi( s: @ps, opt_abi: Option <ast:: Abi >) {
2172
2162
match opt_abi {
2173
2163
Some ( ast:: RustAbi ) => { word_nbsp( s, ~"extern "); }
@@ -2186,12 +2176,12 @@ pub fn print_opt_sigil(s: @ps, opt_sigil: Option<ast::Sigil>) {
2186
2176
2187
2177
pub fn print_fn_header_info( s: @ps,
2188
2178
opt_sty: Option <ast:: self_ty_>,
2189
- opt_purity : Option < ast:: purity> ,
2179
+ purity : ast:: purity,
2190
2180
onceness: ast:: Onceness ,
2191
2181
opt_sigil: Option <ast:: Sigil >,
2192
2182
vis: ast:: visibility) {
2193
2183
word ( s. s , visibility_qualified ( vis, ~"") ) ;
2194
- print_opt_purity ( s, opt_purity ) ;
2184
+ print_purity ( s, purity ) ;
2195
2185
print_onceness ( s, onceness) ;
2196
2186
word ( s. s , ~"fn ") ;
2197
2187
print_opt_sigil ( s, opt_sigil) ;
@@ -2264,8 +2254,9 @@ pub mod test {
2264
2254
cf : ast:: return_val
2265
2255
} ;
2266
2256
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( ) ");
2269
2260
}
2270
2261
2271
2262
#[test]
0 commit comments