@@ -26,7 +26,6 @@ use print::pp::{Breaks, Consistent, Inconsistent, eof};
26
26
use print:: pp;
27
27
28
28
use std:: cast;
29
- use std:: cell:: RefCell ;
30
29
use std:: char;
31
30
use std:: str;
32
31
use std:: io;
@@ -61,7 +60,7 @@ pub struct State<'a> {
61
60
comments : Option < Vec < comments:: Comment > > ,
62
61
literals : Option < Vec < comments:: Literal > > ,
63
62
cur_cmnt_and_lit : CurrentCommentAndLiteral ,
64
- boxes : RefCell < Vec < pp:: Breaks > > ,
63
+ boxes : Vec < pp:: Breaks > ,
65
64
ann : & ' a PpAnn
66
65
}
67
66
@@ -82,7 +81,7 @@ pub fn rust_printer_annotated<'a>(writer: ~io::Writer,
82
81
cur_cmnt : 0 ,
83
82
cur_lit : 0
84
83
} ,
85
- boxes : RefCell :: new ( Vec :: new ( ) ) ,
84
+ boxes : Vec :: new ( ) ,
86
85
ann : ann
87
86
}
88
87
}
@@ -124,7 +123,7 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
124
123
cur_cmnt : 0 ,
125
124
cur_lit : 0
126
125
} ,
127
- boxes : RefCell :: new ( Vec :: new ( ) ) ,
126
+ boxes : Vec :: new ( ) ,
128
127
ann : ann
129
128
} ;
130
129
try!( s. print_mod ( & krate. module , krate. attrs . as_slice ( ) ) ) ;
@@ -238,23 +237,23 @@ pub fn visibility_qualified(vis: ast::Visibility, s: &str) -> ~str {
238
237
239
238
impl < ' a > State < ' a > {
240
239
pub fn ibox ( & mut self , u : uint ) -> IoResult < ( ) > {
241
- self . boxes . borrow_mut ( ) . push ( pp:: Inconsistent ) ;
240
+ self . boxes . push ( pp:: Inconsistent ) ;
242
241
pp:: ibox ( & mut self . s , u)
243
242
}
244
243
245
244
pub fn end ( & mut self ) -> IoResult < ( ) > {
246
- self . boxes . borrow_mut ( ) . pop ( ) . unwrap ( ) ;
245
+ self . boxes . pop ( ) . unwrap ( ) ;
247
246
pp:: end ( & mut self . s )
248
247
}
249
248
250
249
pub fn cbox ( & mut self , u : uint ) -> IoResult < ( ) > {
251
- self . boxes . borrow_mut ( ) . push ( pp:: Consistent ) ;
250
+ self . boxes . push ( pp:: Consistent ) ;
252
251
pp:: cbox ( & mut self . s , u)
253
252
}
254
253
255
254
// "raw box"
256
255
pub fn rbox ( & mut self , u : uint , b : pp:: Breaks ) -> IoResult < ( ) > {
257
- self . boxes . borrow_mut ( ) . push ( b) ;
256
+ self . boxes . push ( b) ;
258
257
pp:: rbox ( & mut self . s , u, b)
259
258
}
260
259
@@ -321,8 +320,8 @@ impl<'a> State<'a> {
321
320
self . s . last_token ( ) . is_eof ( ) || self . s . last_token ( ) . is_hardbreak_tok ( )
322
321
}
323
322
324
- pub fn in_cbox ( & mut self ) -> bool {
325
- match self . boxes . borrow ( ) . last ( ) {
323
+ pub fn in_cbox ( & self ) -> bool {
324
+ match self . boxes . last ( ) {
326
325
Some ( & last_box) => last_box == pp:: Consistent ,
327
326
None => false
328
327
}
0 commit comments