提交 bb39c492 编写于 作者: B bors

Auto merge of #33643 - eddyb:rollup, r=eddyb

Rollup of 27 pull requests

- Successful merges: #33342, #33393, #33415, #33475, #33517, #33533, #33534, #33565, #33580, #33584, #33585, #33588, #33590, #33591, #33593, #33598, #33600, #33602, #33603, #33604, #33605, #33607, #33612, #33620, #33633, #33634, #33635
- Failed merges: #33578
......@@ -57,6 +57,7 @@
/*-*-*/
/Makefile
/build
/config.toml
/dist/
/dl/
/doc
......
<footer><p>
Copyright &copy; 2011-2015 The Rust Project Developers. Licensed under the
<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
or the <a href="http://opensource.org/licenses/MIT">MIT license</a>, at your option.
or the <a href="https://opensource.org/licenses/MIT">MIT license</a>, at your option.
</p><p>
This file may not be copied, modified, or distributed except according to those terms.
</p></footer>
......
......@@ -81,7 +81,7 @@
//!
//! ```
//! format!("{argument}", argument = "test"); // => "test"
//! format!("{name} {}", 1, name = 2); // => "2 1"
//! format!("{name} {}", 1, name = 2); // => "2 1"
//! format!("{a} {c} {b}", a="a", b='b', c=3); // => "a 3 b"
//! ```
//!
......@@ -104,8 +104,8 @@
//! octal.
//!
//! There are various parameters which do require a particular type, however.
//! Namely, the `{:.*}` syntax, which sets the number of numbers after the
//! decimal in floating-point types:
//! An example is the `{:.*}` syntax, which sets the number of decimal places
//! in floating-point types:
//!
//! ```
//! let formatted_number = format!("{:.*}", 2, 1.234567);
......@@ -292,15 +292,13 @@
//! use std::fmt;
//! use std::io::{self, Write};
//!
//! fmt::format(format_args!("this returns {}", "String"));
//!
//! let mut some_writer = io::stdout();
//! write!(&mut some_writer, "{}", format_args!("print with a {}", "macro"));
//!
//! fn my_fmt_fn(args: fmt::Arguments) {
//! write!(&mut io::stdout(), "{}", args);
//! }
//! my_fmt_fn(format_args!("or a {} too", "function"));
//! my_fmt_fn(format_args!(", or a {} too", "function"));
//! ```
//!
//! The result of the `format_args!` macro is a value of type `fmt::Arguments`.
......@@ -316,7 +314,7 @@
//! # Syntax
//!
//! The syntax for the formatting language used is drawn from other languages,
//! so it should not be too alien. Arguments are formatted with python-like
//! so it should not be too alien. Arguments are formatted with Python-like
//! syntax, meaning that arguments are surrounded by `{}` instead of the C-like
//! `%`. The actual grammar for the formatting syntax is:
//!
......@@ -527,7 +525,7 @@
/// use std::fmt;
///
/// let s = fmt::format(format_args!("Hello, {}!", "world"));
/// assert_eq!(s, "Hello, world!".to_string());
/// assert_eq!(s, "Hello, world!");
/// ```
///
/// Please note that using [`format!`][format!] might be preferrable.
......@@ -535,7 +533,7 @@
///
/// ```
/// let s = format!("Hello, {}!", "world");
/// assert_eq!(s, "Hello, world!".to_string());
/// assert_eq!(s, "Hello, world!");
/// ```
///
/// [format!]: ../macro.format!.html
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册