parent
b2c3745229
commit
46b30ccd89
1 changed files with 3 additions and 3 deletions
|
@ -385,17 +385,17 @@ error handling. Lets say you want the following,
|
|||
The problem is that `try!` returns a `Result<T, E>` and test functions
|
||||
don't return anything so this will give a mismatched types error.
|
||||
|
||||
```rust
|
||||
```rust,ignore
|
||||
/// A doc test using try!
|
||||
///
|
||||
/// ```
|
||||
/// use std::io;
|
||||
/// # fn f() -> io::Result<()> {
|
||||
/// # fn foo() -> io::Result<()> {
|
||||
/// let mut input = String::new();
|
||||
/// try!(io::stdin().read_line(&mut input));
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// # f();
|
||||
/// # foo();
|
||||
/// ```
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue