Skip to content

Commit de2ba81

Browse files
authored
Merge pull request #1357 from rossmacarthur/fix/no-need-to-mention-try
Remove mention of `try!` in `Display` example
2 parents 2e92719 + e515dc4 commit de2ba81

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/hello/print/print_display/testcase_list.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ Using `?` on `write!` looks like this:
1313
write!(f, "{}", value)?;
1414
```
1515

16-
Alternatively, you can also use the `try!` macro, which works the same way.
17-
This is a bit more verbose and no longer recommended, but you may still see it in
18-
older Rust code. Using `try!` looks like this:
19-
20-
```rust,ignore
21-
try!(write!(f, "{}", value));
22-
```
23-
2416
With `?` available, implementing `fmt::Display` for a `Vec` is
2517
straightforward:
2618

@@ -42,7 +34,7 @@ impl fmt::Display for List {
4234
// count in `count`.
4335
for (count, v) in vec.iter().enumerate() {
4436
// For every element except the first, add a comma.
45-
// Use the ? operator, or try!, to return on errors.
37+
// Use the ? operator to return on errors.
4638
if count != 0 { write!(f, ", ")?; }
4739
write!(f, "{}", v)?;
4840
}

0 commit comments

Comments
 (0)