Skip to content

Commit ecaf11a

Browse files
authored
Merge pull request #2091 from rust-lang-nursery/rustup
Rust upgrade to rustc 1.22.0-nightly (0e6f4cf 2017-09-27)
2 parents 387efd4 + 02e7fad commit ecaf11a

15 files changed

+46
-45
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4-
## Trunk
4+
## 0.0.165
5+
* Rust upgrade to rustc 1.22.0-nightly (0e6f4cf51 2017-09-27)
56
* New lint: [`mut_range_bound`]
67

78
## 0.0.164

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.0.164"
3+
version = "0.0.165"
44
authors = [
55
"Manish Goregaokar <[email protected]>",
66
"Andre Bogus <[email protected]>",
@@ -31,7 +31,7 @@ path = "src/main.rs"
3131

3232
[dependencies]
3333
# begin automatic update
34-
clippy_lints = { version = "0.0.164", path = "clippy_lints" }
34+
clippy_lints = { version = "0.0.165", path = "clippy_lints" }
3535
# end automatic update
3636
cargo_metadata = "0.2"
3737

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy_lints"
33
# begin automatic update
4-
version = "0.0.164"
4+
version = "0.0.165"
55
# end automatic update
66
authors = [
77
"Manish Goregaokar <[email protected]>",

clippy_lints/src/loops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,7 @@ fn is_ref_iterable_type(cx: &LateContext, e: &Expr) -> bool {
16041604
fn is_iterable_array(ty: Ty) -> bool {
16051605
// IntoIterator is currently only implemented for array sizes <= 32 in rustc
16061606
match ty.sty {
1607-
ty::TyArray(_, n) => (0...32).contains(const_to_u64(n)),
1607+
ty::TyArray(_, n) => (0..=32).contains(const_to_u64(n)),
16081608
_ => false,
16091609
}
16101610
}

clippy_lints/src/utils/sugg.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl<'a> Sugg<'a> {
126126
ast::ExprKind::While(..) |
127127
ast::ExprKind::WhileLet(..) => Sugg::NonParen(snippet),
128128
ast::ExprKind::Range(.., RangeLimits::HalfOpen) => Sugg::BinOp(AssocOp::DotDot, snippet),
129-
ast::ExprKind::Range(.., RangeLimits::Closed) => Sugg::BinOp(AssocOp::DotDotDot, snippet),
129+
ast::ExprKind::Range(.., RangeLimits::Closed) => Sugg::BinOp(AssocOp::DotDotEq, snippet),
130130
ast::ExprKind::Assign(..) => Sugg::BinOp(AssocOp::Assign, snippet),
131131
ast::ExprKind::AssignOp(op, ..) => Sugg::BinOp(astbinop2assignop(op), snippet),
132132
ast::ExprKind::Binary(op, ..) => Sugg::BinOp(AssocOp::from_ast_binop(op.node), snippet),
@@ -165,7 +165,7 @@ impl<'a> Sugg<'a> {
165165
pub fn range(self, end: Self, limit: ast::RangeLimits) -> Sugg<'static> {
166166
match limit {
167167
ast::RangeLimits::HalfOpen => make_assoc(AssocOp::DotDot, &self, &end),
168-
ast::RangeLimits::Closed => make_assoc(AssocOp::DotDotDot, &self, &end),
168+
ast::RangeLimits::Closed => make_assoc(AssocOp::DotDotEq, &self, &end),
169169
}
170170
}
171171

@@ -312,7 +312,7 @@ pub fn make_assoc(op: AssocOp, lhs: &Sugg, rhs: &Sugg) -> Sugg<'static> {
312312
AssocOp::AssignOp(op) => format!("{} {}= {}", lhs, token_to_string(&token::BinOp(op)), rhs),
313313
AssocOp::As => format!("{} as {}", lhs, rhs),
314314
AssocOp::DotDot => format!("{}..{}", lhs, rhs),
315-
AssocOp::DotDotDot => format!("{}...{}", lhs, rhs),
315+
AssocOp::DotDotEq => format!("{}..={}", lhs, rhs),
316316
AssocOp::Colon => format!("{}: {}", lhs, rhs),
317317
};
318318

@@ -362,7 +362,7 @@ fn associativity(op: &AssocOp) -> Associativity {
362362
ShiftLeft |
363363
ShiftRight |
364364
Subtract => Associativity::Left,
365-
DotDot | DotDotDot => Associativity::None,
365+
DotDot | DotDotEq => Associativity::None,
366366
}
367367
}
368368

tests/ui/array_indexing.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ fn main() {
1313
x[1 << 3];
1414
&x[1..5];
1515
&x[0..3];
16-
&x[0...4];
17-
&x[...4];
16+
&x[0..=4];
17+
&x[..=4];
1818
&x[..];
1919
&x[1..];
2020
&x[4..];
@@ -26,19 +26,19 @@ fn main() {
2626
y[0];
2727
&y[1..2];
2828
&y[..];
29-
&y[0...4];
30-
&y[...4];
29+
&y[0..=4];
30+
&y[..=4];
3131

3232
let empty: [i8; 0] = [];
3333
empty[0];
3434
&empty[1..5];
35-
&empty[0...4];
36-
&empty[...4];
35+
&empty[0..=4];
36+
&empty[..=4];
3737
&empty[..];
3838
&empty[0..];
3939
&empty[0..0];
40-
&empty[0...0];
41-
&empty[...0];
40+
&empty[0..=0];
41+
&empty[..=0];
4242
&empty[..0];
4343
&empty[1..];
4444
&empty[..4];

tests/ui/array_indexing.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ error: range is out of bounds
2121
error: range is out of bounds
2222
--> $DIR/array_indexing.rs:16:6
2323
|
24-
16 | &x[0...4];
24+
16 | &x[0..=4];
2525
| ^^^^^^^^
2626

2727
error: range is out of bounds
2828
--> $DIR/array_indexing.rs:17:6
2929
|
30-
17 | &x[...4];
30+
17 | &x[..=4];
3131
| ^^^^^^^
3232

3333
error: range is out of bounds
@@ -59,13 +59,13 @@ error: slicing may panic
5959
error: slicing may panic
6060
--> $DIR/array_indexing.rs:29:6
6161
|
62-
29 | &y[0...4];
62+
29 | &y[0..=4];
6363
| ^^^^^^^^
6464

6565
error: slicing may panic
6666
--> $DIR/array_indexing.rs:30:6
6767
|
68-
30 | &y[...4];
68+
30 | &y[..=4];
6969
| ^^^^^^^
7070

7171
error: const index is out of bounds
@@ -83,25 +83,25 @@ error: range is out of bounds
8383
error: range is out of bounds
8484
--> $DIR/array_indexing.rs:35:6
8585
|
86-
35 | &empty[0...4];
86+
35 | &empty[0..=4];
8787
| ^^^^^^^^^^^^
8888

8989
error: range is out of bounds
9090
--> $DIR/array_indexing.rs:36:6
9191
|
92-
36 | &empty[...4];
92+
36 | &empty[..=4];
9393
| ^^^^^^^^^^^
9494

9595
error: range is out of bounds
9696
--> $DIR/array_indexing.rs:40:6
9797
|
98-
40 | &empty[0...0];
98+
40 | &empty[0..=0];
9999
| ^^^^^^^^^^^^
100100

101101
error: range is out of bounds
102102
--> $DIR/array_indexing.rs:41:6
103103
|
104-
41 | &empty[...0];
104+
41 | &empty[..=0];
105105
| ^^^^^^^^^^^
106106

107107
error: range is out of bounds

tests/ui/copies.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(plugin, inclusive_range_syntax)]
1+
#![feature(plugin, dotdoteq_in_patterns, inclusive_range_syntax)]
22
#![plugin(clippy)]
33

44
#![allow(dead_code, no_effect, unnecessary_operation)]
@@ -33,7 +33,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
3333
..;
3434
0..;
3535
..10;
36-
0...10;
36+
0..=10;
3737
foo();
3838
}
3939
else {
@@ -42,7 +42,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
4242
..;
4343
0..;
4444
..10;
45-
0...10;
45+
0..=10;
4646
foo();
4747
}
4848

@@ -64,7 +64,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
6464
0..10;
6565
}
6666
else {
67-
0...10;
67+
0..=10;
6868
}
6969

7070
if true {
@@ -161,7 +161,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
161161
let _ = match 42 {
162162
42 => 1,
163163
a if a > 0 => 2,
164-
10...15 => 3,
164+
10..=15 => 3,
165165
_ => 4,
166166
};
167167
}
@@ -172,7 +172,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
172172
let _ = match 42 {
173173
42 => 1,
174174
a if a > 0 => 2,
175-
10...15 => 3,
175+
10..=15 => 3,
176176
_ => 4,
177177
};
178178
}

