Skip to content

Commit 16a043b

Browse files
workingjubileeAndyGauge
authored andcommittedSep 19, 2019
Update inclusive range syntax, fix script pathname, crate deps (rust-lang-nursery#547)
Fix docs directing developer to incorrect pathname for spellcheck.sh Add note on the normal behavior of spellcheck.sh for clarity Fix instances of inclusive range syntax to use '..=' style Depend directly on percent-encoding instead of expecting re-exports This commit compiles and tests correctly on rustc v1.37.0 link-checker found 452 failures before this commit link-checker found 452 failures after this commit no new errors were added by this commit
1 parent cb949b0 commit 16a043b

File tree

5 files changed

+23
-17
lines changed

5 files changed

+23
-17
lines changed
 

‎.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ No worries if anything in these lists is unclear. Just submit the PR and ask awa
1212
- [ ] commits are squashed into one and rebased to latest master
1313
- [ ] PR contains correct "fixes #ISSUE_ID" clause to autoclose the issue on PR merge
1414
- if issue does not exist consider creating it or remove the clause
15-
- [ ] spell check runs without errors `./ci/spellchecker.sh`
15+
- [ ] spell check runs without errors `./ci/spellcheck.sh`
1616
- [ ] link check runs without errors `link-checker ./book`
1717
- [ ] non rendered items are in sorted order (links, reference, identifiers, Cargo.toml)
1818
- [ ] links to docs.rs have wildcard version `https://docs.rs/tar/*/tar/struct.Entry.html`

‎CONTRIBUTING.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,19 @@ To check the spelling of the Rust Cookbook locally, run the following command
8989
from the root of the Cookbook.
9090

9191
```
92-
./ci/spellchecker.sh
92+
./ci/spellcheck.sh
9393
9494
# or, if you're using a different locale
95-
LANG=en_US.UTF-8 ./ci/spellchecker.sh
95+
LANG=en_US.UTF-8 ./ci/spellcheck.sh
9696
```
9797

9898
If the spell checker finds a misspelled word, you have the opportunity to
9999
correct the spelling mistake with the number keys. If the spelling mistake
100100
is erroneous, add the word to the dictionary located in `ci/dictionary.txt`.
101101
Pressing `a` or `l` will not add the word to the custom dictionary.
102102

103+
If there are no errors, it will just print the local Aspell version and exit.
104+
103105
[mdbook]: https://github.com/rust-lang-nursery/mdBook
104106
[python]: https://packaging.python.org/tutorials/installing-packages/#install-pip-setuptools-and-wheel
105107
[skeptic]: https://github.com/brson/rust-skeptic

‎Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ nalgebra = "0.16.12"
3232
ndarray = "0.12"
3333
num = "0.2"
3434
num_cpus = "1.8"
35+
percent-encoding = "2.1"
3536
petgraph = "0.4"
3637
postgres = "0.15"
3738
rand = "0.6"
@@ -51,7 +52,7 @@ tempdir = "0.3.5"
5152
threadpool = "1.6"
5253
toml = "0.4"
5354
unicode-segmentation = "1.2.1"
54-
url = "1.6"
55+
url = "2.1"
5556
walkdir = "2.0"
5657

5758
[target.'cfg(target_os = "linux")'.dependencies]

‎src/concurrency/thread/threadpool-fractal.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ use image::{ImageBuffer, Pixel, Rgb};
4242
# let wave = wavelength as f32;
4343
#
4444
# let (r, g, b) = match wavelength {
45-
# 380...439 => ((440. - wave) / (440. - 380.), 0.0, 1.0),
46-
# 440...489 => (0.0, (wave - 440.) / (490. - 440.), 1.0),
47-
# 490...509 => (0.0, 1.0, (510. - wave) / (510. - 490.)),
48-
# 510...579 => ((wave - 510.) / (580. - 510.), 1.0, 0.0),
49-
# 580...644 => (1.0, (645. - wave) / (645. - 580.), 0.0),
50-
# 645...780 => (1.0, 0.0, 0.0),
45+
# 380..=439 => ((440. - wave) / (440. - 380.), 0.0, 1.0),
46+
# 440..=489 => (0.0, (wave - 440.) / (490. - 440.), 1.0),
47+
# 490..=509 => (0.0, 1.0, (510. - wave) / (510. - 490.)),
48+
# 510..=579 => ((wave - 510.) / (580. - 510.), 1.0, 0.0),
49+
# 580..=644 => (1.0, (645. - wave) / (645. - 580.), 0.0),
50+
# 645..=780 => (1.0, 0.0, 0.0),
5151
# _ => (0.0, 0.0, 0.0),
5252
# };
5353
#
5454
# let factor = match wavelength {
55-
# 380...419 => 0.3 + 0.7 * (wave - 380.) / (420. - 380.),
56-
# 701...780 => 0.3 + 0.7 * (780. - wave) / (780. - 700.),
55+
# 380..=419 => 0.3 + 0.7 * (wave - 380.) / (420. - 380.),
56+
# 701..=780 => 0.3 + 0.7 * (780. - wave) / (780. - 700.),
5757
# _ => 1.0,
5858
# };
5959
#

‎src/encoding/string/percent-encode.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
## Percent-encode a string
22

3-
[![url-badge]][url] [![cat-encoding-badge]][cat-encoding]
3+
[![url-badge]][percent-encoding] [![cat-encoding-badge]][cat-encoding]
44

55
Encode an input string with [percent-encoding] using the [`utf8_percent_encode`]
6-
function from the `url` crate. Then decode using the [`percent_decode`]
6+
function from the `percent-encoding` crate. Then decode using the [`percent_decode`]
77
function.
88

99
```rust
10-
extern crate url;
10+
extern crate percent_encoding;
1111

12-
use url::percent_encoding::{utf8_percent_encode, percent_decode, DEFAULT_ENCODE_SET};
12+
use percent_encoding::{utf8_percent_encode, percent_decode, AsciiSet, CONTROLS};
1313
use std::str::Utf8Error;
1414

15+
/// https://url.spec.whatwg.org/#fragment-percent-encode-set
16+
const FRAGMENT: &AsciiSet = &CONTROLS.add(b' ').add(b'"').add(b'<').add(b'>').add(b'`');
17+
1518
fn main() -> Result<(), Utf8Error> {
1619
let input = "confident, productive systems programming";
1720

18-
let iter = utf8_percent_encode(input, DEFAULT_ENCODE_SET);
21+
let iter = utf8_percent_encode(input, FRAGMENT);
1922
let encoded: String = iter.collect();
2023
assert_eq!(encoded, "confident,%20productive%20systems%20programming");
2124

0 commit comments

Comments
 (0)