about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-06-04 10:03:40 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-06-04 14:15:19 +1000
commit9f16362ab4c584aa737b68326c9859a07293113a (patch)
tree0b8f7b221e7faa3fb3960bafd00ab44059809414
parentc6fb703c05a47a7f20c59c5315fe704c536084d0 (diff)
downloadrust-9f16362ab4c584aa737b68326c9859a07293113a.tar.gz
rust-9f16362ab4c584aa737b68326c9859a07293113a.zip
rustfmt `tests/rustdoc-json/`.
-rw-r--r--rustfmt.toml1
-rw-r--r--tests/rustdoc-json/lifetime/longest.rs6
-rw-r--r--tests/rustdoc-json/non_lifetime_binders.rs6
-rw-r--r--tests/rustdoc-json/output_generics.rs13
-rw-r--r--tests/rustdoc-json/type/extern.rs2
-rw-r--r--tests/rustdoc-json/unions/impl.rs2
-rw-r--r--tests/rustdoc-json/unions/union.rs1
7 files changed, 18 insertions, 13 deletions
diff --git a/rustfmt.toml b/rustfmt.toml
index 79f197b27b1..9f2dcec6f06 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-json/",
     "/tests/rustdoc-js-std/",
     "/tests/rustdoc-ui/",
     "/tests/ui/",
diff --git a/tests/rustdoc-json/lifetime/longest.rs b/tests/rustdoc-json/lifetime/longest.rs
index 419b0b4fcab..dccad41a861 100644
--- a/tests/rustdoc-json/lifetime/longest.rs
+++ b/tests/rustdoc-json/lifetime/longest.rs
@@ -23,9 +23,5 @@
 // @is "$.index[*][?(@.name=='longest')].inner.function.decl.output.borrowed_ref.type.primitive" \"str\"
 
 pub fn longest<'a>(l: &'a str, r: &'a str) -> &'a str {
-    if l.len() > r.len() {
-        l
-    } else {
-        r
-    }
+    if l.len() > r.len() { l } else { r }
 }
diff --git a/tests/rustdoc-json/non_lifetime_binders.rs b/tests/rustdoc-json/non_lifetime_binders.rs
index d925fcd5221..6f0732646ca 100644
--- a/tests/rustdoc-json/non_lifetime_binders.rs
+++ b/tests/rustdoc-json/non_lifetime_binders.rs
@@ -12,4 +12,8 @@ pub struct Wrapper<T_>(std::marker::PhantomData<T_>);
 // @is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }'
 // @is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].name" \"T\"
 // @is "$.index[*][?(@.name=='foo')].inner.function.generics.where_predicates[0].bound_predicate.generic_params[1].kind" '{ "type": { "bounds": [], "default": null, "synthetic": false } }'
-pub fn foo() where for<'a, T> &'a Wrapper<T>: Trait {}
+pub fn foo()
+where
+    for<'a, T> &'a Wrapper<T>: Trait,
+{
+}
diff --git a/tests/rustdoc-json/output_generics.rs b/tests/rustdoc-json/output_generics.rs
index d421eafbb47..e9df64b79e3 100644
--- a/tests/rustdoc-json/output_generics.rs
+++ b/tests/rustdoc-json/output_generics.rs
@@ -16,12 +16,19 @@ pub trait Trait<T> {
     fn handle(value: T) -> Self;
 }
 
-impl<T, U> Trait<U> for T where T: From<U> {
-    fn handle(_: U) -> Self { unimplemented!() }
+impl<T, U> Trait<U> for T
+where
+    T: From<U>,
+{
+    fn handle(_: U) -> Self {
+        unimplemented!()
+    }
 }
 
 impl<'a, R> Trait<&'a mut Events<R>> for Other {
-    fn handle(_: &'a mut Events<R>) -> Self { unimplemented!() }
+    fn handle(_: &'a mut Events<R>) -> Self {
+        unimplemented!()
+    }
 }
 
 fn this_compiles<'a, R>(value: &'a mut Events<R>) {
diff --git a/tests/rustdoc-json/type/extern.rs b/tests/rustdoc-json/type/extern.rs
index c30146ce9e0..59e099ec9fc 100644
--- a/tests/rustdoc-json/type/extern.rs
+++ b/tests/rustdoc-json/type/extern.rs
@@ -1,6 +1,6 @@
 #![feature(extern_types)]
 
-extern {
+extern "C" {
     /// No inner information
     pub type Foo;
 }
diff --git a/tests/rustdoc-json/unions/impl.rs b/tests/rustdoc-json/unions/impl.rs
index 7456892df1b..1515f7d9397 100644
--- a/tests/rustdoc-json/unions/impl.rs
+++ b/tests/rustdoc-json/unions/impl.rs
@@ -4,7 +4,7 @@
 // @has "$.index[*][?(@.name=='Ux')].inner.union"
 pub union Ux {
     a: u32,
-    b: u64
+    b: u64,
 }
 
 // @is "$.index[*][?(@.name=='Num')].visibility" \"public\"
diff --git a/tests/rustdoc-json/unions/union.rs b/tests/rustdoc-json/unions/union.rs
index 22b70e1ce8c..1089d9c4558 100644
--- a/tests/rustdoc-json/unions/union.rs
+++ b/tests/rustdoc-json/unions/union.rs
@@ -7,7 +7,6 @@ pub union Union {
     float: f32,
 }
 
-
 // @has "$.index[*][?(@.name=='make_int_union')].inner.function.decl.output.resolved_path"
 // @is "$.index[*][?(@.name=='make_int_union')].inner.function.decl.output.resolved_path.id" $Union
 pub fn make_int_union(int: i32) -> Union {