Update inclusive range syntax, fix script pathname, crate deps (#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
This commit is contained in:
Jubilee 2019-09-19 11:04:37 -07:00 committed by Andrew Gauger
parent cb949b04c0
commit 16a043b09a
5 changed files with 23 additions and 17 deletions

View file

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

View file

@ -89,10 +89,10 @@ To check the spelling of the Rust Cookbook locally, run the following command
from the root of the Cookbook.
```
./ci/spellchecker.sh
./ci/spellcheck.sh
# or, if you're using a different locale
LANG=en_US.UTF-8 ./ci/spellchecker.sh
LANG=en_US.UTF-8 ./ci/spellcheck.sh
```
If the spell checker finds a misspelled word, you have the opportunity to
@ -100,6 +100,8 @@ correct the spelling mistake with the number keys. If the spelling mistake
is erroneous, add the word to the dictionary located in `ci/dictionary.txt`.
Pressing `a` or `l` will not add the word to the custom dictionary.
If there are no errors, it will just print the local Aspell version and exit.
[mdbook]: https://github.com/rust-lang-nursery/mdBook
[python]: https://packaging.python.org/tutorials/installing-packages/#install-pip-setuptools-and-wheel
[skeptic]: https://github.com/brson/rust-skeptic

View file

@ -32,6 +32,7 @@ nalgebra = "0.16.12"
ndarray = "0.12"
num = "0.2"
num_cpus = "1.8"
percent-encoding = "2.1"
petgraph = "0.4"
postgres = "0.15"
rand = "0.6"
@ -51,7 +52,7 @@ tempdir = "0.3.5"
threadpool = "1.6"
toml = "0.4"
unicode-segmentation = "1.2.1"
url = "1.6"
url = "2.1"
walkdir = "2.0"
[target.'cfg(target_os = "linux")'.dependencies]

View file

@ -42,18 +42,18 @@ use image::{ImageBuffer, Pixel, Rgb};
# let wave = wavelength as f32;
#
# let (r, g, b) = match wavelength {
# 380...439 => ((440. - wave) / (440. - 380.), 0.0, 1.0),
# 440...489 => (0.0, (wave - 440.) / (490. - 440.), 1.0),
# 490...509 => (0.0, 1.0, (510. - wave) / (510. - 490.)),
# 510...579 => ((wave - 510.) / (580. - 510.), 1.0, 0.0),
# 580...644 => (1.0, (645. - wave) / (645. - 580.), 0.0),
# 645...780 => (1.0, 0.0, 0.0),
# 380..=439 => ((440. - wave) / (440. - 380.), 0.0, 1.0),
# 440..=489 => (0.0, (wave - 440.) / (490. - 440.), 1.0),
# 490..=509 => (0.0, 1.0, (510. - wave) / (510. - 490.)),
# 510..=579 => ((wave - 510.) / (580. - 510.), 1.0, 0.0),
# 580..=644 => (1.0, (645. - wave) / (645. - 580.), 0.0),
# 645..=780 => (1.0, 0.0, 0.0),
# _ => (0.0, 0.0, 0.0),
# };
#
# let factor = match wavelength {
# 380...419 => 0.3 + 0.7 * (wave - 380.) / (420. - 380.),
# 701...780 => 0.3 + 0.7 * (780. - wave) / (780. - 700.),
# 380..=419 => 0.3 + 0.7 * (wave - 380.) / (420. - 380.),
# 701..=780 => 0.3 + 0.7 * (780. - wave) / (780. - 700.),
# _ => 1.0,
# };
#

View file

@ -1,21 +1,24 @@
## Percent-encode a string
[![url-badge]][url] [![cat-encoding-badge]][cat-encoding]
[![url-badge]][percent-encoding] [![cat-encoding-badge]][cat-encoding]
Encode an input string with [percent-encoding] using the [`utf8_percent_encode`]
function from the `url` crate. Then decode using the [`percent_decode`]
function from the `percent-encoding` crate. Then decode using the [`percent_decode`]
function.
```rust
extern crate url;
extern crate percent_encoding;
use url::percent_encoding::{utf8_percent_encode, percent_decode, DEFAULT_ENCODE_SET};
use percent_encoding::{utf8_percent_encode, percent_decode, AsciiSet, CONTROLS};
use std::str::Utf8Error;
/// https://url.spec.whatwg.org/#fragment-percent-encode-set
const FRAGMENT: &AsciiSet = &CONTROLS.add(b' ').add(b'"').add(b'<').add(b'>').add(b'`');
fn main() -> Result<(), Utf8Error> {
let input = "confident, productive systems programming";
let iter = utf8_percent_encode(input, DEFAULT_ENCODE_SET);
let iter = utf8_percent_encode(input, FRAGMENT);
let encoded: String = iter.collect();
assert_eq!(encoded, "confident,%20productive%20systems%20programming");