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 {
1919fn main() {
2020 // Explicitly `use` each name so they are available without
2121 // manual scoping.
22- use Status::{Poor, Rich};
22+ use crate:: Status::{Poor, Rich};
2323 // Automatically `use` each name inside `Work`.
24- use Work::*;
24+ use crate:: Work::*;
2525
2626 // Equivalent to `Status::Poor`.
2727 let status = Poor;
Original file line number Diff line number Diff line change 33A common use for ` enums ` is to create a linked-list:
44
55``` rust,editable
6- use List::*;
6+ use crate:: List::*;
77
88enum List {
99 // 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 {
4444 // This will bind to the `cool::function` in the *crate* scope.
4545 // In this case the crate scope is the outermost scope.
4646 {
47- use cool::function as root_function;
47+ use crate:: cool::function as root_function;
4848 root_function();
4949 }
5050 }
@@ -53,4 +53,4 @@ mod my {
5353fn main() {
5454 my::indirect_call();
5555}
56- ```
56+ ```
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ access. It is often used like this:
66``` rust,editable,ignore
77// extern crate deeply; // normally, this would exist and not be commented out!
88
9- use deeply::nested::{
9+ use crate:: deeply::nested::{
1010 my_first_function,
1111 my_second_function,
1212 AndATraitType
@@ -43,7 +43,7 @@ fn main() {
4343 {
4444 // This is equivalent to `use deeply::nested::function as function`.
4545 // This `function()` will shadow the outer one.
46- use deeply::nested::function;
46+ use crate:: deeply::nested::function;
4747 function();
4848
4949 // `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 {
3737
3838 // Functions declared using `pub(in path)` syntax are only visible
3939 // 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() {
4141 print!("called `my_mod::nested::public_function_in_my_mod()`, that\n > ");
4242 public_function_in_nested()
4343 }
@@ -114,4 +114,4 @@ fn main() {
114114 //my_mod::private_nested::function();
115115 // TODO ^ Try uncommenting this line
116116}
117- ```
117+ ```
You can’t perform that action at this time.
0 commit comments