Update ... -> ..= in tests

This commit is contained in:
Manish Goregaokar 2017-09-28 10:40:19 -07:00
parent 201b5c2f24
commit 3159a7f2a1
9 changed files with 33 additions and 33 deletions

View file

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

View file

@ -21,13 +21,13 @@ error: range is out of bounds
error: range is out of bounds error: range is out of bounds
--> $DIR/array_indexing.rs:16:6 --> $DIR/array_indexing.rs:16:6
| |
16 | &x[0...4]; 16 | &x[0..=4];
| ^^^^^^^^ | ^^^^^^^^
error: range is out of bounds error: range is out of bounds
--> $DIR/array_indexing.rs:17:6 --> $DIR/array_indexing.rs:17:6
| |
17 | &x[...4]; 17 | &x[..=4];
| ^^^^^^^ | ^^^^^^^
error: range is out of bounds error: range is out of bounds
@ -59,13 +59,13 @@ error: slicing may panic
error: slicing may panic error: slicing may panic
--> $DIR/array_indexing.rs:29:6 --> $DIR/array_indexing.rs:29:6
| |
29 | &y[0...4]; 29 | &y[0..=4];
| ^^^^^^^^ | ^^^^^^^^
error: slicing may panic error: slicing may panic
--> $DIR/array_indexing.rs:30:6 --> $DIR/array_indexing.rs:30:6
| |
30 | &y[...4]; 30 | &y[..=4];
| ^^^^^^^ | ^^^^^^^
error: const index is out of bounds error: const index is out of bounds
@ -83,25 +83,25 @@ error: range is out of bounds
error: range is out of bounds error: range is out of bounds
--> $DIR/array_indexing.rs:35:6 --> $DIR/array_indexing.rs:35:6
| |
35 | &empty[0...4]; 35 | &empty[0..=4];
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: range is out of bounds error: range is out of bounds
--> $DIR/array_indexing.rs:36:6 --> $DIR/array_indexing.rs:36:6
| |
36 | &empty[...4]; 36 | &empty[..=4];
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: range is out of bounds error: range is out of bounds
--> $DIR/array_indexing.rs:40:6 --> $DIR/array_indexing.rs:40:6
| |
40 | &empty[0...0]; 40 | &empty[0..=0];
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: range is out of bounds error: range is out of bounds
--> $DIR/array_indexing.rs:41:6 --> $DIR/array_indexing.rs:41:6
| |
41 | &empty[...0]; 41 | &empty[..=0];
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: range is out of bounds 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)] #![plugin(clippy)]
#![allow(dead_code, no_effect, unnecessary_operation)] #![allow(dead_code, no_effect, unnecessary_operation)]
@ -33,7 +33,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
..; ..;
0..; 0..;
..10; ..10;
0...10; 0..=10;
foo(); foo();
} }
else { else {
@ -42,7 +42,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
..; ..;
0..; 0..;
..10; ..10;
0...10; 0..=10;
foo(); foo();
} }
@ -64,7 +64,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
0..10; 0..10;
} }
else { else {
0...10; 0..=10;
} }
if true { if true {
@ -161,7 +161,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
let _ = match 42 { let _ = match 42 {
42 => 1, 42 => 1,
a if a > 0 => 2, a if a > 0 => 2,
10...15 => 3, 10..=15 => 3,
_ => 4, _ => 4,
}; };
} }
@ -172,7 +172,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
let _ = match 42 { let _ = match 42 {
42 => 1, 42 => 1,
a if a > 0 => 2, a if a > 0 => 2,
10...15 => 3, 10..=15 => 3,
_ => 4, _ => 4,
}; };
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -15,7 +15,7 @@ fn main() {
let _ = (0..1).step_by(1); let _ = (0..1).step_by(1);
let _ = (1..).step_by(0); let _ = (1..).step_by(0);
let _ = (1...2).step_by(0); let _ = (1..=2).step_by(0);
let x = 0..1; let x = 0..1;
let _ = x.step_by(0); 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 error: Iterator::step_by(0) will panic at runtime
--> $DIR/range.rs:18:13 --> $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 error: Iterator::step_by(0) will panic at runtime