Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update syntax for 2018 Edition #1136

Merged
merged 6 commits into from
Jan 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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::*;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is reversed ↩️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that! Fixed.

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
}
```
```