Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0cf0691

Browse files
committedJun 26, 2018
Auto merge of #51149 - zackmdavis:․․․_to_․․=, r=nikomatsakis
lint to favor `..=` over `...` range patterns; migrate to `..=` throughout codebase We probably need an RFC to actually deprecate the `...` syntax, but here's a candidate implementation for the lint considered in #51043. (My local build is super flaky, but hopefully I got all of the test revisions.)
2 parents 84804c3 + 64365e4 commit 0cf0691

File tree

77 files changed

+373
-240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+373
-240
lines changed
 

‎src/libcore/ascii.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@ pub fn escape_default(c: u8) -> EscapeDefault {
108108
b'\\' => ([b'\\', b'\\', 0, 0], 2),
109109
b'\'' => ([b'\\', b'\'', 0, 0], 2),
110110
b'"' => ([b'\\', b'"', 0, 0], 2),
111-
b'\x20' ... b'\x7e' => ([c, 0, 0, 0], 1),
111+
b'\x20' ..= b'\x7e' => ([c, 0, 0, 0], 1),
112112
_ => ([b'\\', b'x', hexify(c >> 4), hexify(c & 0xf)], 4),
113113
};
114114

115115
return EscapeDefault { range: 0..len, data };
116116

117117
fn hexify(b: u8) -> u8 {
118118
match b {
119-
0 ... 9 => b'0' + b,
119+
0 ..= 9 => b'0' + b,
120120
_ => b'a' + b - 10,
121121
}
122122
}

‎src/libcore/char/decode.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl<I: Iterator<Item = u8>> Iterator for DecodeUtf8<I> {
6464
}
6565
}
6666
macro_rules! continuation_byte {
67-
() => { continuation_byte!(0x80...0xBF) };
67+
() => { continuation_byte!(0x80..=0xBF) };
6868
($range: pat) => {
6969
match self.0.peek() {
7070
Some(&byte @ $range) => {
@@ -77,43 +77,43 @@ impl<I: Iterator<Item = u8>> Iterator for DecodeUtf8<I> {
7777
}
7878

7979
match first_byte {
80-
0x00...0x7F => {
80+
0x00..=0x7F => {
8181
first_byte!(0b1111_1111);
8282
}
83-
0xC2...0xDF => {
83+
0xC2..=0xDF => {
8484
first_byte!(0b0001_1111);
8585
continuation_byte!();
8686
}
8787
0xE0 => {
8888
first_byte!(0b0000_1111);
89-
continuation_byte!(0xA0...0xBF); // 0x80...0x9F here are overlong
89+
continuation_byte!(0xA0..=0xBF); // 0x80..=0x9F here are overlong
9090
continuation_byte!();
9191
}
92-
0xE1...0xEC | 0xEE...0xEF => {
92+
0xE1..=0xEC | 0xEE..=0xEF => {
9393
first_byte!(0b0000_1111);
9494
continuation_byte!();
9595
continuation_byte!();
9696
}
9797
0xED => {
9898
first_byte!(0b0000_1111);
99-
continuation_byte!(0x80...0x9F); // 0xA0..0xBF here are surrogates
99+
continuation_byte!(0x80..=0x9F); // 0xA0..0xBF here are surrogates
100100
continuation_byte!();
101101
}
102102
0xF0 => {
103103
first_byte!(0b0000_0111);
104-
continuation_byte!(0x90...0xBF); // 0x80..0x8F here are overlong
104+
continuation_byte!(0x90..=0xBF); // 0x80..0x8F here are overlong
105105
continuation_byte!();
106106
continuation_byte!();
107107
}
108-
0xF1...0xF3 => {
108+
0xF1..=0xF3 => {
109109
first_byte!(0b0000_0111);
110110
continuation_byte!();
111111
continuation_byte!();
112112
continuation_byte!();
113113
}
114114
0xF4 => {
115115
first_byte!(0b0000_0111);
116-
continuation_byte!(0x80...0x8F); // 0x90..0xBF here are beyond char::MAX
116+
continuation_byte!(0x80..=0x8F); // 0x90..0xBF here are beyond char::MAX
117117
continuation_byte!();
118118
continuation_byte!();
119119
}

0 commit comments

Comments
 (0)
Please sign in to comment.