@@ -70,21 +70,11 @@ pub trait FormatWriter {
70
70
/// This function will return an instance of `FormatError` on error.
71
71
fn write ( & mut self , bytes : & [ u8 ] ) -> Result ;
72
72
73
- // NOTE(stage0): Remove cfg after a snapshot
74
- #[ cfg( not( stage0) ) ]
75
73
/// Glue for usage of the `write!` macro with implementers of this trait.
76
74
///
77
75
/// This method should generally not be invoked manually, but rather through
78
76
/// the `write!` macro itself.
79
77
fn write_fmt ( & mut self , args : Arguments ) -> Result { write ( self , args) }
80
-
81
- // NOTE(stage0): Remove method after a snapshot
82
- #[ cfg( stage0) ]
83
- /// Glue for usage of the `write!` macro with implementers of this trait.
84
- ///
85
- /// This method should generally not be invoked manually, but rather through
86
- /// the `write!` macro itself.
87
- fn write_fmt ( & mut self , args : & Arguments ) -> Result { write ( self , args) }
88
78
}
89
79
90
80
/// A struct to represent both where to emit formatting strings to and how they
@@ -204,17 +194,9 @@ pub struct Arguments<'a> {
204
194
}
205
195
206
196
impl < ' a > Show for Arguments < ' a > {
207
- // NOTE(stage0): Remove cfg after a snapshot
208
- #[ cfg( not( stage0) ) ]
209
197
fn fmt ( & self , fmt : & mut Formatter ) -> Result {
210
198
write ( fmt. buf , * self )
211
199
}
212
-
213
- // NOTE(stage0): Remove method after a snapshot
214
- #[ cfg( stage0) ]
215
- fn fmt ( & self , fmt : & mut Formatter ) -> Result {
216
- write ( fmt. buf , self )
217
- }
218
200
}
219
201
220
202
/// When a format is not otherwise specified, types are formatted by ascribing
@@ -287,8 +269,6 @@ static DEFAULT_ARGUMENT: rt::Argument<'static> = rt::Argument {
287
269
}
288
270
} ;
289
271
290
- // NOTE(stage0): Remove cfg after a snapshot
291
- #[ cfg( not( stage0) ) ]
292
272
/// The `write` function takes an output stream, a precompiled format string,
293
273
/// and a list of arguments. The arguments will be formatted according to the
294
274
/// specified format string into the output stream provided.
@@ -342,61 +322,6 @@ pub fn write(output: &mut FormatWriter, args: Arguments) -> Result {
342
322
Ok ( ( ) )
343
323
}
344
324
345
- // NOTE(stage0): Remove function after a snapshot
346
- #[ cfg( stage0) ]
347
- /// The `write` function takes an output stream, a precompiled format string,
348
- /// and a list of arguments. The arguments will be formatted according to the
349
- /// specified format string into the output stream provided.
350
- ///
351
- /// # Arguments
352
- ///
353
- /// * output - the buffer to write output to
354
- /// * args - the precompiled arguments generated by `format_args!`
355
- #[ experimental = "libcore and I/O have yet to be reconciled, and this is an \
356
- implementation detail which should not otherwise be exported"]
357
- pub fn write ( output : & mut FormatWriter , args : & Arguments ) -> Result {
358
- let mut formatter = Formatter {
359
- flags : 0 ,
360
- width : None ,
361
- precision : None ,
362
- buf : output,
363
- align : rt:: AlignUnknown ,
364
- fill : ' ' ,
365
- args : args. args ,
366
- curarg : args. args . iter ( ) ,
367
- } ;
368
-
369
- let mut pieces = args. pieces . iter ( ) ;
370
-
371
- match args. fmt {
372
- None => {
373
- // We can use default formatting parameters for all arguments.
374
- for _ in range ( 0 , args. args . len ( ) ) {
375
- try!( formatter. buf . write ( pieces. next ( ) . unwrap ( ) . as_bytes ( ) ) ) ;
376
- try!( formatter. run ( & DEFAULT_ARGUMENT ) ) ;
377
- }
378
- }
379
- Some ( fmt) => {
380
- // Every spec has a corresponding argument that is preceded by
381
- // a string piece.
382
- for ( arg, piece) in fmt. iter ( ) . zip ( pieces. by_ref ( ) ) {
383
- try!( formatter. buf . write ( piece. as_bytes ( ) ) ) ;
384
- try!( formatter. run ( arg) ) ;
385
- }
386
- }
387
- }
388
-
389
- // There can be only one trailing string piece left.
390
- match pieces. next ( ) {
391
- Some ( piece) => {
392
- try!( formatter. buf . write ( piece. as_bytes ( ) ) ) ;
393
- }
394
- None => { }
395
- }
396
-
397
- Ok ( ( ) )
398
- }
399
-
400
325
impl < ' a > Formatter < ' a > {
401
326
402
327
// First up is the collection of functions used to execute a format string
@@ -603,22 +528,12 @@ impl<'a> Formatter<'a> {
603
528
self . buf . write ( data)
604
529
}
605
530
606
- // NOTE(stage0): Remove cfg after a snapshot
607
- #[ cfg( not( stage0) ) ]
608
531
/// Writes some formatted information into this instance
609
532
#[ unstable = "reconciling core and I/O may alter this definition" ]
610
533
pub fn write_fmt ( & mut self , fmt : Arguments ) -> Result {
611
534
write ( self . buf , fmt)
612
535
}
613
536
614
- // NOTE(stage0): Remove method after a snapshot
615
- #[ cfg( stage0) ]
616
- /// Writes some formatted information into this instance
617
- #[ unstable = "reconciling core and I/O may alter this definition" ]
618
- pub fn write_fmt ( & mut self , fmt : & Arguments ) -> Result {
619
- write ( self . buf , fmt)
620
- }
621
-
622
537
/// Flags for formatting (packed version of rt::Flag)
623
538
#[ experimental = "return type may change and method was just created" ]
624
539
pub fn flags ( & self ) -> uint { self . flags }
0 commit comments