Skip to content

Commit 5265ab8

Browse files
committed
Fix tests for edition 2018 compatibility
1 parent 434f83a commit 5265ab8

8 files changed

+27
-27
lines changed

tests/ui/cognitive_complexity.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ fn mcarton_sees_all() {
313313
}
314314

315315
#[clippy::cognitive_complexity = "0"]
316-
fn try() -> Result<i32, &'static str> {
316+
fn try_() -> Result<i32, &'static str> {
317317
match 5 {
318318
5 => Ok(5),
319319
_ => return Err("bla"),
@@ -322,14 +322,14 @@ fn try() -> Result<i32, &'static str> {
322322

323323
#[clippy::cognitive_complexity = "0"]
324324
fn try_again() -> Result<i32, &'static str> {
325-
let _ = try!(Ok(42));
326-
let _ = try!(Ok(43));
327-
let _ = try!(Ok(44));
328-
let _ = try!(Ok(45));
329-
let _ = try!(Ok(46));
330-
let _ = try!(Ok(47));
331-
let _ = try!(Ok(48));
332-
let _ = try!(Ok(49));
325+
let _ = r#try!(Ok(42));
326+
let _ = r#try!(Ok(43));
327+
let _ = r#try!(Ok(44));
328+
let _ = r#try!(Ok(45));
329+
let _ = r#try!(Ok(46));
330+
let _ = r#try!(Ok(47));
331+
let _ = r#try!(Ok(48));
332+
let _ = r#try!(Ok(49));
333333
match 5 {
334334
5 => Ok(5),
335335
_ => return Err("bla"),

tests/ui/cognitive_complexity.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ LL | | }
216216
error: the function has a cognitive complexity of 1
217217
--> $DIR/cognitive_complexity.rs:316:1
218218
|
219-
LL | / fn try() -> Result<i32, &'static str> {
219+
LL | / fn try_() -> Result<i32, &'static str> {
220220
LL | | match 5 {
221221
LL | | 5 => Ok(5),
222222
LL | | _ => return Err("bla"),
@@ -230,9 +230,9 @@ error: the function has a cognitive complexity of 1
230230
--> $DIR/cognitive_complexity.rs:324:1
231231
|
232232
LL | / fn try_again() -> Result<i32, &'static str> {
233-
LL | | let _ = try!(Ok(42));
234-
LL | | let _ = try!(Ok(43));
235-
LL | | let _ = try!(Ok(44));
233+
LL | | let _ = r#try!(Ok(42));
234+
LL | | let _ = r#try!(Ok(43));
235+
LL | | let _ = r#try!(Ok(44));
236236
... |
237237
LL | | }
238238
LL | | }

tests/ui/dlist.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use alloc::collections::linked_list::LinkedList;
77

88
trait Foo {
99
type Baz = LinkedList<u8>;
10-
fn foo(LinkedList<u8>);
10+
fn foo(_: LinkedList<u8>);
1111
const BAR: Option<LinkedList<u8>>;
1212
}
1313

tests/ui/dlist.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ LL | type Baz = LinkedList<u8>;
88
= help: a VecDeque might work
99

1010
error: I see you're using a LinkedList! Perhaps you meant some other data structure?
11-
--> $DIR/dlist.rs:10:12
11+
--> $DIR/dlist.rs:10:15
1212
|
13-
LL | fn foo(LinkedList<u8>);
14-
| ^^^^^^^^^^^^^^
13+
LL | fn foo(_: LinkedList<u8>);
14+
| ^^^^^^^^^^^^^^
1515
|
1616
= help: a VecDeque might work
1717

tests/ui/if_same_then_else.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ fn if_same_then_else() -> Result<&'static str, ()> {
215215
};
216216

217217
if true {
218-
try!(Ok("foo"));
218+
r#try!(Ok("foo"));
219219
} else {
220220
//~ ERROR same body as `if` block
221-
try!(Ok("foo"));
221+
r#try!(Ok("foo"));
222222
}
223223

224224
if true {

tests/ui/if_same_then_else.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ error: this `if` has identical blocks
197197
LL | } else {
198198
| ____________^
199199
LL | | //~ ERROR same body as `if` block
200-
LL | | try!(Ok("foo"));
200+
LL | | r#try!(Ok("foo"));
201201
LL | | }
202202
| |_____^
203203
|
@@ -206,7 +206,7 @@ note: same as this
206206
|
207207
LL | if true {
208208
| _____________^
209-
LL | | try!(Ok("foo"));
209+
LL | | r#try!(Ok("foo"));
210210
LL | | } else {
211211
| |_____^
212212

tests/ui/unused_io_amount.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
use std::io;
55

66
fn try_macro<T: io::Read + io::Write>(s: &mut T) -> io::Result<()> {
7-
try!(s.write(b"test"));
7+
r#try!(s.write(b"test"));
88
let mut buf = [0u8; 4];
9-
try!(s.read(&mut buf));
9+
r#try!(s.read(&mut buf));
1010
Ok(())
1111
}
1212

tests/ui/unused_io_amount.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: handle written amount returned or use `Write::write_all` instead
22
--> $DIR/unused_io_amount.rs:7:5
33
|
4-
LL | try!(s.write(b"test"));
5-
| ^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | r#try!(s.write(b"test"));
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::unused-io-amount` implied by `-D warnings`
88
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
99

1010
error: handle read amount returned or use `Read::read_exact` instead
1111
--> $DIR/unused_io_amount.rs:9:5
1212
|
13-
LL | try!(s.read(&mut buf));
14-
| ^^^^^^^^^^^^^^^^^^^^^^^
13+
LL | r#try!(s.read(&mut buf));
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
1515
|
1616
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1717

0 commit comments

Comments
 (0)