@@ -43,8 +43,8 @@ pub enum AnnNode<'a> {
43
43
}
44
44
45
45
pub trait PpAnn {
46
- fn pre ( & self , _state : & mut State < Self > , _node : AnnNode ) -> IoResult < ( ) > { Ok ( ( ) ) }
47
- fn post ( & self , _state : & mut State < Self > , _node : AnnNode ) -> IoResult < ( ) > { Ok ( ( ) ) }
46
+ fn pre ( & self , _state : & mut State , _node : AnnNode ) -> IoResult < ( ) > { Ok ( ( ) ) }
47
+ fn post ( & self , _state : & mut State , _node : AnnNode ) -> IoResult < ( ) > { Ok ( ( ) ) }
48
48
}
49
49
50
50
pub struct NoAnn ;
@@ -56,23 +56,24 @@ pub struct CurrentCommentAndLiteral {
56
56
cur_lit : uint ,
57
57
}
58
58
59
- pub struct State < ' a , A > {
59
+ pub struct State < ' a > {
60
60
s : pp:: Printer ,
61
61
cm : Option < & ' a CodeMap > ,
62
62
intr : @token:: IdentInterner ,
63
63
comments : Option < Vec < comments:: Comment > > ,
64
64
literals : Option < Vec < comments:: Literal > > ,
65
65
cur_cmnt_and_lit : CurrentCommentAndLiteral ,
66
66
boxes : RefCell < Vec < pp:: Breaks > > ,
67
- ann : & ' a A
67
+ ann : & ' a PpAnn
68
68
}
69
69
70
- pub fn rust_printer ( writer : ~io:: Writer ) -> State < ' static , NoAnn > {
70
+ pub fn rust_printer ( writer : ~io:: Writer ) -> State < ' static > {
71
71
static NO_ANN : NoAnn = NoAnn ;
72
72
rust_printer_annotated ( writer, & NO_ANN )
73
73
}
74
74
75
- pub fn rust_printer_annotated < ' a , A : PpAnn > ( writer : ~io:: Writer , ann : & ' a A ) -> State < ' a , A > {
75
+ pub fn rust_printer_annotated < ' a > ( writer : ~io:: Writer ,
76
+ ann : & ' a PpAnn ) -> State < ' a > {
76
77
State {
77
78
s : pp:: mk_printer ( writer, default_columns) ,
78
79
cm : None ,
@@ -95,14 +96,14 @@ pub static default_columns: uint = 78u;
95
96
// Requires you to pass an input filename and reader so that
96
97
// it can scan the input text for comments and literals to
97
98
// copy forward.
98
- pub fn print_crate < ' a , A : PpAnn > ( cm : & ' a CodeMap ,
99
- span_diagnostic : & diagnostic:: SpanHandler ,
100
- krate : & ast:: Crate ,
101
- filename : ~str ,
102
- input : & mut io:: Reader ,
103
- out : ~io:: Writer ,
104
- ann : & ' a A ,
105
- is_expanded : bool ) -> IoResult < ( ) > {
99
+ pub fn print_crate < ' a > ( cm : & ' a CodeMap ,
100
+ span_diagnostic : & diagnostic:: SpanHandler ,
101
+ krate : & ast:: Crate ,
102
+ filename : ~str ,
103
+ input : & mut io:: Reader ,
104
+ out : ~io:: Writer ,
105
+ ann : & ' a PpAnn ,
106
+ is_expanded : bool ) -> IoResult < ( ) > {
106
107
let ( cmnts, lits) = comments:: gather_comments_and_literals (
107
108
span_diagnostic,
108
109
filename,
@@ -133,7 +134,7 @@ pub fn print_crate<'a, A: PpAnn>(cm: &'a CodeMap,
133
134
eof ( & mut s. s )
134
135
}
135
136
136
- pub fn to_str ( f: |& mut State < NoAnn > | -> IoResult < ( ) > ) -> ~str {
137
+ pub fn to_str ( f: |& mut State | -> IoResult < ( ) > ) -> ~str {
137
138
let mut s = rust_printer ( ~MemWriter :: new ( ) ) ;
138
139
f( & mut s) . unwrap ( ) ;
139
140
eof ( & mut s. s ) . unwrap ( ) ;
@@ -237,7 +238,7 @@ pub fn visibility_qualified(vis: ast::Visibility, s: &str) -> ~str {
237
238
}
238
239
}
239
240
240
- impl < ' a , A : PpAnn > State < ' a , A > {
241
+ impl < ' a > State < ' a > {
241
242
pub fn ibox ( & mut self , u : uint ) -> IoResult < ( ) > {
242
243
self . boxes . borrow_mut ( ) . get ( ) . push ( pp:: Inconsistent ) ;
243
244
pp:: ibox ( & mut self . s , u)
@@ -365,7 +366,7 @@ impl<'a, A: PpAnn> State<'a, A> {
365
366
}
366
367
367
368
pub fn commasep < T > ( & mut self , b : Breaks , elts : & [ T ] ,
368
- op : |& mut State < A > , & T | -> IoResult < ( ) > )
369
+ op : |& mut State , & T | -> IoResult < ( ) > )
369
370
-> IoResult < ( ) > {
370
371
try!( self . rbox( 0 u, b) ) ;
371
372
let mut first = true;
@@ -381,7 +382,7 @@ impl<'a, A: PpAnn> State<'a, A> {
381
382
& mut self ,
382
383
b : Breaks ,
383
384
elts : & [ T ] ,
384
- op : |& mut State < A > , & T | -> IoResult < ( ) > ,
385
+ op : |& mut State , & T | -> IoResult < ( ) > ,
385
386
get_span: |& T | -> codemap:: Span ) -> IoResult < ( ) > {
386
387
try!( self . rbox ( 0 u, b) ) ;
387
388
let len = elts. len ( ) ;
0 commit comments