File tree Expand file tree Collapse file tree 5 files changed +9
-9
lines changed Expand file tree Collapse file tree 5 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ enum Work {
19
19
fn main() {
20
20
// Explicitly `use` each name so they are available without
21
21
// manual scoping.
22
- use Status::{Poor, Rich};
22
+ use crate:: Status::{Poor, Rich};
23
23
// Automatically `use` each name inside `Work`.
24
- use Work::*;
24
+ use crate:: Work::*;
25
25
26
26
// Equivalent to `Status::Poor`.
27
27
let status = Poor;
Original file line number Diff line number Diff line change 3
3
A common use for ` enums ` is to create a linked-list:
4
4
5
5
``` rust,editable
6
- use List::*;
6
+ use crate:: List::*;
7
7
8
8
enum List {
9
9
// Cons: Tuple struct that wraps an element and a pointer to the next node
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ mod my {
44
44
// This will bind to the `cool::function` in the *crate* scope.
45
45
// In this case the crate scope is the outermost scope.
46
46
{
47
- use cool::function as root_function;
47
+ use crate:: cool::function as root_function;
48
48
root_function();
49
49
}
50
50
}
@@ -53,4 +53,4 @@ mod my {
53
53
fn main() {
54
54
my::indirect_call();
55
55
}
56
- ```
56
+ ```
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ access. It is often used like this:
6
6
``` rust,editable,ignore
7
7
// extern crate deeply; // normally, this would exist and not be commented out!
8
8
9
- use deeply::nested::{
9
+ use crate:: deeply::nested::{
10
10
my_first_function,
11
11
my_second_function,
12
12
AndATraitType
@@ -43,7 +43,7 @@ fn main() {
43
43
{
44
44
// This is equivalent to `use deeply::nested::function as function`.
45
45
// This `function()` will shadow the outer one.
46
- use deeply::nested::function;
46
+ use crate:: deeply::nested::function;
47
47
function();
48
48
49
49
// `use` bindings have a local scope. In this case, the
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ mod my_mod {
37
37
38
38
// Functions declared using `pub(in path)` syntax are only visible
39
39
// within the given path. `path` must be a parent or ancestor module
40
- pub(in my_mod) fn public_function_in_my_mod() {
40
+ pub(in crate:: my_mod) fn public_function_in_my_mod() {
41
41
print!("called `my_mod::nested::public_function_in_my_mod()`, that\n > ");
42
42
public_function_in_nested()
43
43
}
@@ -114,4 +114,4 @@ fn main() {
114
114
//my_mod::private_nested::function();
115
115
// TODO ^ Try uncommenting this line
116
116
}
117
- ```
117
+ ```
You can’t perform that action at this time.
0 commit comments