@@ -185,6 +185,7 @@ impl Rewrite for ast::Local {
185
185
// FIXME convert to using rewrite style rather than visitor
186
186
// FIXME format modules in this style
187
187
#[ allow( dead_code) ]
188
+ #[ derive( Debug ) ]
188
189
struct Item < ' a > {
189
190
keyword : & ' static str ,
190
191
abi : Cow < ' static , str > ,
@@ -213,6 +214,7 @@ impl<'a> Item<'a> {
213
214
}
214
215
}
215
216
217
+ #[ derive( Debug ) ]
216
218
enum BodyElement < ' a > {
217
219
// Stmt(&'a ast::Stmt),
218
220
// Field(&'a ast::Field),
@@ -234,26 +236,10 @@ pub(crate) struct FnSig<'a> {
234
236
}
235
237
236
238
impl < ' a > FnSig < ' a > {
237
- pub ( crate ) fn new (
238
- decl : & ' a ast:: FnDecl ,
239
- generics : & ' a ast:: Generics ,
240
- vis : ast:: Visibility ,
241
- ) -> FnSig < ' a > {
242
- FnSig {
243
- decl,
244
- generics,
245
- ext : ast:: Extern :: None ,
246
- is_async : Cow :: Owned ( ast:: Async :: No ) ,
247
- constness : ast:: Const :: No ,
248
- defaultness : ast:: Defaultness :: Final ,
249
- unsafety : ast:: Unsafe :: No ,
250
- visibility : vis,
251
- }
252
- }
253
-
254
239
pub ( crate ) fn from_method_sig (
255
240
method_sig : & ' a ast:: FnSig ,
256
241
generics : & ' a ast:: Generics ,
242
+ visibility : ast:: Visibility ,
257
243
) -> FnSig < ' a > {
258
244
FnSig {
259
245
unsafety : method_sig. header . unsafety ,
@@ -263,7 +249,7 @@ impl<'a> FnSig<'a> {
263
249
ext : method_sig. header . ext ,
264
250
decl : & * method_sig. decl ,
265
251
generics,
266
- visibility : DEFAULT_VISIBILITY ,
252
+ visibility,
267
253
}
268
254
}
269
255
@@ -276,9 +262,8 @@ impl<'a> FnSig<'a> {
276
262
match * fn_kind {
277
263
visit:: FnKind :: Fn ( fn_ctxt, _, fn_sig, vis, _) => match fn_ctxt {
278
264
visit:: FnCtxt :: Assoc ( ..) => {
279
- let mut fn_sig = FnSig :: from_method_sig ( fn_sig, generics) ;
265
+ let mut fn_sig = FnSig :: from_method_sig ( fn_sig, generics, vis . clone ( ) ) ;
280
266
fn_sig. defaultness = defaultness;
281
- fn_sig. visibility = vis. clone ( ) ;
282
267
fn_sig
283
268
}
284
269
_ => FnSig {
@@ -409,7 +394,7 @@ impl<'a> FmtVisitor<'a> {
409
394
& context,
410
395
indent,
411
396
ident,
412
- & FnSig :: from_method_sig ( sig, generics) ,
397
+ & FnSig :: from_method_sig ( sig, generics, DEFAULT_VISIBILITY ) ,
413
398
span,
414
399
FnBraceStyle :: None ,
415
400
) ?;
@@ -3137,7 +3122,7 @@ impl Rewrite for ast::ForeignItem {
3137
3122
context,
3138
3123
shape. indent ,
3139
3124
self . ident ,
3140
- & FnSig :: new ( & fn_sig. decl , generics, self . vis . clone ( ) ) ,
3125
+ & FnSig :: from_method_sig ( & fn_sig, generics, self . vis . clone ( ) ) ,
3141
3126
span,
3142
3127
FnBraceStyle :: None ,
3143
3128
)
0 commit comments