@@ -163,67 +163,65 @@ pub fn parse_pretty(sess: &Session,
163
163
164
164
impl PpSourceMode {
165
165
/// Constructs a `PrinterSupport` object and passes it to `f`.
166
- fn call_with_pp_support < ' tcx , A , B , F > ( & self ,
166
+ fn call_with_pp_support < ' tcx , A , F > ( & self ,
167
167
sess : & ' tcx Session ,
168
168
hir_map : Option < & hir_map:: Map < ' tcx > > ,
169
- payload : B ,
170
169
f : F )
171
170
-> A
172
- where F : FnOnce ( & PrinterSupport , B ) -> A
171
+ where F : FnOnce ( & PrinterSupport ) -> A
173
172
{
174
173
match * self {
175
174
PpmNormal | PpmEveryBodyLoops | PpmExpanded => {
176
175
let annotation = NoAnn {
177
176
sess : sess,
178
177
hir_map : hir_map. map ( |m| m. clone ( ) ) ,
179
178
} ;
180
- f ( & annotation, payload )
179
+ f ( & annotation)
181
180
}
182
181
183
182
PpmIdentified | PpmExpandedIdentified => {
184
183
let annotation = IdentifiedAnnotation {
185
184
sess : sess,
186
185
hir_map : hir_map. map ( |m| m. clone ( ) ) ,
187
186
} ;
188
- f ( & annotation, payload )
187
+ f ( & annotation)
189
188
}
190
189
PpmExpandedHygiene => {
191
190
let annotation = HygieneAnnotation {
192
191
sess : sess,
193
192
} ;
194
- f ( & annotation, payload )
193
+ f ( & annotation)
195
194
}
196
195
_ => panic ! ( "Should use call_with_pp_support_hir" ) ,
197
196
}
198
197
}
199
- fn call_with_pp_support_hir < ' tcx , A , B , F > ( & self ,
198
+ fn call_with_pp_support_hir < ' tcx , A , F > ( & self ,
200
199
sess : & ' tcx Session ,
201
200
hir_map : & hir_map:: Map < ' tcx > ,
202
201
analysis : & ty:: CrateAnalysis ,
203
202
resolutions : & Resolutions ,
204
203
arena : & ' tcx DroplessArena ,
205
204
arenas : & ' tcx GlobalArenas < ' tcx > ,
206
205
id : & str ,
207
- payload : B ,
208
206
f : F )
209
207
-> A
210
- where F : FnOnce ( & HirPrinterSupport , B , & hir:: Crate ) -> A
208
+ where F : FnOnce ( & HirPrinterSupport , & hir:: Crate ) -> A
211
209
{
212
210
match * self {
213
211
PpmNormal => {
214
212
let annotation = NoAnn {
215
213
sess : sess,
216
214
hir_map : Some ( hir_map. clone ( ) ) ,
217
215
} ;
218
- f ( & annotation, payload , hir_map. forest . krate ( ) )
216
+ f ( & annotation, hir_map. forest . krate ( ) )
219
217
}
220
218
221
219
PpmIdentified => {
222
220
let annotation = IdentifiedAnnotation {
223
221
sess : sess,
224
222
hir_map : Some ( hir_map. clone ( ) ) ,
225
223
} ;
226
- f ( & annotation, payload , hir_map. forest . krate ( ) )
224
+ f ( & annotation, hir_map. forest . krate ( ) )
227
225
}
228
226
PpmTyped => {
229
227
abort_on_err ( driver:: phase_3_run_analysis_passes ( sess,
@@ -240,7 +238,7 @@ impl PpSourceMode {
240
238
tables : Cell :: new ( & empty_tables)
241
239
} ;
242
240
let _ignore = tcx. dep_graph . in_ignore ( ) ;
243
- f ( & annotation, payload , hir_map. forest . krate ( ) )
241
+ f ( & annotation, hir_map. forest . krate ( ) )
244
242
} ) ,
245
243
sess)
246
244
}
@@ -825,15 +823,15 @@ pub fn print_after_parsing(sess: &Session,
825
823
if let PpmSource ( s) = ppm {
826
824
// Silently ignores an identified node.
827
825
let out: & mut Write = & mut out;
828
- s. call_with_pp_support ( sess, None , box out , |annotation, out | {
826
+ s. call_with_pp_support ( sess, None , move |annotation| {
829
827
debug ! ( "pretty printing source code {:?}" , s) ;
830
828
let sess = annotation. sess ( ) ;
831
829
pprust:: print_crate ( sess. codemap ( ) ,
832
830
& sess. parse_sess ,
833
831
krate,
834
832
src_name. to_string ( ) ,
835
833
& mut rdr,
836
- out,
834
+ box out,
837
835
annotation. pp_ann ( ) ,
838
836
false )
839
837
} )
@@ -883,15 +881,15 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
883
881
( PpmSource ( s) , _) => {
884
882
// Silently ignores an identified node.
885
883
let out: & mut Write = & mut out;
886
- s. call_with_pp_support ( sess, Some ( hir_map) , box out , |annotation, out | {
884
+ s. call_with_pp_support ( sess, Some ( hir_map) , move |annotation| {
887
885
debug ! ( "pretty printing source code {:?}" , s) ;
888
886
let sess = annotation. sess ( ) ;
889
887
pprust:: print_crate ( sess. codemap ( ) ,
890
888
& sess. parse_sess ,
891
889
krate,
892
890
src_name. to_string ( ) ,
893
891
& mut rdr,
894
- out,
892
+ box out,
895
893
annotation. pp_ann ( ) ,
896
894
true )
897
895
} )
@@ -906,16 +904,15 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
906
904
arena,
907
905
arenas,
908
906
crate_name,
909
- box out,
910
- |annotation, out, krate| {
907
+ move |annotation, krate| {
911
908
debug ! ( "pretty printing source code {:?}" , s) ;
912
909
let sess = annotation. sess ( ) ;
913
910
pprust_hir:: print_crate ( sess. codemap ( ) ,
914
911
& sess. parse_sess ,
915
912
krate,
916
913
src_name. to_string ( ) ,
917
914
& mut rdr,
918
- out,
915
+ box out,
919
916
annotation. pp_ann ( ) ,
920
917
true )
921
918
} )
@@ -930,8 +927,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
930
927
arena,
931
928
arenas,
932
929
crate_name,
933
- ( out, uii) ,
934
- |annotation, ( out, uii) , _| {
930
+ move |annotation, _| {
935
931
debug ! ( "pretty printing source code {:?}" , s) ;
936
932
let sess = annotation. sess ( ) ;
937
933
let hir_map = annotation. hir_map ( ) . expect ( "--unpretty missing HIR map" ) ;
0 commit comments