fix script one last time™
12 files changed:
./util/dev update_lints --check
cargo +nightly fmt --all -- --check
./util/dev update_lints --check
cargo +nightly fmt --all -- --check
# make sure tests are formatted
# some lints are sensitive to formatting, exclude some files
# make sure tests are formatted
# some lints are sensitive to formatting, exclude some files
-tests_need_reformatting=false
+tests_need_reformatting="false"
# switch to nightly
rustup default nightly
# avoid loop spam and allow cmds with exit status != 0
# switch to nightly
rustup default nightly
# avoid loop spam and allow cmds with exit status != 0
rustfmt ${file} --check
if [ $? -ne 0 ]; then
echo "${file} needs reformatting!"
rustfmt ${file} --check
if [ $? -ne 0 ]; then
echo "${file} needs reformatting!"
- tests_need_reformatting=true
+ tests_need_reformatting="true"
-if [ ${tests_need_reformatting} ] ; then
+if [ "${tests_need_reformatting}" == "true" ] ; then
echo "Tests need reformatting!"
exit 2
fi
echo "Tests need reformatting!"
exit 2
fi
//! Test casts for alignment issues
//! Test casts for alignment issues
#![feature(rustc_private)]
extern crate libc;
#![feature(rustc_private)]
extern crate libc;
error: casting from `*const u8` to a more-strictly-aligned pointer (`*const u16`)
error: casting from `*const u8` to a more-strictly-aligned pointer (`*const u16`)
- --> $DIR/cast_alignment.rs:22:5
+ --> $DIR/cast_alignment.rs:21:5
-22 | (&1u8 as *const u8) as *const u16;
+21 | (&1u8 as *const u8) as *const u16;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::cast-ptr-alignment` implied by `-D warnings`
error: casting from `*mut u8` to a more-strictly-aligned pointer (`*mut u16`)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::cast-ptr-alignment` implied by `-D warnings`
error: casting from `*mut u8` to a more-strictly-aligned pointer (`*mut u16`)
- --> $DIR/cast_alignment.rs:23:5
+ --> $DIR/cast_alignment.rs:22:5
-23 | (&mut 1u8 as *mut u8) as *mut u16;
+22 | (&mut 1u8 as *mut u8) as *mut u16;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
loop {
if true {
break true;
loop {
if true {
break true;
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
error: missing return statement
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
error: missing return statement
- --> $DIR/implicit_return.rs:68:18
+ --> $DIR/implicit_return.rs:67:18
-68 | let _ = || { true };
+67 | let _ = || { true };
| ^^^^ help: add `return` as shown: `return true`
error: missing return statement
| ^^^^ help: add `return` as shown: `return true`
error: missing return statement
- --> $DIR/implicit_return.rs:69:16
+ --> $DIR/implicit_return.rs:68:16
| ^^^^ help: add `return` as shown: `return true`
error: aborting due to 10 previous errors
| ^^^^ help: add `return` as shown: `return true`
error: aborting due to 10 previous errors
impl Allow {
#[allow(clippy::new_without_default)]
impl Allow {
#[allow(clippy::new_without_default)]
- pub fn new() -> Self { unimplemented!() }
+ pub fn new() -> Self {
+ unimplemented!()
+ }
}
pub struct AllowDerive;
impl AllowDerive {
#[allow(clippy::new_without_default_derive)]
}
pub struct AllowDerive;
impl AllowDerive {
#[allow(clippy::new_without_default_derive)]
- pub fn new() -> Self { unimplemented!() }
+ pub fn new() -> Self {
+ unimplemented!()
+ }
struct Bar;
impl PartialEq for Bar {
struct Bar;
impl PartialEq for Bar {
- fn eq(&self, _: &Bar) -> bool { true }
+ fn eq(&self, _: &Bar) -> bool {
+ true
+ }
#[allow(clippy::partialeq_ne_impl)]
#[allow(clippy::partialeq_ne_impl)]
- fn ne(&self, _: &Bar) -> bool { false }
+ fn ne(&self, _: &Bar) -> bool {
+ false
+ }
fn try_macro<T: io::Read + io::Write>(s: &mut T) -> io::Result<()> {
try!(s.write(b"test"));
let mut buf = [0u8; 4];
fn try_macro<T: io::Read + io::Write>(s: &mut T) -> io::Result<()> {
try!(s.write(b"test"));
let mut buf = [0u8; 4];
error: handle written amount returned or use `Write::write_all` instead
error: handle written amount returned or use `Write::write_all` instead
- --> $DIR/unused_io_amount.rs:17:5
+ --> $DIR/unused_io_amount.rs:16:5
-17 | try!(s.write(b"test"));
+16 | try!(s.write(b"test"));
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::unused-io-amount` implied by `-D warnings`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: handle read amount returned or use `Read::read_exact` instead
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::unused-io-amount` implied by `-D warnings`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: handle read amount returned or use `Read::read_exact` instead
- --> $DIR/unused_io_amount.rs:19:5
+ --> $DIR/unused_io_amount.rs:18:5
-19 | try!(s.read(&mut buf));
+18 | try!(s.read(&mut buf));
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: handle written amount returned or use `Write::write_all` instead
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: handle written amount returned or use `Write::write_all` instead
- --> $DIR/unused_io_amount.rs:24:5
+ --> $DIR/unused_io_amount.rs:23:5
| ^^^^^^^^^^^^^^^^^
error: handle read amount returned or use `Read::read_exact` instead
| ^^^^^^^^^^^^^^^^^
error: handle read amount returned or use `Read::read_exact` instead
- --> $DIR/unused_io_amount.rs:26:5
+ --> $DIR/unused_io_amount.rs:25:5
| ^^^^^^^^^^^^^^^^^
error: handle written amount returned or use `Write::write_all` instead
| ^^^^^^^^^^^^^^^^^
error: handle written amount returned or use `Write::write_all` instead
- --> $DIR/unused_io_amount.rs:31:5
+ --> $DIR/unused_io_amount.rs:30:5
-31 | s.write(b"test").unwrap();
+30 | s.write(b"test").unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: handle read amount returned or use `Read::read_exact` instead
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: handle read amount returned or use `Read::read_exact` instead
- --> $DIR/unused_io_amount.rs:33:5
+ --> $DIR/unused_io_amount.rs:32:5
-33 | s.read(&mut buf).unwrap();
+32 | s.read(&mut buf).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 6 previous errors
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 6 previous errors
}
struct StructWithVecBox {
}
struct StructWithVecBox {
- sized_type: Vec<Box<SizedStruct>>,
+ sized_type: Vec<Box<SizedStruct>>,
}
struct StructWithVecBoxButItsUnsized {
}
struct StructWithVecBoxButItsUnsized {
- unsized_type: Vec<Box<UnsizedStruct>>,
+ unsized_type: Vec<Box<UnsizedStruct>>,
error: `Vec<T>` is already on the heap, the boxing is unnecessary.
error: `Vec<T>` is already on the heap, the boxing is unnecessary.
- --> $DIR/vec_box_sized.rs:10:14
+ --> $DIR/vec_box_sized.rs:10:17
|
10 | sized_type: Vec<Box<SizedStruct>>,
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `Vec<SizedStruct>`
|
10 | sized_type: Vec<Box<SizedStruct>>,
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `Vec<SizedStruct>`