about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-06-03 17:35:56 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-06-04 14:15:06 +1000
commitc6fb703c05a47a7f20c59c5315fe704c536084d0 (patch)
tree08d610a0b2d7fb99c745ae61f36d3cb685b62094
parent98d65d62c511777d6372ae0115d40f82d0a42857 (diff)
downloadrust-c6fb703c05a47a7f20c59c5315fe704c536084d0.tar.gz
rust-c6fb703c05a47a7f20c59c5315fe704c536084d0.zip
rustfmt `tests/rustdoc-js/`.
-rw-r--r--rustfmt.toml1
-rw-r--r--tests/rustdoc-js/assoc-type-backtrack.rs21
-rw-r--r--tests/rustdoc-js/assoc-type-loop.rs9
-rw-r--r--tests/rustdoc-js/auxiliary/interner.rs67
-rw-r--r--tests/rustdoc-js/doc-alias.rs6
-rw-r--r--tests/rustdoc-js/enum-variant-not-type.rs10
-rw-r--r--tests/rustdoc-js/foreign-type-path.rs3
-rw-r--r--tests/rustdoc-js/full-path-function.rs20
-rw-r--r--tests/rustdoc-js/gat.rs16
-rw-r--r--tests/rustdoc-js/generics-impl.rs7
-rw-r--r--tests/rustdoc-js/generics-trait.rs16
-rw-r--r--tests/rustdoc-js/generics.rs37
-rw-r--r--tests/rustdoc-js/hof.rs8
-rw-r--r--tests/rustdoc-js/macro-search.rs4
-rw-r--r--tests/rustdoc-js/never-search.rs28
-rw-r--r--tests/rustdoc-js/path-maxeditdistance.rs2
-rw-r--r--tests/rustdoc-js/prototype.rs2
-rw-r--r--tests/rustdoc-js/reexport-dedup-macro.rs2
-rw-r--r--tests/rustdoc-js/reexport-dedup-method.rs4
-rw-r--r--tests/rustdoc-js/reexport-dedup.rs4
-rw-r--r--tests/rustdoc-js/reexport.rs2
-rw-r--r--tests/rustdoc-js/reference.rs16
-rw-r--r--tests/rustdoc-js/slice-array.rs16
-rw-r--r--tests/rustdoc-js/struct-like-variant.rs4
-rw-r--r--tests/rustdoc-js/summaries.rs1
-rw-r--r--tests/rustdoc-js/tuple-unit.rs18
-rw-r--r--tests/rustdoc-js/type-parameters.rs20
-rw-r--r--tests/rustdoc-js/where-clause.rs29
28 files changed, 240 insertions, 133 deletions
diff --git a/rustfmt.toml b/rustfmt.toml
index cc032bfe023..79f197b27b1 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -19,7 +19,6 @@ ignore = [
     "/tests/run-make/translation/test.rs", # This test contains syntax errors.
     "/tests/rustdoc/",                # Some have syntax errors, some are whitespace-sensitive.
     "/tests/rustdoc-gui/",            # Some tests are sensitive to source code layout.
-    "/tests/rustdoc-js/",
     "/tests/rustdoc-json/",
     "/tests/rustdoc-js-std/",
     "/tests/rustdoc-ui/",
diff --git a/tests/rustdoc-js/assoc-type-backtrack.rs b/tests/rustdoc-js/assoc-type-backtrack.rs
index c3cdd78c6e1..2dfede9dc38 100644
--- a/tests/rustdoc-js/assoc-type-backtrack.rs
+++ b/tests/rustdoc-js/assoc-type-backtrack.rs
@@ -5,22 +5,27 @@ pub trait MyTrait2<X> {
 pub trait MyTrait {
     type Item;
     fn next(&mut self) -> Option<Self::Item>;
-    fn fold<B, F>(self, init: B, f: F) -> B where
+    fn fold<B, F>(self, init: B, f: F) -> B
+    where
         Self: Sized,
-        F: MyTrait2<(B, Self::Item), Output=B>;
+        F: MyTrait2<(B, Self::Item), Output = B>;
 }
 
 pub struct Cloned<I>(I);
 
-impl<'a, T, I> MyTrait for Cloned<I> where
+impl<'a, T, I> MyTrait for Cloned<I>
+where
     T: 'a + Clone,
-    I: MyTrait<Item = &'a T>
+    I: MyTrait<Item = &'a T>,
 {
     type Item = T;
-    fn next(&mut self) -> Option<Self::Item> { loop {} }
-    fn fold<B, F>(self, init: B, f: F) -> B where
+    fn next(&mut self) -> Option<Self::Item> {
+        loop {}
+    }
+    fn fold<B, F>(self, init: B, f: F) -> B
+    where
         Self: Sized,
-        F: MyTrait2<(B, Self::Item), Output=B>
+        F: MyTrait2<(B, Self::Item), Output = B>,
     {
         loop {}
     }
@@ -32,7 +37,7 @@ pub trait MyFuture {
 
 pub trait MyIntoFuture {
     type Output;
-    type Fut: MyFuture<Output=Self::Output>;
+    type Fut: MyFuture<Output = Self::Output>;
     fn into_future(self) -> Self::Fut;
     fn into_future_2(self, other: Self) -> Self::Fut;
 }
diff --git a/tests/rustdoc-js/assoc-type-loop.rs b/tests/rustdoc-js/assoc-type-loop.rs
index f123c83f50f..09efe8c7be5 100644
--- a/tests/rustdoc-js/assoc-type-loop.rs
+++ b/tests/rustdoc-js/assoc-type-loop.rs
@@ -1,9 +1,9 @@
-#![crate_name="foo"]
+#![crate_name = "foo"]
 
 // reduced from sqlx 0.7.3
 use std::future::Future;
-use std::pin::Pin;
 use std::ops::{Deref, DerefMut};
+use std::pin::Pin;
 pub enum Error {}
 pub trait Acquire<'c> {
     type Database: Database;
@@ -16,7 +16,7 @@ pub trait Connection {
     type Database: Database;
     type Options: ConnectionOptions<Connection = Self>;
     fn begin(
-        &mut self
+        &mut self,
     ) -> Pin<Box<dyn Future<Output = Result<Transaction<'_, Self::Database>, Error>> + Send + '_>>
     where
         Self: Sized;
@@ -28,7 +28,8 @@ pub struct Transaction<'c, DB: Database> {
     _db: &'c DB,
 }
 impl<'t, 'c, DB: Database> Acquire<'t> for &'t mut Transaction<'c, DB>
-    where <DB as Database>::Connection: Send
+where
+    <DB as Database>::Connection: Send,
 {
     type Database = DB;
     type Connection = &'t mut <DB as Database>::Connection;
diff --git a/tests/rustdoc-js/auxiliary/interner.rs b/tests/rustdoc-js/auxiliary/interner.rs
index c95029be9f0..e4e4ff6276d 100644
--- a/tests/rustdoc-js/auxiliary/interner.rs
+++ b/tests/rustdoc-js/auxiliary/interner.rs
@@ -77,17 +77,14 @@ pub trait Interner: Sized {
     type ClosureKind: Copy + Debug + Hash + Eq;
 
     // Required method
-    fn mk_canonical_var_infos(
-        self,
-        infos: &[CanonicalVarInfo<Self>]
-    ) -> Self::CanonicalVars;
+    fn mk_canonical_var_infos(self, infos: &[CanonicalVarInfo<Self>]) -> Self::CanonicalVars;
 }
 
 pub trait DebugWithInfcx<I: Interner>: Debug {
     // Required method
     fn fmt<Infcx: InferCtxtLike<Interner = I>>(
         this: WithInfcx<'_, Infcx, &Self>,
-        f: &mut Formatter<'_>
+        f: &mut Formatter<'_>,
     ) -> std::fmt::Result;
 }
 
@@ -130,11 +127,7 @@ pub struct TypeFlags;
 
 pub trait Ty<I: Interner<Ty = Self>> {
     // Required method
-    fn new_anon_bound(
-        interner: I,
-        debruijn: DebruijnIndex,
-        var: BoundVar
-    ) -> Self;
+    fn new_anon_bound(interner: I, debruijn: DebruijnIndex, var: BoundVar) -> Self;
 }
 
 pub trait PlaceholderLike {
@@ -152,12 +145,7 @@ pub struct BoundVar;
 pub struct ConstKind<I>(std::marker::PhantomData<I>);
 pub trait Const<I: Interner<Const = Self>> {
     // Required method
-    fn new_anon_bound(
-        interner: I,
-        debruijn: DebruijnIndex,
-        var: BoundVar,
-        ty: I::Ty
-    ) -> Self;
+    fn new_anon_bound(interner: I, debruijn: DebruijnIndex, var: BoundVar, ty: I::Ty) -> Self;
 }
 
 pub trait ConstTy<I: Interner> {
@@ -170,25 +158,28 @@ pub struct DebruijnIndex;
 pub struct RegionKind<I>(std::marker::PhantomData<I>);
 pub trait Region<I: Interner<Region = Self>> {
     // Required method
-    fn new_anon_bound(
-        interner: I,
-        debruijn: DebruijnIndex,
-        var: BoundVar
-    ) -> Self;
+    fn new_anon_bound(interner: I, debruijn: DebruijnIndex, var: BoundVar) -> Self;
 }
 
 pub trait TypeVisitor<I: Interner>: Sized {
     type Result: VisitorResult = ();
 
     // Provided methods
-    fn visit_binder<T: TypeVisitable<I>>(
-        &mut self,
-        t: &I::Binder<T>
-    ) -> Self::Result { unimplemented!() }
-    fn visit_ty(&mut self, t: I::Ty) -> Self::Result { unimplemented!() }
-    fn visit_region(&mut self, _r: I::Region) -> Self::Result { unimplemented!() }
-    fn visit_const(&mut self, c: I::Const) -> Self::Result { unimplemented!() }
-    fn visit_predicate(&mut self, p: I::Predicate) -> Self::Result { unimplemented!() }
+    fn visit_binder<T: TypeVisitable<I>>(&mut self, t: &I::Binder<T>) -> Self::Result {
+        unimplemented!()
+    }
+    fn visit_ty(&mut self, t: I::Ty) -> Self::Result {
+        unimplemented!()
+    }
+    fn visit_region(&mut self, _r: I::Region) -> Self::Result {
+        unimplemented!()
+    }
+    fn visit_const(&mut self, c: I::Const) -> Self::Result {
+        unimplemented!()
+    }
+    fn visit_predicate(&mut self, p: I::Predicate) -> Self::Result {
+        unimplemented!()
+    }
 }
 
 pub trait VisitorResult {
@@ -206,7 +197,9 @@ impl VisitorResult for () {
     fn output() -> Self {}
     fn from_residual(_: Self::Residual) -> Self {}
     fn from_branch(_: ControlFlow<Self::Residual>) -> Self {}
-    fn branch(self) -> ControlFlow<Self::Residual> { ControlFlow::Continue(()) }
+    fn branch(self) -> ControlFlow<Self::Residual> {
+        ControlFlow::Continue(())
+    }
 }
 
 pub struct WithInfcx<'a, Infcx: InferCtxtLike, T> {
@@ -221,24 +214,18 @@ pub trait InferCtxtLike {
     fn interner(&self) -> Self::Interner;
     fn universe_of_ty(&self, ty: TyVid) -> Option<UniverseIndex>;
     fn root_ty_var(&self, vid: TyVid) -> TyVid;
-    fn probe_ty_var(
-        &self,
-        vid: TyVid
-    ) -> Option<<Self::Interner as Interner>::Ty>;
+    fn probe_ty_var(&self, vid: TyVid) -> Option<<Self::Interner as Interner>::Ty>;
     fn universe_of_lt(
         &self,
-        lt: <Self::Interner as Interner>::InferRegion
+        lt: <Self::Interner as Interner>::InferRegion,
     ) -> Option<UniverseIndex>;
     fn opportunistic_resolve_lt_var(
         &self,
-        vid: <Self::Interner as Interner>::InferRegion
+        vid: <Self::Interner as Interner>::InferRegion,
     ) -> Option<<Self::Interner as Interner>::Region>;
     fn universe_of_ct(&self, ct: ConstVid) -> Option<UniverseIndex>;
     fn root_ct_var(&self, vid: ConstVid) -> ConstVid;
-    fn probe_ct_var(
-        &self,
-        vid: ConstVid
-    ) -> Option<<Self::Interner as Interner>::Const>;
+    fn probe_ct_var(&self, vid: ConstVid) -> Option<<Self::Interner as Interner>::Const>;
 }
 
 pub struct TyVid;
diff --git a/tests/rustdoc-js/doc-alias.rs b/tests/rustdoc-js/doc-alias.rs
index 750b7b757bc..453b55c956c 100644
--- a/tests/rustdoc-js/doc-alias.rs
+++ b/tests/rustdoc-js/doc-alias.rs
@@ -16,7 +16,9 @@ impl Trait for Struct {
     const AssociatedConst: i32 = 12;
 
     #[doc(alias = "ImplTraitFunction")]
-    fn function() -> Self::Target { 0 }
+    fn function() -> Self::Target {
+        0
+    }
 }
 
 #[doc(alias = "EnumItem")]
@@ -71,5 +73,5 @@ impl Union {
 #[doc(alias = "MacroItem")]
 #[macro_export]
 macro_rules! Macro {
-    () => {}
+    () => {};
 }
diff --git a/tests/rustdoc-js/enum-variant-not-type.rs b/tests/rustdoc-js/enum-variant-not-type.rs
index 421bddf6289..f0facd63cfc 100644
--- a/tests/rustdoc-js/enum-variant-not-type.rs
+++ b/tests/rustdoc-js/enum-variant-not-type.rs
@@ -5,10 +5,14 @@ pub trait MyTrait {
     fn not_appearing(&self) -> Option<&Self::T>;
 }
 
-pub fn my_fn<X>(t: X) -> X { t }
+pub fn my_fn<X>(t: X) -> X {
+    t
+}
 
 pub trait AutoCorrectConfounder {
     type InsertUnnecessarilyLongTypeNameHere;
-    fn assoc_type_acts_like_generic(&self, x: &Self::InsertUnnecessarilyLongTypeNameHere)
-        -> Option<&Self::InsertUnnecessarilyLongTypeNameHere>;
+    fn assoc_type_acts_like_generic(
+        &self,
+        x: &Self::InsertUnnecessarilyLongTypeNameHere,
+    ) -> Option<&Self::InsertUnnecessarilyLongTypeNameHere>;
 }
diff --git a/tests/rustdoc-js/foreign-type-path.rs b/tests/rustdoc-js/foreign-type-path.rs
index 83400104ea7..f9228c7b9ac 100644
--- a/tests/rustdoc-js/foreign-type-path.rs
+++ b/tests/rustdoc-js/foreign-type-path.rs
@@ -2,12 +2,11 @@
 
 pub mod aaaaaaa {
 
-    extern {
+    extern "C" {
         pub type MyForeignType;
     }
 
     impl MyForeignType {
         pub fn my_method() {}
     }
-
 }
diff --git a/tests/rustdoc-js/full-path-function.rs b/tests/rustdoc-js/full-path-function.rs
index 8dcc3f2b69d..a1a9220654d 100644
--- a/tests/rustdoc-js/full-path-function.rs
+++ b/tests/rustdoc-js/full-path-function.rs
@@ -2,16 +2,26 @@ pub mod sac {
     pub struct Sac;
 
     impl Sac {
-        pub fn len(&self) -> usize { 0 }
+        pub fn len(&self) -> usize {
+            0
+        }
     }
 }
 
 pub mod b {
     pub struct Sac;
     impl Sac {
-        pub fn len(&self) -> usize { 0 }
-        pub fn bar(&self, w: u32) -> usize { 0 }
-        pub fn bar2(&self, w: u32) -> u32 { 0 }
-        pub fn string(w: String) -> u32 { 0 }
+        pub fn len(&self) -> usize {
+            0
+        }
+        pub fn bar(&self, w: u32) -> usize {
+            0
+        }
+        pub fn bar2(&self, w: u32) -> u32 {
+            0
+        }
+        pub fn string(w: String) -> u32 {
+            0
+        }
     }
 }
diff --git a/tests/rustdoc-js/gat.rs b/tests/rustdoc-js/gat.rs
index b4861cc683f..7a2b5551114 100644
--- a/tests/rustdoc-js/gat.rs
+++ b/tests/rustdoc-js/gat.rs
@@ -2,7 +2,15 @@ pub trait Foo {
     type Assoc<T>;
 }
 
-pub fn sample<X: Foo<Assoc<u8> = u8>>(_: X) -> u32 { loop {} }
-pub fn synergy(_: impl Foo<Assoc<u8> = u8>) -> ! { loop {} }
-pub fn consider(_: impl Foo<Assoc<u8> = u32>) -> bool { loop {} }
-pub fn integrate<T>(_: impl Foo<Assoc<T> = T>) -> T { loop {} }
+pub fn sample<X: Foo<Assoc<u8> = u8>>(_: X) -> u32 {
+    loop {}
+}
+pub fn synergy(_: impl Foo<Assoc<u8> = u8>) -> ! {
+    loop {}
+}
+pub fn consider(_: impl Foo<Assoc<u8> = u32>) -> bool {
+    loop {}
+}
+pub fn integrate<T>(_: impl Foo<Assoc<T> = T>) -> T {
+    loop {}
+}
diff --git a/tests/rustdoc-js/generics-impl.rs b/tests/rustdoc-js/generics-impl.rs
index 696218021d5..27d44fdd7e9 100644
--- a/tests/rustdoc-js/generics-impl.rs
+++ b/tests/rustdoc-js/generics-impl.rs
@@ -1,4 +1,4 @@
-use std::io::{Result as IoResult, Read};
+use std::io::{Read, Result as IoResult};
 
 pub struct Aaaaaaa;
 
@@ -29,7 +29,10 @@ impl<T: Read> Ddddddd<T> {
     pub fn ggggggg(self) -> u64 {
         1
     }
-    pub fn hhhhhhh() -> Self where T: Default {
+    pub fn hhhhhhh() -> Self
+    where
+        T: Default,
+    {
         Ddddddd(T::default())
     }
 }
diff --git a/tests/rustdoc-js/generics-trait.rs b/tests/rustdoc-js/generics-trait.rs
index 20db117ccd5..58c86361e41 100644
--- a/tests/rustdoc-js/generics-trait.rs
+++ b/tests/rustdoc-js/generics-trait.rs
@@ -1,8 +1,16 @@
 pub trait SomeTrait {}
 pub trait OtherThingxxxxxxxx {}
 
-pub fn alef<T: OtherThingxxxxxxxx>() -> Result<T, ()> { loop {} }
-pub fn bet<T: SomeTrait>() -> Result<T, ()> { loop {} }
+pub fn alef<T: OtherThingxxxxxxxx>() -> Result<T, ()> {
+    loop {}
+}
+pub fn bet<T: SomeTrait>() -> Result<T, ()> {
+    loop {}
+}
 
-pub fn alpha<T: OtherThingxxxxxxxx>(_param: Result<T, ()>) { loop {} }
-pub fn beta<T: SomeTrait>(_param: Result<T, ()>) { loop {} }
+pub fn alpha<T: OtherThingxxxxxxxx>(_param: Result<T, ()>) {
+    loop {}
+}
+pub fn beta<T: SomeTrait>(_param: Result<T, ()>) {
+    loop {}
+}
diff --git a/tests/rustdoc-js/generics.rs b/tests/rustdoc-js/generics.rs
index 055c51c7ec5..c3ca1366614 100644
--- a/tests/rustdoc-js/generics.rs
+++ b/tests/rustdoc-js/generics.rs
@@ -3,26 +3,41 @@ pub struct Q;
 pub struct R<T>(T);
 
 // returns test
-pub fn alef() -> R<P> { loop {} }
-pub fn bet() -> R<Q> { loop {} }
+pub fn alef() -> R<P> {
+    loop {}
+}
+pub fn bet() -> R<Q> {
+    loop {}
+}
 
 // in_args test
-pub fn alpha(_x: R<P>) { loop {} }
-pub fn beta(_x: R<Q>) { loop {} }
+pub fn alpha(_x: R<P>) {
+    loop {}
+}
+pub fn beta(_x: R<Q>) {
+    loop {}
+}
 
 // test case with multiple appearances of the same type
-pub struct ExtraCreditStructMulti<T, U> { t: T, u: U }
+pub struct ExtraCreditStructMulti<T, U> {
+    t: T,
+    u: U,
+}
 pub struct ExtraCreditInnerMulti {}
 pub fn extracreditlabhomework(
-    _param: ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>
-) { loop {} }
-pub fn redherringmatchforextracredit(
-    _param: ExtraCreditStructMulti<ExtraCreditInnerMulti, ()>
-) { loop {} }
+    _param: ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>,
+) {
+    loop {}
+}
+pub fn redherringmatchforextracredit(_param: ExtraCreditStructMulti<ExtraCreditInnerMulti, ()>) {
+    loop {}
+}
 
 pub trait TraitCat {}
 pub trait TraitDog {}
 
 pub fn gamma<T: TraitCat + TraitDog>(t: T) {}
 
-pub fn super_soup(s: Result<String, i32>) -> Result<String, i32> { s }
+pub fn super_soup(s: Result<String, i32>) -> Result<String, i32> {
+    s
+}
diff --git a/tests/rustdoc-js/hof.rs b/tests/rustdoc-js/hof.rs
index 4d2c6e331ca..e4d550250e8 100644
--- a/tests/rustdoc-js/hof.rs
+++ b/tests/rustdoc-js/hof.rs
@@ -4,9 +4,9 @@ pub struct First<T>(T);
 pub struct Second<T>(T);
 pub struct Third<T>(T);
 
-pub fn fn_ptr(_: fn (First<u32>) -> !, _: bool) {}
-pub fn fn_once(_: impl FnOnce (Second<u32>) -> !, _: u8) {}
-pub fn fn_mut(_: impl FnMut (Third<u32>) -> !, _: i8) {}
-pub fn fn_(_: impl Fn (u32) -> !, _: char) {}
+pub fn fn_ptr(_: fn(First<u32>) -> !, _: bool) {}
+pub fn fn_once(_: impl FnOnce(Second<u32>) -> !, _: u8) {}
+pub fn fn_mut(_: impl FnMut(Third<u32>) -> !, _: i8) {}
+pub fn fn_(_: impl Fn(u32) -> !, _: char) {}
 
 pub fn multiple(_: impl Fn(&'static str, &'static str) -> i8) {}
diff --git a/tests/rustdoc-js/macro-search.rs b/tests/rustdoc-js/macro-search.rs
index dc397490cf5..7fa9cbc4ab2 100644
--- a/tests/rustdoc-js/macro-search.rs
+++ b/tests/rustdoc-js/macro-search.rs
@@ -1,10 +1,10 @@
 #[macro_export]
 macro_rules! abracadabra {
-    () => {}
+    () => {};
 }
 #[macro_export]
 macro_rules! abracadabra_b {
-    () => {}
+    () => {};
 }
 pub fn abracadabra() {}
 pub fn abracadabra_c() {}
diff --git a/tests/rustdoc-js/never-search.rs b/tests/rustdoc-js/never-search.rs
index 299b4660dae..800f9ead8b3 100644
--- a/tests/rustdoc-js/never-search.rs
+++ b/tests/rustdoc-js/never-search.rs
@@ -3,11 +3,27 @@
 #[allow(nonstandard_style)]
 pub struct never;
 
-pub fn loops() -> ! { loop {} }
-pub fn returns() -> never { never }
+pub fn loops() -> ! {
+    loop {}
+}
+pub fn returns() -> never {
+    never
+}
 
-pub fn impossible(x: !) { match x {} }
-pub fn uninteresting(x: never) { match x { never => {} } }
+pub fn impossible(x: !) {
+    match x {}
+}
+pub fn uninteresting(x: never) {
+    match x {
+        never => {}
+    }
+}
 
-pub fn box_impossible(x: Box<!>) { match *x {} }
-pub fn box_uninteresting(x: Box<never>) { match *x { never => {} } }
+pub fn box_impossible(x: Box<!>) {
+    match *x {}
+}
+pub fn box_uninteresting(x: Box<never>) {
+    match *x {
+        never => {}
+    }
+}
diff --git a/tests/rustdoc-js/path-maxeditdistance.rs b/tests/rustdoc-js/path-maxeditdistance.rs
index 3861280d59b..88af4f48774 100644
--- a/tests/rustdoc-js/path-maxeditdistance.rs
+++ b/tests/rustdoc-js/path-maxeditdistance.rs
@@ -1,3 +1,3 @@
-#![crate_name="abracadabra"]
+#![crate_name = "abracadabra"]
 
 pub struct HocusPocusPrestidigitation;
diff --git a/tests/rustdoc-js/prototype.rs b/tests/rustdoc-js/prototype.rs
index 5f6d73cc196..77553561238 100644
--- a/tests/rustdoc-js/prototype.rs
+++ b/tests/rustdoc-js/prototype.rs
@@ -1,4 +1,4 @@
 // The alias needed to be there to reproduce the bug
 // that used to be here.
-#[doc(alias="other_alias")]
+#[doc(alias = "other_alias")]
 pub fn something_else() {}
diff --git a/tests/rustdoc-js/reexport-dedup-macro.rs b/tests/rustdoc-js/reexport-dedup-macro.rs
index 3d18da3951c..f70b9c3d733 100644
--- a/tests/rustdoc-js/reexport-dedup-macro.rs
+++ b/tests/rustdoc-js/reexport-dedup-macro.rs
@@ -1,5 +1,5 @@
 //@ aux-crate: macro_in_module=macro-in-module.rs
-#![crate_name="foo"]
+#![crate_name = "foo"]
 extern crate macro_in_module;
 
 // Test case based on the relationship between alloc and std.
diff --git a/tests/rustdoc-js/reexport-dedup-method.rs b/tests/rustdoc-js/reexport-dedup-method.rs
index 5dbd66e9c8e..c00df094d7a 100644
--- a/tests/rustdoc-js/reexport-dedup-method.rs
+++ b/tests/rustdoc-js/reexport-dedup-method.rs
@@ -1,5 +1,5 @@
 // This test enforces that the (renamed) reexports are present in the search results.
-#![crate_name="foo"]
+#![crate_name = "foo"]
 
 pub mod fmt {
     pub struct Subscriber;
@@ -14,5 +14,5 @@ mod foo {
     }
 }
 
-pub use foo::AnotherOne;
 pub use fmt::Subscriber;
+pub use foo::AnotherOne;
diff --git a/tests/rustdoc-js/reexport-dedup.rs b/tests/rustdoc-js/reexport-dedup.rs
index 40aea963303..83c23d5c366 100644
--- a/tests/rustdoc-js/reexport-dedup.rs
+++ b/tests/rustdoc-js/reexport-dedup.rs
@@ -1,5 +1,5 @@
 // This test enforces that the (renamed) reexports are present in the search results.
-#![crate_name="foo"]
+#![crate_name = "foo"]
 
 pub mod fmt {
     pub struct Subscriber;
@@ -8,5 +8,5 @@ mod foo {
     pub struct AnotherOne;
 }
 
-pub use foo::AnotherOne;
 pub use fmt::Subscriber;
+pub use foo::AnotherOne;
diff --git a/tests/rustdoc-js/reexport.rs b/tests/rustdoc-js/reexport.rs
index d51b7fb369c..0b3718cd9a3 100644
--- a/tests/rustdoc-js/reexport.rs
+++ b/tests/rustdoc-js/reexport.rs
@@ -9,5 +9,5 @@ mod foo {
     pub struct AnotherOne;
 }
 
-pub use foo::AnotherOne;
 pub use fmt::Subscriber as FmtSubscriber;
+pub use foo::AnotherOne;
diff --git a/tests/rustdoc-js/reference.rs b/tests/rustdoc-js/reference.rs
index 3a0a23c65d5..93b2a6df8e6 100644
--- a/tests/rustdoc-js/reference.rs
+++ b/tests/rustdoc-js/reference.rs
@@ -7,13 +7,17 @@ pub fn pinky(input: &usize, manage: usize) {
 pub struct Thumb;
 
 impl Thumb {
-    pub fn up(&self, finger: Thumb) { unimplemented!() }
+    pub fn up(&self, finger: Thumb) {
+        unimplemented!()
+    }
 }
 
 pub enum Index {}
 
 impl Index {
-    pub fn point(self, data: &Index) { unimplemented!() }
+    pub fn point(self, data: &Index) {
+        unimplemented!()
+    }
 }
 
 pub union Ring {
@@ -22,11 +26,15 @@ pub union Ring {
 }
 
 impl Ring {
-    pub fn wear(&mut self, extra: &Ring) { unimplemented!() }
+    pub fn wear(&mut self, extra: &Ring) {
+        unimplemented!()
+    }
 }
 
 extern "C" {
     pub type Middle;
 }
 
-pub fn show(left: &&mut Middle, right: &mut &Middle) { unimplemented!() }
+pub fn show(left: &&mut Middle, right: &mut &Middle) {
+    unimplemented!()
+}
diff --git a/tests/rustdoc-js/slice-array.rs b/tests/rustdoc-js/slice-array.rs
index 15ac4294f3d..e4e34a26fa2 100644
--- a/tests/rustdoc-js/slice-array.rs
+++ b/tests/rustdoc-js/slice-array.rs
@@ -3,12 +3,20 @@ pub struct Q;
 pub struct R<T>(T);
 
 // returns test
-pub fn alef() -> &'static [R<P>] { loop {} }
-pub fn bet() -> R<[Q; 32]> { loop {} }
+pub fn alef() -> &'static [R<P>] {
+    loop {}
+}
+pub fn bet() -> R<[Q; 32]> {
+    loop {}
+}
 
 // in_args test
-pub fn alpha(_x: R<&'static [P]>) { loop {} }
-pub fn beta(_x: [R<Q>; 32]) { loop {} }
+pub fn alpha(_x: R<&'static [P]>) {
+    loop {}
+}
+pub fn beta(_x: [R<Q>; 32]) {
+    loop {}
+}
 
 pub trait TraitCat {}
 pub trait TraitDog {}
diff --git a/tests/rustdoc-js/struct-like-variant.rs b/tests/rustdoc-js/struct-like-variant.rs
index 2f52a319ab9..aafde9957ff 100644
--- a/tests/rustdoc-js/struct-like-variant.rs
+++ b/tests/rustdoc-js/struct-like-variant.rs
@@ -3,6 +3,6 @@
 pub enum Enum {
     Bar {
         /// This is a name.
-        name: String
-    }
+        name: String,
+    },
 }
diff --git a/tests/rustdoc-js/summaries.rs b/tests/rustdoc-js/summaries.rs
index 1ee1c34aa15..9e8fc820245 100644
--- a/tests/rustdoc-js/summaries.rs
+++ b/tests/rustdoc-js/summaries.rs
@@ -1,6 +1,5 @@
 #![crate_type = "lib"]
 #![crate_name = "summaries"]
-
 #![allow(rustdoc::broken_intra_doc_links)]
 
 //! This *summary* has a [link], [`code`], and [`Sidebar2`] intra-doc.
diff --git a/tests/rustdoc-js/tuple-unit.rs b/tests/rustdoc-js/tuple-unit.rs
index 93f9a671cbc..4531545cf6c 100644
--- a/tests/rustdoc-js/tuple-unit.rs
+++ b/tests/rustdoc-js/tuple-unit.rs
@@ -3,16 +3,24 @@ pub struct Q;
 pub struct R<T>(T);
 
 // Checks that tuple and unit both work
-pub fn side_effect() { }
+pub fn side_effect() {}
 
 // Check a non-tuple
-pub fn not_tuple() -> P { loop {} }
+pub fn not_tuple() -> P {
+    loop {}
+}
 
 // Check a 1-tuple
-pub fn one() -> (P,) { loop {} }
+pub fn one() -> (P,) {
+    loop {}
+}
 
 // Check a 2-tuple
-pub fn two() -> (P,P) { loop {} }
+pub fn two() -> (P, P) {
+    loop {}
+}
 
 // Check a nested tuple
-pub fn nest() -> (Q, R<(u32,)>) { loop {} }
+pub fn nest() -> (Q, R<(u32,)>) {
+    loop {}
+}
diff --git a/tests/rustdoc-js/type-parameters.rs b/tests/rustdoc-js/type-parameters.rs
index cda5e26171f..0edbfbea178 100644
--- a/tests/rustdoc-js/type-parameters.rs
+++ b/tests/rustdoc-js/type-parameters.rs
@@ -1,15 +1,23 @@
-#![crate_name="foo"]
+#![crate_name = "foo"]
 
 pub trait Some {}
 impl Some for () {}
 pub trait Other {}
 impl Other for () {}
 
-pub fn alef<T: Some>() -> T { loop {} }
-pub fn alpha() -> impl Some { }
+pub fn alef<T: Some>() -> T {
+    loop {}
+}
+pub fn alpha() -> impl Some {}
 
-pub fn bet<T, U>(t: T) -> U { loop {} }
+pub fn bet<T, U>(t: T) -> U {
+    loop {}
+}
 pub fn beta<T>(t: T) -> T {}
 
-pub fn other<T: Other, U: Other>(t: T, u: U) { loop {} }
-pub fn alternate<T: Other>(t: T, u: T) { loop {} }
+pub fn other<T: Other, U: Other>(t: T, u: U) {
+    loop {}
+}
+pub fn alternate<T: Other>(t: T, u: T) {
+    loop {}
+}
diff --git a/tests/rustdoc-js/where-clause.rs b/tests/rustdoc-js/where-clause.rs
index 56c01019fb6..c0fede1cfd5 100644
--- a/tests/rustdoc-js/where-clause.rs
+++ b/tests/rustdoc-js/where-clause.rs
@@ -4,27 +4,46 @@ pub trait Trait<T> {
     fn thank_you(x: T);
 }
 
-pub fn abracadabra<X>(_: X) where X: Trait<Nested> {}
+pub fn abracadabra<X>(_: X)
+where
+    X: Trait<Nested>,
+{
+}
 
-pub fn alacazam<X>() -> X where X: Trait<Nested> {}
+pub fn alacazam<X>() -> X
+where
+    X: Trait<Nested>,
+{
+}
 
 pub trait T1 {}
 pub trait T2<'a, T> {
     fn please(_: &'a T);
 }
 
-pub fn presto<A, B>(_: A, _: B) where A: T1, B: for <'b> T2<'b, Nested> {}
+pub fn presto<A, B>(_: A, _: B)
+where
+    A: T1,
+    B: for<'b> T2<'b, Nested>,
+{
+}
 
 pub trait Shazam {}
 
-pub fn bippety<X>() -> &'static X where X: Shazam {
+pub fn bippety<X>() -> &'static X
+where
+    X: Shazam,
+{
     panic!()
 }
 
 pub struct Drizzel<T>(T);
 
 impl<T> Drizzel<T> {
-    pub fn boppety(&self) -> &T where T: Shazam {
+    pub fn boppety(&self) -> &T
+    where
+        T: Shazam,
+    {
         panic!();
     }
 }