Skip to content

Commit 7fbbfe6

Browse files
committed
auto merge of #17366 : ohazi/rust/master, r=steveklabnik
See: http://doc.rust-lang.org/std/from_str/trait.FromStr.html ``` let input_num = from_str::<Option<uint>>("5"); ``` ``` <anon>:2:21: 2:45 error: failed to find an implementation of trait std::from_str::FromStr for core::option::Option<uint> <anon>:2 let input_num = from_str::<Option<uint>>("5"); ^~~~~~~~~~~~~~~~~~~~~~~~ ```
2 parents 3217859 + c942df9 commit 7fbbfe6

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/doc/guide.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,14 +2151,10 @@ In this case, we say `x` is a `uint` explicitly, so Rust is able to properly
21512151
tell `random()` what to generate. In a similar fashion, both of these work:
21522152

21532153
```{rust,ignore}
2154-
let input_num = from_str::<Option<uint>>("5");
2154+
let input_num = from_str::<uint>("5");
21552155
let input_num: Option<uint> = from_str("5");
21562156
```
21572157

2158-
In this case, I happen to prefer the latter, and in the `random()` case, I prefer
2159-
the former. I think the nested `<>`s make the first option especially ugly and
2160-
a bit harder to read.
2161-
21622158
Anyway, with us now converting our input to a number, our code looks like this:
21632159

21642160
```{rust,ignore}

0 commit comments

Comments
 (0)