Skip to content

Commit 38fabcb

Browse files
committed
tests: fix formatting and update test output
fix script one last time™
1 parent 84ee884 commit 38fabcb

12 files changed

+42
-41
lines changed

ci/base-tests.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,10 @@ cd ..
3535
./util/dev update_lints --check
3636
cargo +nightly fmt --all -- --check
3737

38-
39-
40-
4138
# make sure tests are formatted
4239

4340
# some lints are sensitive to formatting, exclude some files
44-
tests_need_reformatting=false
41+
tests_need_reformatting="false"
4542
# switch to nightly
4643
rustup default nightly
4744
# avoid loop spam and allow cmds with exit status != 0
@@ -51,13 +48,13 @@ for file in `find tests -not -path "tests/ui/methods.rs" -not -path "tests/ui/fo
5148
rustfmt ${file} --check
5249
if [ $? -ne 0 ]; then
5350
echo "${file} needs reformatting!"
54-
tests_need_reformatting=true
51+
tests_need_reformatting="true"
5552
fi
5653
done
5754

5855
set -ex # reset
5956

60-
if [ ${tests_need_reformatting} ] ; then
57+
if [ "${tests_need_reformatting}" == "true" ] ; then
6158
echo "Tests need reformatting!"
6259
exit 2
6360
fi

tests/ui/cast_alignment.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
//! Test casts for alignment issues
1111
12-
1312
#![feature(rustc_private)]
1413
extern crate libc;
1514

tests/ui/cast_alignment.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
error: casting from `*const u8` to a more-strictly-aligned pointer (`*const u16`)
2-
--> $DIR/cast_alignment.rs:22:5
2+
--> $DIR/cast_alignment.rs:21:5
33
|
4-
22 | (&1u8 as *const u8) as *const u16;
4+
21 | (&1u8 as *const u8) as *const u16;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::cast-ptr-alignment` implied by `-D warnings`
88

99
error: casting from `*mut u8` to a more-strictly-aligned pointer (`*mut u16`)
10-
--> $DIR/cast_alignment.rs:23:5
10+
--> $DIR/cast_alignment.rs:22:5
1111
|
12-
23 | (&mut 1u8 as *mut u8) as *mut u16;
12+
22 | (&mut 1u8 as *mut u8) as *mut u16;
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1414

1515
error: aborting due to 2 previous errors

