Skip to content

Commit b8ac38e

Browse files
authored
Merge pull request #1208 from botahamec/function-use-declaration-example
Moved the option variant imports
2 parents fd564da + 868850d commit b8ac38e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/items/use-declarations.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ Use declarations support a number of convenient shortcuts:
3535
An example of `use` declarations:
3636

3737
```rust
38-
use std::option::Option::{Some, None};
3938
use std::collections::hash_map::{self, HashMap};
4039

4140
fn foo<T>(_: T){}
4241
fn bar(map1: HashMap<String, usize>, map2: hash_map::HashMap<String, usize>){}
4342

4443
fn main() {
44+
// use declarations can also exist inside of functions
45+
use std::option::Option::{Some, None};
46+
4547
// Equivalent to 'foo(vec![std::option::Option::Some(1.0f64),
4648
// std::option::Option::None]);'
4749
foo(vec![Some(1.0f64), None]);

0 commit comments

Comments
 (0)