Merge pull request #2091 from rust-lang-nursery/rustup

Rust upgrade to rustc 1.22.0-nightly (0e6f4cf51 2017-09-27)
This commit is contained in:
Manish Goregaokar 2017-09-28 10:50:15 -07:00 committed by GitHub
commit ecaf11ab42
15 changed files with 46 additions and 45 deletions

View File

@ -1,7 +1,8 @@
# Change Log
All notable changes to this project will be documented in this file.
## Trunk
## 0.0.165
* Rust upgrade to rustc 1.22.0-nightly (0e6f4cf51 2017-09-27)
* New lint: [`mut_range_bound`]
## 0.0.164

6
Cargo.lock generated
View File

@ -1,6 +1,6 @@
[root]
name = "clippy_lints"
version = "0.0.164"
version = "0.0.165"
dependencies = [
"itertools 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -78,11 +78,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "clippy"
version = "0.0.164"
version = "0.0.165"
dependencies = [
"cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy-mini-macro-test 0.1.0",
"clippy_lints 0.0.164",
"clippy_lints 0.0.165",
"compiletest_rs 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"duct 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.0.164"
version = "0.0.165"
authors = [
"Manish Goregaokar <manishsmail@gmail.com>",
"Andre Bogus <bogusandre@gmail.com>",
@ -31,7 +31,7 @@ path = "src/main.rs"
[dependencies]
# begin automatic update
clippy_lints = { version = "0.0.164", path = "clippy_lints" }
clippy_lints = { version = "0.0.165", path = "clippy_lints" }
# end automatic update
cargo_metadata = "0.2"

View File

@ -1,7 +1,7 @@
[package]
name = "clippy_lints"
# begin automatic update
version = "0.0.164"
version = "0.0.165"
# end automatic update
authors = [
"Manish Goregaokar <manishsmail@gmail.com>",

View File

@ -1604,7 +1604,7 @@ fn is_ref_iterable_type(cx: &LateContext, e: &Expr) -> bool {
fn is_iterable_array(ty: Ty) -> bool {
// IntoIterator is currently only implemented for array sizes <= 32 in rustc
match ty.sty {
ty::TyArray(_, n) => (0...32).contains(const_to_u64(n)),
ty::TyArray(_, n) => (0..=32).contains(const_to_u64(n)),
_ => false,
}
}

View File

@ -126,7 +126,7 @@ impl<'a> Sugg<'a> {
ast::ExprKind::While(..) |
ast::ExprKind::WhileLet(..) => Sugg::NonParen(snippet),
ast::ExprKind::Range(.., RangeLimits::HalfOpen) => Sugg::BinOp(AssocOp::DotDot, snippet),
ast::ExprKind::Range(.., RangeLimits::Closed) => Sugg::BinOp(AssocOp::DotDotDot, snippet),
ast::ExprKind::Range(.., RangeLimits::Closed) => Sugg::BinOp(AssocOp::DotDotEq, snippet),
ast::ExprKind::Assign(..) => Sugg::BinOp(AssocOp::Assign, snippet),
ast::ExprKind::AssignOp(op, ..) => Sugg::BinOp(astbinop2assignop(op), snippet),
ast::ExprKind::Binary(op, ..) => Sugg::BinOp(AssocOp::from_ast_binop(op.node), snippet),
@ -165,7 +165,7 @@ impl<'a> Sugg<'a> {
pub fn range(self, end: Self, limit: ast::RangeLimits) -> Sugg<'static> {
match limit {
ast::RangeLimits::HalfOpen => make_assoc(AssocOp::DotDot, &self, &end),
ast::RangeLimits::Closed => make_assoc(AssocOp::DotDotDot, &self, &end),
ast::RangeLimits::Closed => make_assoc(AssocOp::DotDotEq, &self, &end),
}
}
@ -312,7 +312,7 @@ pub fn make_assoc(op: AssocOp, lhs: &Sugg, rhs: &Sugg) -> Sugg<'static> {
AssocOp::AssignOp(op) => format!("{} {}= {}", lhs, token_to_string(&token::BinOp(op)), rhs),
AssocOp::As => format!("{} as {}", lhs, rhs),
AssocOp::DotDot => format!("{}..{}", lhs, rhs),
AssocOp::DotDotDot => format!("{}...{}", lhs, rhs),
AssocOp::DotDotEq => format!("{}..={}", lhs, rhs),
AssocOp::Colon => format!("{}: {}", lhs, rhs),
};
@ -362,7 +362,7 @@ fn associativity(op: &AssocOp) -> Associativity {
ShiftLeft |
ShiftRight |
Subtract => Associativity::Left,
DotDot | DotDotDot => Associativity::None,
DotDot | DotDotEq => Associativity::None,
}
}

View File

@ -13,8 +13,8 @@ fn main() {
x[1 << 3];
&x[1..5];
&x[0..3];
&x[0...4];
&x[...4];
&x[0..=4];
&x[..=4];
&x[..];
&x[1..];
&x[4..];
@ -26,19 +26,19 @@ fn main() {
y[0];
&y[1..2];
&y[..];
&y[0...4];
&y[...4];
&y[0..=4];
&y[..=4];
let empty: [i8; 0] = [];
empty[0];
&empty[1..5];
&empty[0...4];
&empty[...4];
&empty[0..=4];
&empty[..=4];
&empty[..];
&empty[0..];
&empty[0..0];
&empty[0...0];
&empty[...0];
&empty[0..=0];
&empty[..=0];
&empty[..0];
&empty[1..];
&empty[..4];

View File

@ -21,13 +21,13 @@ error: range is out of bounds
error: range is out of bounds
--> $DIR/array_indexing.rs:16:6
|
16 | &x[0...4];
16 | &x[0..=4];
| ^^^^^^^^
error: range is out of bounds
--> $DIR/array_indexing.rs:17:6
|
17 | &x[...4];
17 | &x[..=4];
| ^^^^^^^
error: range is out of bounds
@ -59,13 +59,13 @@ error: slicing may panic
error: slicing may panic
--> $DIR/array_indexing.rs:29:6
|
29 | &y[0...4];
29 | &y[0..=4];
| ^^^^^^^^
error: slicing may panic
--> $DIR/array_indexing.rs:30:6
|
30 | &y[...4];
30 | &y[..=4];
| ^^^^^^^
error: const index is out of bounds
@ -83,25 +83,25 @@ error: range is out of bounds
error: range is out of bounds
--> $DIR/array_indexing.rs:35:6
|
35 | &empty[0...4];
35 | &empty[0..=4];
| ^^^^^^^^^^^^
error: range is out of bounds
--> $DIR/array_indexing.rs:36:6
|
36 | &empty[...4];
36 | &empty[..=4];
| ^^^^^^^^^^^
error: range is out of bounds
--> $DIR/array_indexing.rs:40:6
|
40 | &empty[0...0];
40 | &empty[0..=0];
| ^^^^^^^^^^^^
error: range is out of bounds
--> $DIR/array_indexing.rs:41:6
|
41 | &empty[...0];
41 | &empty[..=0];
| ^^^^^^^^^^^
error: range is out of bounds

View File

@ -1,4 +1,4 @@
#![feature(plugin, inclusive_range_syntax)]
#![feature(plugin, dotdoteq_in_patterns, inclusive_range_syntax)]
#![plugin(clippy)]
#![allow(dead_code, no_effect, unnecessary_operation)]
@ -33,7 +33,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
..;
0..;
..10;
0...10;
0..=10;
foo();
}
else {
@ -42,7 +42,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
..;
0..;
..10;
0...10;
0..=10;
foo();
}
@ -64,7 +64,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
0..10;
}
else {
0...10;
0..=10;
}
if true {
@ -161,7 +161,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
let _ = match 42 {
42 => 1,
a if a > 0 => 2,
10...15 => 3,
10..=15 => 3,
_ => 4,
};
}
@ -172,7 +172,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
let _ = match 42 {
42 => 1,
a if a > 0 => 2,
10...15 => 3,
10..=15 => 3,
_ => 4,
};
}

View File

@ -125,7 +125,7 @@ fn main() {
println!("{}", vec[i]);
}
for i in 0...MAX_LEN {
for i in 0..=MAX_LEN {
println!("{}", vec[i]);
}
@ -133,7 +133,7 @@ fn main() {
println!("{}", vec[i]);
}
for i in 5...10 {
for i in 5..=10 {
println!("{}", vec[i]);
}
@ -149,7 +149,7 @@ fn main() {
println!("{}", i);
}
for i in 10...0 {
for i in 10..=0 {
println!("{}", i);
}
@ -161,7 +161,7 @@ fn main() {
println!("{}", i);
}
for i in 5...5 {
for i in 5..=5 {
// not an error, this is the range with only one element “5”
println!("{}", i);
}

View File

@ -178,7 +178,7 @@ help: consider using an iterator
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:128:5
|
128 | / for i in 0...MAX_LEN {
128 | / for i in 0..=MAX_LEN {
129 | | println!("{}", vec[i]);
130 | | }
| |_____^
@ -204,7 +204,7 @@ help: consider using an iterator
error: the loop variable `i` is only used to index `vec`.
--> $DIR/for_loop.rs:136:5
|
136 | / for i in 5...10 {
136 | / for i in 5..=10 {
137 | | println!("{}", vec[i]);
138 | | }
| |_____^
@ -257,7 +257,7 @@ help: consider using the following if you are attempting to iterate over this ra
error: this range is empty so this for loop will never run
--> $DIR/for_loop.rs:152:5
|
152 | / for i in 10...0 {
152 | / for i in 10..=0 {
153 | | println!("{}", i);
154 | | }
| |_____^

View File

@ -49,7 +49,7 @@ fn main() {
5..;
..5;
5..6;
5...6;
5..=6;
[42, 55];
[42, 55][1];
(42, 55).1;

View File

@ -111,7 +111,7 @@ error: statement with no effect
error: statement with no effect
--> $DIR/no_effect.rs:52:5
|
52 | 5...6;
52 | 5..=6;
| ^^^^^^
error: statement with no effect

View File

@ -15,7 +15,7 @@ fn main() {
let _ = (0..1).step_by(1);
let _ = (1..).step_by(0);
let _ = (1...2).step_by(0);
let _ = (1..=2).step_by(0);
let x = 0..1;
let _ = x.step_by(0);

View File

@ -15,7 +15,7 @@ error: Iterator::step_by(0) will panic at runtime
error: Iterator::step_by(0) will panic at runtime
--> $DIR/range.rs:18:13
|
18 | let _ = (1...2).step_by(0);
18 | let _ = (1..=2).step_by(0);
| ^^^^^^^^^^^^^^^^^^
error: Iterator::step_by(0) will panic at runtime