Skip to content

Commit 0c63c23

Browse files
committed
---
yaml --- r: 125691 b: refs/heads/try c: 820a558 h: refs/heads/master i: 125689: 699fff2 125687: eba3edb v: v3
1 parent 203499a commit 0c63c23

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: f2fa55903e378368ed9173560f03a0ef16e371c2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9fc8394d3bce22ab483f98842434c84c396212ae
5-
refs/heads/try: 18717fcf6886b803e04bbe21689fd61becab1015
5+
refs/heads/try: 820a55857a132a14f5a69960f7cfbeec39b5360f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libsyntax/ext/format.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@ impl<'a, 'b> Context<'a, 'b> {
216216
}
217217

218218
fn describe_num_args(&self) -> String {
219-
if self.args.len() == 1 {
220-
"there is 1 argument".to_string()
221-
} else {
222-
format!("there are {} arguments", self.args.len())
219+
match self.args.len() {
220+
0 => "no arguments given".to_string(),
221+
1 => "there is 1 argument".to_string(),
222+
x => format!("there are {} arguments", x),
223223
}
224224
}
225225

branches/try/src/test/compile-fail/ifmt-bad-arg.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@ fn main() {
3232
// bad number of arguments, see #15780
3333

3434
format!("{0}");
35-
//^~ ERROR invalid reference to argument `0` (there are 0 arguments)
35+
//~^ ERROR invalid reference to argument `0` (no arguments given)
3636

3737
format!("{0} {1}", 1);
38-
//^~ ERROR invalid reference to argument `1` (there is 1 argument)
38+
//~^ ERROR invalid reference to argument `1` (there is 1 argument)
3939

4040
format!("{0} {1} {2}", 1, 2);
41-
//^~ ERROR invalid reference to argument `2` (there are 2 arguments)
41+
//~^ ERROR invalid reference to argument `2` (there are 2 arguments)
42+
43+
format!("{0} {1}");
44+
//~^ ERROR invalid reference to argument `0` (no arguments given)
45+
//~^^ ERROR invalid reference to argument `1` (no arguments given)
4246

4347
// bad syntax of the format string
4448

0 commit comments

Comments
 (0)