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 range so matches rust-fmt . #1890

Merged
merged 2 commits into from
Apr 15, 2019
Merged
Changes from 1 commit
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
14 changes: 7 additions & 7 deletions src/ch18-03-pattern-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,16 @@ arm will execute:
let x = 5;

match x {
1 ... 5 => println!("one through five"),
1...5 => println!("one through five"),
_ => println!("something else"),
}
```

If `x` is 1, 2, 3, 4, or 5, the first arm will match. This syntax is more
convenient than using the `|` operator to express the same idea; instead of `1
... 5`, we would have to specify `1 | 2 | 3 | 4 | 5` if we used `|`. Specifying
a range is much shorter, especially if we want to match, say, any number
between 1 and 1,000!
convenient than using the `|` operator to express the same idea; instead of
`1...5`, we would have to specify `1 | 2 | 3 | 4 | 5` if we used `|`.
Specifyinga range is much shorter, especially if we want to match, say, any
Copy link
Contributor

Choose a reason for hiding this comment

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

The CI test failed because of the missing space between "Specifying" and "a" on this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @L0uisc
I have added the space between "Specifying" and "a".
If there are any other issues with this PR you would like me to address please let me know.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @Plotnus! I have no other concerns with the PR.

number between 1 and 1,000!

Ranges are only allowed with numeric values or `char` values, because the
compiler checks that the range isn’t empty at compile time. The only types for
Expand All @@ -136,8 +136,8 @@ Here is an example using ranges of `char` values:
let x = 'c';

match x {
'a' ... 'j' => println!("early ASCII letter"),
'k' ... 'z' => println!("late ASCII letter"),
'a'...'j' => println!("early ASCII letter"),
'k'...'z' => println!("late ASCII letter"),
_ => println!("something else"),
}
```
Expand Down