tests/ui/for_loop.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,15 @@ fn main() {
125125
println!("{}", vec[i]);
126126
}
127127

128-
for i in 0...MAX_LEN {
128+
for i in 0..=MAX_LEN {
129129
println!("{}", vec[i]);
130130
}
131131

132132
for i in 5..10 {
133133
println!("{}", vec[i]);
134134
}
135135

136-
for i in 5...10 {
136+
for i in 5..=10 {
137137
println!("{}", vec[i]);
138138
}
139139

@@ -149,7 +149,7 @@ fn main() {
149149
println!("{}", i);
150150
}
151151

152-
for i in 10...0 {
152+
for i in 10..=0 {
153153
println!("{}", i);
154154
}
155155

@@ -161,7 +161,7 @@ fn main() {
161161
println!("{}", i);
162162
}
163163

164-
for i in 5...5 {
164+
for i in 5..=5 {
165165
// not an error, this is the range with only one element “5”
166166
println!("{}", i);
167167
}

tests/ui/for_loop.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ help: consider using an iterator
178178
error: the loop variable `i` is only used to index `vec`.
179179
--> $DIR/for_loop.rs:128:5
180180
|
181-
128 | / for i in 0...MAX_LEN {
181+
128 | / for i in 0..=MAX_LEN {
182182
129 | | println!("{}", vec[i]);
183183
130 | | }
184184
| |_____^
@@ -204,7 +204,7 @@ help: consider using an iterator
204204
error: the loop variable `i` is only used to index `vec`.
205205
--> $DIR/for_loop.rs:136:5
206206
|
207-
136 | / for i in 5...10 {
207+
136 | / for i in 5..=10 {
208208
137 | | println!("{}", vec[i]);
209209
138 | | }
210210
| |_____^
@@ -257,7 +257,7 @@ help: consider using the following if you are attempting to iterate over this ra
257257
error: this range is empty so this for loop will never run
258258
--> $DIR/for_loop.rs:152:5
259259
|
260-
152 | / for i in 10...0 {
260+
152 | / for i in 10..=0 {
261261
153 | | println!("{}", i);
262262
154 | | }
263263
| |_____^

tests/ui/no_effect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn main() {
4949
5..;
5050
..5;
5151
5..6;
52-
5...6;
52+
5..=6;
5353
[42, 55];
5454
[42, 55][1];
5555
(42, 55).1;

tests/ui/no_effect.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ error: statement with no effect
111111
error: statement with no effect
112112
--> $DIR/no_effect.rs:52:5
113113
|
114-
52 | 5...6;
114+
52 | 5..=6;
115115
| ^^^^^^
116116

117117
error: statement with no effect

tests/ui/range.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn main() {
1515
let _ = (0..1).step_by(1);
1616

1717
let _ = (1..).step_by(0);
18-
let _ = (1...2).step_by(0);
18+
let _ = (1..=2).step_by(0);
1919

2020
let x = 0..1;
2121
let _ = x.step_by(0);

tests/ui/range.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ error: Iterator::step_by(0) will panic at runtime
1515
error: Iterator::step_by(0) will panic at runtime
1616
--> $DIR/range.rs:18:13
1717
|
18-
18 | let _ = (1...2).step_by(0);
18+
18 | let _ = (1..=2).step_by(0);
1919
| ^^^^^^^^^^^^^^^^^^
2020

2121
error: Iterator::step_by(0) will panic at runtime

0 commit comments

Comments
 (0)