]> git.lizzy.rs Git - rust.git/commitdiff
tests: fix formatting and update test output
authorMatthias Krüger <matthias.krueger@famsik.de>
Thu, 27 Dec 2018 15:17:45 +0000 (16:17 +0100)
committerMatthias Krüger <matthias.krueger@famsik.de>
Thu, 27 Dec 2018 16:03:53 +0000 (17:03 +0100)
fix script one last time™

12 files changed:
ci/base-tests.sh
tests/ui/cast_alignment.rs
tests/ui/cast_alignment.stderr
tests/ui/implicit_return.rs
tests/ui/implicit_return.stderr
tests/ui/new_without_default.rs
tests/ui/partialeq_ne_impl.rs
tests/ui/redundant_field_names.rs
tests/ui/unused_io_amount.rs
tests/ui/unused_io_amount.stderr
tests/ui/vec_box_sized.rs
tests/ui/vec_box_sized.stderr

index 377f6957746921f0922df77dbfda91c954288573..b69e86ad3ac50f9df6700f96c433101321edfef3 100755 (executable)
@@ -35,13 +35,10 @@ cd ..
 ./util/dev update_lints --check
 cargo +nightly fmt --all -- --check
 
-
-
-
 # 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
@@ -51,13 +48,13 @@ for file in `find tests -not -path "tests/ui/methods.rs" -not -path "tests/ui/fo
   rustfmt ${file} --check
   if [ $? -ne 0 ]; then
     echo "${file} needs reformatting!"
-    tests_need_reformatting=true
+    tests_need_reformatting="true"
   fi
 done
 
 set -ex # reset
 
-if [ ${tests_need_reformatting} ] ; then
+if [ "${tests_need_reformatting}" == "true" ] ; then
     echo "Tests need reformatting!"
     exit 2
 fi
index 77f50b3add29bbbe93ce350a1bea5d4f2a905f77..dba19dfd0238444fa326fcdc079b6fab2b1d9523 100644 (file)
@@ -9,7 +9,6 @@
 
 //! Test casts for alignment issues
 
-
 #![feature(rustc_private)]
 extern crate libc;
 
index 1c7d53c3ce7083bc2825ec1477e9b0ec092d3695..1db26c197257abe85f8bcba438b7c5b82f2eead1 100644 (file)
@@ -1,15 +1,15 @@
 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`)
-  --> $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
index 9fb30135231cc5a24d59b351aa554029fe5bbfd6..46ead9bf0c578f019ec1af5affff38d9f3305e03 100644 (file)
@@ -56,8 +56,7 @@ fn test_loop_with_nests() -> bool {
     loop {
         if true {
             break true;
-        }
-        else {
+        } else {
             let _ = true;
         }
     }
index b3562b67034f164081e530e491682396094676ff..3c124eb3357486e06541a03b06f180b6c79c26a2 100644 (file)
@@ -49,15 +49,15 @@ 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
-  --> $DIR/implicit_return.rs:69:16
+  --> $DIR/implicit_return.rs:68:16
    |
-69 |     let _ = || true;
+68 |     let _ = || true;
    |                ^^^^ help: add `return` as shown: `return true`
 
 error: aborting due to 10 previous errors
index 2e715a6f8ba8631c03f7f5b09ea45224e814dfbd..efb8904dc97110737904721e17c9d7a3b478b507 100644 (file)
@@ -143,14 +143,18 @@ pub fn new() -> Self {
 
 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 fn new() -> Self { unimplemented!() }
+    pub fn new() -> Self {
+        unimplemented!()
+    }
 }
 
 fn main() {}
index fabeee24b305e083716a297458fec3e5155f87d1..e1e0413fceacd8b7512ba7262cee18d95b9ccd81 100644 (file)
@@ -23,9 +23,13 @@ fn ne(&self, _: &Foo) -> bool {
 struct Bar;
 
 impl PartialEq for Bar {
-    fn eq(&self, _: &Bar) -> bool { true }
+    fn eq(&self, _: &Bar) -> bool {
+        true
+    }
     #[allow(clippy::partialeq_ne_impl)]
-    fn ne(&self, _: &Bar) -> bool { false }
+    fn ne(&self, _: &Bar) -> bool {
+        false
+    }
 }
 
 fn main() {}
index 3d727ee6e6a1195cca7c6698ca106a4b8accba7b..60569372e5d71af0780a9cd2f77d8a5b4ba3b4ea 100644 (file)
@@ -70,8 +70,7 @@ fn main() {
 }
 
 fn issue_3476() {
-    fn foo<T>() {
-    }
+    fn foo<T>() {}
 
     struct S {
         foo: fn(),
index 0ec8ce57ad7f8fdd4c889400c376d19ddd27f12b..4e72152724978ef241e697fee74ed888fcaca5b0 100644 (file)
@@ -12,7 +12,6 @@
 
 use std::io;
 
-
 fn try_macro<T: io::Read + io::Write>(s: &mut T) -> io::Result<()> {
     try!(s.write(b"test"));
     let mut buf = [0u8; 4];
index f7b9b3615020020612cca6fa7b18b1cd236c416b..200e441025ef606a9bb47f65ecdbddc83bca3449 100644 (file)
@@ -1,42 +1,42 @@
 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
-  --> $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
-  --> $DIR/unused_io_amount.rs:24:5
+  --> $DIR/unused_io_amount.rs:23:5
    |
-24 |     s.write(b"test")?;
+23 |     s.write(b"test")?;
    |     ^^^^^^^^^^^^^^^^^
 
 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
    |
-26 |     s.read(&mut buf)?;
+25 |     s.read(&mut buf)?;
    |     ^^^^^^^^^^^^^^^^^
 
 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
-  --> $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
index d740f95edfe27fbf4e32223ca8a1de8358b1b4c7..884761675fce5c1999ddd2db8ec8143b0ef5da3d 100644 (file)
@@ -1,17 +1,17 @@
 struct SizedStruct {
-       _a: i32,
+    _a: i32,
 }
 
 struct UnsizedStruct {
-       _a: [i32],
+    _a: [i32],
 }
 
 struct StructWithVecBox {
-       sized_type: Vec<Box<SizedStruct>>,
+    sized_type: Vec<Box<SizedStruct>>,
 }
 
 struct StructWithVecBoxButItsUnsized {
-       unsized_type: Vec<Box<UnsizedStruct>>,
+    unsized_type: Vec<Box<UnsizedStruct>>,
 }
 
 fn main() {}
index 7f4bdfb5aed95a1ca477fa42bd2d376a60ea8ef7..f085fdad42950d534bc039263672b7d697a297be 100644 (file)
@@ -1,5 +1,5 @@
 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>`