Skip to content

Commit

Permalink
Merge pull request #1136 from codesections/enum_use_2018_edition
Browse files Browse the repository at this point in the history
Update syntax for 2018 Edition
  • Loading branch information
frewsxcv authored Jan 12, 2019
2 parents 0559f0a + da6b750 commit 4e11b66
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/custom_types/enum/enum_use.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ enum Work {
fn main() {
// Explicitly `use` each name so they are available without
// manual scoping.
use Status::{Poor, Rich};
use crate::Status::{Poor, Rich};
// Automatically `use` each name inside `Work`.
use Work::*;
use crate::Work::*;
// Equivalent to `Status::Poor`.
let status = Poor;
Expand Down
2 changes: 1 addition & 1 deletion src/custom_types/enum/testcase_linked_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A common use for `enums` is to create a linked-list:

```rust,editable
use List::*;
use crate::List::*;
enum List {
// Cons: Tuple struct that wraps an element and a pointer to the next node
Expand Down
4 changes: 2 additions & 2 deletions src/mod/super.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ mod my {
// This will bind to the `cool::function` in the *crate* scope.
// In this case the crate scope is the outermost scope.
{
use cool::function as root_function;
use crate::cool::function as root_function;
root_function();
}
}
Expand All @@ -53,4 +53,4 @@ mod my {
fn main() {
my::indirect_call();
}
```
```
4 changes: 2 additions & 2 deletions src/mod/use.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ access. It is often used like this:
```rust,editable,ignore
// extern crate deeply; // normally, this would exist and not be commented out!
use deeply::nested::{
use crate::deeply::nested::{
my_first_function,
my_second_function,
AndATraitType
Expand Down Expand Up @@ -43,7 +43,7 @@ fn main() {
{
// This is equivalent to `use deeply::nested::function as function`.
// This `function()` will shadow the outer one.
use deeply::nested::function;
use crate::deeply::nested::function;
function();
// `use` bindings have a local scope. In this case, the
Expand Down
4 changes: 2 additions & 2 deletions src/mod/visibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ mod my_mod {
// Functions declared using `pub(in path)` syntax are only visible
// within the given path. `path` must be a parent or ancestor module
pub(in my_mod) fn public_function_in_my_mod() {
pub(in crate::my_mod) fn public_function_in_my_mod() {
print!("called `my_mod::nested::public_function_in_my_mod()`, that\n > ");
public_function_in_nested()
}
Expand Down Expand Up @@ -114,4 +114,4 @@ fn main() {
//my_mod::private_nested::function();
// TODO ^ Try uncommenting this line
}
```
```

0 comments on commit 4e11b66

Please sign in to comment.