diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-12-29 19:40:57 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-12-30 15:04:43 -0800 |
| commit | 262c1efe6352a3e4dba4d8aebc4d9bd96849cd71 (patch) | |
| tree | 4096f26993c2db2e0c95181170ef63f46cf3cb7e /src/libcore/fmt | |
| parent | 023dfb0c898d851dee6ace2f8339b73b5287136b (diff) | |
| download | rust-262c1efe6352a3e4dba4d8aebc4d9bd96849cd71.tar.gz rust-262c1efe6352a3e4dba4d8aebc4d9bd96849cd71.zip | |
Register new snapshots
Diffstat (limited to 'src/libcore/fmt')
| -rw-r--r-- | src/libcore/fmt/float.rs | 9 | ||||
| -rw-r--r-- | src/libcore/fmt/mod.rs | 85 |
2 files changed, 0 insertions, 94 deletions
diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 329fe7c7b49..3787ae33fda 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -325,18 +325,9 @@ pub fn float_to_str_bytes_common<T: Float, U, F>( let mut filler = Filler { buf: &mut buf, end: &mut end }; match sign { - // NOTE(stage0): Remove cfg after a snapshot - #[cfg(not(stage0))] SignNeg => { let _ = fmt::write(&mut filler, format_args!("{:-}", exp)); } - // NOTE(stage0): Remove match arm after a snapshot - #[cfg(stage0)] - SignNeg => { - let _ = format_args!(|args| { - fmt::write(&mut filler, args) - }, "{:-}", exp); - } } } } diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index b050b98de2f..9d275c9da9c 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -70,21 +70,11 @@ pub trait FormatWriter { /// This function will return an instance of `FormatError` on error. fn write(&mut self, bytes: &[u8]) -> Result; - // NOTE(stage0): Remove cfg after a snapshot - #[cfg(not(stage0))] /// Glue for usage of the `write!` macro with implementers of this trait. /// /// This method should generally not be invoked manually, but rather through /// the `write!` macro itself. fn write_fmt(&mut self, args: Arguments) -> Result { write(self, args) } - - // NOTE(stage0): Remove method after a snapshot - #[cfg(stage0)] - /// Glue for usage of the `write!` macro with implementers of this trait. - /// - /// This method should generally not be invoked manually, but rather through - /// the `write!` macro itself. - fn write_fmt(&mut self, args: &Arguments) -> Result { write(self, args) } } /// A struct to represent both where to emit formatting strings to and how they @@ -204,17 +194,9 @@ pub struct Arguments<'a> { } impl<'a> Show for Arguments<'a> { - // NOTE(stage0): Remove cfg after a snapshot - #[cfg(not(stage0))] fn fmt(&self, fmt: &mut Formatter) -> Result { write(fmt.buf, *self) } - - // NOTE(stage0): Remove method after a snapshot - #[cfg(stage0)] - fn fmt(&self, fmt: &mut Formatter) -> Result { - write(fmt.buf, self) - } } /// When a format is not otherwise specified, types are formatted by ascribing @@ -287,8 +269,6 @@ static DEFAULT_ARGUMENT: rt::Argument<'static> = rt::Argument { } }; -// NOTE(stage0): Remove cfg after a snapshot -#[cfg(not(stage0))] /// The `write` function takes an output stream, a precompiled format string, /// and a list of arguments. The arguments will be formatted according to the /// specified format string into the output stream provided. @@ -342,61 +322,6 @@ pub fn write(output: &mut FormatWriter, args: Arguments) -> Result { Ok(()) } -// NOTE(stage0): Remove function after a snapshot -#[cfg(stage0)] -/// The `write` function takes an output stream, a precompiled format string, -/// and a list of arguments. The arguments will be formatted according to the -/// specified format string into the output stream provided. -/// -/// # Arguments -/// -/// * output - the buffer to write output to -/// * args - the precompiled arguments generated by `format_args!` -#[experimental = "libcore and I/O have yet to be reconciled, and this is an \ - implementation detail which should not otherwise be exported"] -pub fn write(output: &mut FormatWriter, args: &Arguments) -> Result { - let mut formatter = Formatter { - flags: 0, - width: None, - precision: None, - buf: output, - align: rt::AlignUnknown, - fill: ' ', - args: args.args, - curarg: args.args.iter(), - }; - - let mut pieces = args.pieces.iter(); - - match args.fmt { - None => { - // We can use default formatting parameters for all arguments. - for _ in range(0, args.args.len()) { - try!(formatter.buf.write(pieces.next().unwrap().as_bytes())); - try!(formatter.run(&DEFAULT_ARGUMENT)); - } - } - Some(fmt) => { - // Every spec has a corresponding argument that is preceded by - // a string piece. - for (arg, piece) in fmt.iter().zip(pieces.by_ref()) { - try!(formatter.buf.write(piece.as_bytes())); - try!(formatter.run(arg)); - } - } - } - - // There can be only one trailing string piece left. - match pieces.next() { - Some(piece) => { - try!(formatter.buf.write(piece.as_bytes())); - } - None => {} - } - - Ok(()) -} - impl<'a> Formatter<'a> { // First up is the collection of functions used to execute a format string @@ -603,22 +528,12 @@ impl<'a> Formatter<'a> { self.buf.write(data) } - // NOTE(stage0): Remove cfg after a snapshot - #[cfg(not(stage0))] /// Writes some formatted information into this instance #[unstable = "reconciling core and I/O may alter this definition"] pub fn write_fmt(&mut self, fmt: Arguments) -> Result { write(self.buf, fmt) } - // NOTE(stage0): Remove method after a snapshot - #[cfg(stage0)] - /// Writes some formatted information into this instance - #[unstable = "reconciling core and I/O may alter this definition"] - pub fn write_fmt(&mut self, fmt: &Arguments) -> Result { - write(self.buf, fmt) - } - /// Flags for formatting (packed version of rt::Flag) #[experimental = "return type may change and method was just created"] pub fn flags(&self) -> uint { self.flags } |
