diff options
| author | Michael Howell <michael@notriddle.com> | 2023-01-14 10:58:55 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2023-01-14 11:34:03 -0700 |
| commit | 3a3f70c94e280cbd8354874438643d15ca6ef319 (patch) | |
| tree | 1b27259eaeb18321488dcf1718bf64674ce78799 /tests/rustdoc/const-generics | |
| parent | 4b51adf6ffa1ae2286ea436eb48cbaa8771886e6 (diff) | |
| download | rust-3a3f70c94e280cbd8354874438643d15ca6ef319.tar.gz rust-3a3f70c94e280cbd8354874438643d15ca6ef319.zip | |
rustdoc: remove redundant item kind class from `.item-decl > pre`
This class originated in the very first commit of `rustdoc_ng`, and was used
to add a color border around the item decl based on its kind.
https://github.com/rust-lang/rust/blob/4fd061c426902b0904c65e64a3780b21f9ab3afb/src/rustdoc_ng/html/static/main.css#L102-L106
The item decl no longer has a border, and there aren't any
kind-specific styles in modern rustdoc's rendering of this UI item.
Most of this commit is updating test cases so that they use `item-decl` to
find the `<pre>` tag instead of relying on the fact that the class name
had `rust {kind}` in it while other `<pre>` tags only had class `rust`.
Diffstat (limited to 'tests/rustdoc/const-generics')
| -rw-r--r-- | tests/rustdoc/const-generics/add-impl.rs | 2 | ||||
| -rw-r--r-- | tests/rustdoc/const-generics/const-generic-defaults.rs | 2 | ||||
| -rw-r--r-- | tests/rustdoc/const-generics/const-generics-docs.rs | 36 | ||||
| -rw-r--r-- | tests/rustdoc/const-generics/const-impl.rs | 2 | ||||
| -rw-r--r-- | tests/rustdoc/const-generics/generic_const_exprs.rs | 2 | ||||
| -rw-r--r-- | tests/rustdoc/const-generics/type-alias.rs | 2 |
6 files changed, 23 insertions, 23 deletions
diff --git a/tests/rustdoc/const-generics/add-impl.rs b/tests/rustdoc/const-generics/add-impl.rs index 6cbae9abebb..b5226ad3f78 100644 --- a/tests/rustdoc/const-generics/add-impl.rs +++ b/tests/rustdoc/const-generics/add-impl.rs @@ -2,7 +2,7 @@ use std::ops::Add; -// @has foo/struct.Simd.html '//pre[@class="rust struct"]' 'pub struct Simd<T, const WIDTH: usize>' +// @has foo/struct.Simd.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub struct Simd<T, const WIDTH: usize>' pub struct Simd<T, const WIDTH: usize> { inner: T, } diff --git a/tests/rustdoc/const-generics/const-generic-defaults.rs b/tests/rustdoc/const-generics/const-generic-defaults.rs index 2693d9b5969..acc3b853e56 100644 --- a/tests/rustdoc/const-generics/const-generic-defaults.rs +++ b/tests/rustdoc/const-generics/const-generic-defaults.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] -// @has foo/struct.Foo.html '//pre[@class="rust struct"]' \ +// @has foo/struct.Foo.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub struct Foo<const M: usize = 10, const N: usize = M, T = i32>(_);' pub struct Foo<const M: usize = 10, const N: usize = M, T = i32>(T); diff --git a/tests/rustdoc/const-generics/const-generics-docs.rs b/tests/rustdoc/const-generics/const-generics-docs.rs index 5bf76e3c469..543332d2c32 100644 --- a/tests/rustdoc/const-generics/const-generics-docs.rs +++ b/tests/rustdoc/const-generics/const-generics-docs.rs @@ -3,21 +3,21 @@ #![crate_name = "foo"] extern crate extern_crate; -// @has foo/fn.extern_fn.html '//pre[@class="rust fn"]' \ +// @has foo/fn.extern_fn.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub fn extern_fn<const N: usize>() -> impl Iterator<Item = [u8; N]>' pub use extern_crate::extern_fn; -// @has foo/struct.ExternTy.html '//pre[@class="rust struct"]' \ +// @has foo/struct.ExternTy.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub struct ExternTy<const N: usize> {' pub use extern_crate::ExternTy; -// @has foo/type.TyAlias.html '//pre[@class="rust typedef"]' \ +// @has foo/type.TyAlias.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'type TyAlias<const N: usize> = ExternTy<N>;' pub use extern_crate::TyAlias; -// @has foo/trait.WTrait.html '//pre[@class="rust trait"]' \ +// @has foo/trait.WTrait.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub trait WTrait<const N: usize, const M: usize>' -// @has - '//*[@class="rust trait"]' 'fn hey<const P: usize>() -> usize' +// @has - '//div[@class="item-decl"]/pre[@class="rust"]' 'fn hey<const P: usize>() -> usize' pub use extern_crate::WTrait; -// @has foo/trait.Trait.html '//pre[@class="rust trait"]' \ +// @has foo/trait.Trait.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub trait Trait<const N: usize>' // @has - '//*[@id="impl-Trait%3C1%3E-for-u8"]//h3[@class="code-header"]' 'impl Trait<1> for u8' // @has - '//*[@id="impl-Trait%3C2%3E-for-u8"]//h3[@class="code-header"]' 'impl Trait<2> for u8' @@ -30,10 +30,10 @@ impl Trait<2> for u8 {} impl Trait<{1 + 2}> for u8 {} impl<const N: usize> Trait<N> for [u8; N] {} -// @has foo/struct.Foo.html '//pre[@class="rust struct"]' \ +// @has foo/struct.Foo.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub struct Foo<const N: usize>where u8: Trait<N>' pub struct Foo<const N: usize> where u8: Trait<N>; -// @has foo/struct.Bar.html '//pre[@class="rust struct"]' 'pub struct Bar<T, const N: usize>(_)' +// @has foo/struct.Bar.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub struct Bar<T, const N: usize>(_)' pub struct Bar<T, const N: usize>([T; N]); // @has foo/struct.Foo.html '//*[@id="impl-Foo%3CM%3E"]/h3[@class="code-header"]' 'impl<const M: usize> Foo<M>where u8: Trait<M>' @@ -56,32 +56,32 @@ impl<const M: usize> Bar<u8, M> { } } -// @has foo/fn.test.html '//pre[@class="rust fn"]' \ +// @has foo/fn.test.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub fn test<const N: usize>() -> impl Trait<N>where u8: Trait<N>' pub fn test<const N: usize>() -> impl Trait<N> where u8: Trait<N> { 2u8 } -// @has foo/fn.a_sink.html '//pre[@class="rust fn"]' \ +// @has foo/fn.a_sink.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub async fn a_sink<const N: usize>(v: [u8; N]) -> impl Trait<N>' pub async fn a_sink<const N: usize>(v: [u8; N]) -> impl Trait<N> { v } -// @has foo/fn.b_sink.html '//pre[@class="rust fn"]' \ +// @has foo/fn.b_sink.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub async fn b_sink<const N: usize>(_: impl Trait<N>)' pub async fn b_sink<const N: usize>(_: impl Trait<N>) {} -// @has foo/fn.concrete.html '//pre[@class="rust fn"]' \ +// @has foo/fn.concrete.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub fn concrete() -> [u8; 22]' pub fn concrete() -> [u8; 3 + std::mem::size_of::<u64>() << 1] { Default::default() } -// @has foo/type.Faz.html '//pre[@class="rust typedef"]' \ +// @has foo/type.Faz.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'type Faz<const N: usize> = [u8; N];' pub type Faz<const N: usize> = [u8; N]; -// @has foo/type.Fiz.html '//pre[@class="rust typedef"]' \ +// @has foo/type.Fiz.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'type Fiz<const N: usize> = [[u8; N]; 48];' pub type Fiz<const N: usize> = [[u8; N]; 3 << 4]; @@ -91,7 +91,7 @@ macro_rules! define_me { } } -// @has foo/struct.Foz.html '//pre[@class="rust struct"]' \ +// @has foo/struct.Foz.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub struct Foz<const N: usize>(_);' define_me!(Foz<N>); @@ -103,13 +103,13 @@ impl<const N: usize> Q for [u8; N] { const ASSOC: usize = N; } -// @has foo/fn.q_user.html '//pre[@class="rust fn"]' \ +// @has foo/fn.q_user.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub fn q_user() -> [u8; 13]' pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] { [0; <[u8; 13] as Q>::ASSOC] } -// @has foo/union.Union.html '//pre[@class="rust union"]' \ +// @has foo/union.Union.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub union Union<const N: usize>' pub union Union<const N: usize> { // @has - //pre "pub arr: [u8; N]" @@ -118,7 +118,7 @@ pub union Union<const N: usize> { pub another_arr: [(); N], } -// @has foo/enum.Enum.html '//pre[@class="rust enum"]' \ +// @has foo/enum.Enum.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub enum Enum<const N: usize>' pub enum Enum<const N: usize> { // @has - //pre "Variant([u8; N])" diff --git a/tests/rustdoc/const-generics/const-impl.rs b/tests/rustdoc/const-generics/const-impl.rs index 75ee84279be..726fb8f0c34 100644 --- a/tests/rustdoc/const-generics/const-impl.rs +++ b/tests/rustdoc/const-generics/const-impl.rs @@ -8,7 +8,7 @@ pub enum Order { Unsorted, } -// @has foo/struct.VSet.html '//pre[@class="rust struct"]' 'pub struct VSet<T, const ORDER: Order>' +// @has foo/struct.VSet.html '//div[@class="item-decl"]/pre[@class="rust"]' 'pub struct VSet<T, const ORDER: Order>' // @has foo/struct.VSet.html '//*[@id="impl-Send-for-VSet%3CT%2C%20ORDER%3E"]/h3[@class="code-header"]' 'impl<T, const ORDER: Order> Send for VSet<T, ORDER>' // @has foo/struct.VSet.html '//*[@id="impl-Sync-for-VSet%3CT%2C%20ORDER%3E"]/h3[@class="code-header"]' 'impl<T, const ORDER: Order> Sync for VSet<T, ORDER>' pub struct VSet<T, const ORDER: Order> { diff --git a/tests/rustdoc/const-generics/generic_const_exprs.rs b/tests/rustdoc/const-generics/generic_const_exprs.rs index 215ee228eb8..c53cf6dcd05 100644 --- a/tests/rustdoc/const-generics/generic_const_exprs.rs +++ b/tests/rustdoc/const-generics/generic_const_exprs.rs @@ -2,6 +2,6 @@ #![feature(generic_const_exprs)] #![allow(incomplete_features)] // make sure that `ConstEvaluatable` predicates dont cause rustdoc to ICE #77647 -// @has foo/struct.Ice.html '//pre[@class="rust struct"]' \ +// @has foo/struct.Ice.html '//div[@class="item-decl"]/pre[@class="rust"]' \ // 'pub struct Ice<const N: usize>;' pub struct Ice<const N: usize> where [(); N + 1]:; diff --git a/tests/rustdoc/const-generics/type-alias.rs b/tests/rustdoc/const-generics/type-alias.rs index ebda5b19404..72473a11244 100644 --- a/tests/rustdoc/const-generics/type-alias.rs +++ b/tests/rustdoc/const-generics/type-alias.rs @@ -1,4 +1,4 @@ #![crate_name = "foo"] -// @has foo/type.CellIndex.html '//pre[@class="rust typedef"]' 'type CellIndex<const D: usize> = [i64; D];' +// @has foo/type.CellIndex.html '//div[@class="item-decl"]/pre[@class="rust"]' 'type CellIndex<const D: usize> = [i64; D];' pub type CellIndex<const D: usize> = [i64; D]; |
