]> git.lizzy.rs Git - rust.git/commit
auto merge of #20136 : eddyb/rust/format-args, r=alexcrichton
authorbors <bors@rust-lang.org>
Sun, 28 Dec 2014 03:11:48 +0000 (03:11 +0000)
committerbors <bors@rust-lang.org>
Sun, 28 Dec 2014 03:11:48 +0000 (03:11 +0000)
commit3e6b29f8ad1ddfcb134d743a66ee5f467e16c350
treedfd36279301f37402264995a2d25a5d21eb38464
parent070ab63807dc80fa6a6c5ee80531284761ab42de
parent647e54d6d154e1a267e84c8ae9f1315e3f9b93fc
auto merge of #20136 : eddyb/rust/format-args, r=alexcrichton

We have the technology: no longer do you need to write closures to use `format_args!`.
This is a `[breaking-change]`, as it forces you to clean up old hacks - if you had code like this:
```rust
format_args!(fmt::format, "{} {} {}", a, b, c)
format_args!(|args| { w.write_fmt(args) }, "{} {} {}", x, y, z)
```
change it to this:
```rust
fmt::format(format_args!("{} {} {}", a, b, c))
w.write_fmt(format_args!("{} {} {}", x, y, z))
```
To allow them to be called with `format_args!(...)` directly, several functions were modified to
take `fmt::Arguments` by value instead of by reference. Also, `fmt::Arguments` derives `Copy`
now in order to preserve all usecases that were previously possible.