tests/ui/implicit_return.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ fn test_loop_with_nests() -> bool {
5656
loop {
5757
if true {
5858
break true;
59-
}
60-
else {
59+
} else {
6160
let _ = true;
6261
}
6362
}

tests/ui/implicit_return.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ error: missing return statement
4949
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
5050

5151
error: missing return statement
52-
--> $DIR/implicit_return.rs:68:18
52+
--> $DIR/implicit_return.rs:67:18
5353
|
54-
68 | let _ = || { true };
54+
67 | let _ = || { true };
5555
| ^^^^ help: add `return` as shown: `return true`
5656

5757
error: missing return statement
58-
--> $DIR/implicit_return.rs:69:16
58+
--> $DIR/implicit_return.rs:68:16
5959
|
60-
69 | let _ = || true;
60+
68 | let _ = || true;
6161
| ^^^^ help: add `return` as shown: `return true`
6262

6363
error: aborting due to 10 previous errors

tests/ui/new_without_default.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,18 @@ pub struct Allow(Foo);
143143

144144
impl Allow {
145145
#[allow(clippy::new_without_default)]
146-
pub fn new() -> Self { unimplemented!() }
146+
pub fn new() -> Self {
147+
unimplemented!()
148+
}
147149
}
148150

149151
pub struct AllowDerive;
150152

151153
impl AllowDerive {
152154
#[allow(clippy::new_without_default_derive)]
153-
pub fn new() -> Self { unimplemented!() }
155+
pub fn new() -> Self {
156+
unimplemented!()
157+
}
154158
}
155159

156160
fn main() {}

tests/ui/partialeq_ne_impl.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ impl PartialEq for Foo {
2323
struct Bar;
2424

2525
impl PartialEq for Bar {
26-
fn eq(&self, _: &Bar) -> bool { true }
26+
fn eq(&self, _: &Bar) -> bool {
27+
true
28+
}
2729
#[allow(clippy::partialeq_ne_impl)]
28-
fn ne(&self, _: &Bar) -> bool { false }
30+
fn ne(&self, _: &Bar) -> bool {
31+
false
32+
}
2933
}
3034

3135
fn main() {}

tests/ui/redundant_field_names.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ fn main() {
7070
}
7171

7272
fn issue_3476() {
73-
fn foo<T>() {
74-
}
73+
fn foo<T>() {}
7574

7675
struct S {
7776
foo: fn(),

tests/ui/unused_io_amount.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
use std::io;
1414

15-
1615
fn try_macro<T: io::Read + io::Write>(s: &mut T) -> io::Result<()> {
1716
try!(s.write(b"test"));
1817
let mut buf = [0u8; 4];

tests/ui/unused_io_amount.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
error: handle written amount returned or use `Write::write_all` instead
2-
--> $DIR/unused_io_amount.rs:17:5
2+
--> $DIR/unused_io_amount.rs:16:5
33
|
4-
17 | try!(s.write(b"test"));
4+
16 | try!(s.write(b"test"));
55
| ^^^^^^^^^^^^^^^^^^^^^^^
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
11-
--> $DIR/unused_io_amount.rs:19:5
11+
--> $DIR/unused_io_amount.rs:18:5
1212
|
13-
19 | try!(s.read(&mut buf));
13+
18 | try!(s.read(&mut buf));
1414
| ^^^^^^^^^^^^^^^^^^^^^^^
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

1818
error: handle written amount returned or use `Write::write_all` instead
19-
--> $DIR/unused_io_amount.rs:24:5
19+
--> $DIR/unused_io_amount.rs:23:5
2020
|
21-
24 | s.write(b"test")?;
21+
23 | s.write(b"test")?;
2222
| ^^^^^^^^^^^^^^^^^
2323

2424
error: handle read amount returned or use `Read::read_exact` instead
25-
--> $DIR/unused_io_amount.rs:26:5
25+
--> $DIR/unused_io_amount.rs:25:5
2626
|
27-
26 | s.read(&mut buf)?;
27+
25 | s.read(&mut buf)?;
2828
| ^^^^^^^^^^^^^^^^^
2929

3030
error: handle written amount returned or use `Write::write_all` instead
31-
--> $DIR/unused_io_amount.rs:31:5
31+
--> $DIR/unused_io_amount.rs:30:5
3232
|
33-
31 | s.write(b"test").unwrap();
33+
30 | s.write(b"test").unwrap();
3434
| ^^^^^^^^^^^^^^^^^^^^^^^^^
3535

3636
error: handle read amount returned or use `Read::read_exact` instead
37-
--> $DIR/unused_io_amount.rs:33:5
37+
--> $DIR/unused_io_amount.rs:32:5
3838
|
39-
33 | s.read(&mut buf).unwrap();
39+
32 | s.read(&mut buf).unwrap();
4040
| ^^^^^^^^^^^^^^^^^^^^^^^^^
4141

4242
error: aborting due to 6 previous errors

tests/ui/vec_box_sized.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
struct SizedStruct {
2-
_a: i32,
2+
_a: i32,
33
}
44

55
struct UnsizedStruct {
6-
_a: [i32],
6+
_a: [i32],
77
}
88

99
struct StructWithVecBox {
10-
sized_type: Vec<Box<SizedStruct>>,
10+
sized_type: Vec<Box<SizedStruct>>,
1111
}
1212

1313
struct StructWithVecBoxButItsUnsized {
14-
unsized_type: Vec<Box<UnsizedStruct>>,
14+
unsized_type: Vec<Box<UnsizedStruct>>,
1515
}
1616

1717
fn main() {}

tests/ui/vec_box_sized.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: `Vec<T>` is already on the heap, the boxing is unnecessary.
2-
--> $DIR/vec_box_sized.rs:10:14
2+
--> $DIR/vec_box_sized.rs:10:17
33
|
44
10 | sized_type: Vec<Box<SizedStruct>>,
55
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `Vec<SizedStruct>`

0 commit comments

Comments
 (0)