Skip to content

Commit 0e7f159

Browse files
authored
Rollup merge of #105024 - notriddle:notriddle/fnname, r=jyn514
rustdoc: remove `fnname` CSS class that's styled exactly like `fn` It's not obvious why this was ever a separate class name, since even in c4219a4 when it was first added, it was styled identically to regular `fn` links.
2 parents 219ea9a + 19e0200 commit 0e7f159

17 files changed

+34
-35
lines changed

src/librustdoc/html/render/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -847,10 +847,10 @@ fn assoc_method(
847847
render_attributes_in_code(w, meth);
848848
(0, "", Ending::Newline)
849849
};
850-
w.reserve(header_len + "<a href=\"\" class=\"fnname\">{".len() + "</a>".len());
850+
w.reserve(header_len + "<a href=\"\" class=\"fn\">{".len() + "</a>".len());
851851
write!(
852852
w,
853-
"{indent}{vis}{constness}{asyncness}{unsafety}{defaultness}{abi}fn <a{href} class=\"fnname\">{name}</a>\
853+
"{indent}{vis}{constness}{asyncness}{unsafety}{defaultness}{abi}fn <a{href} class=\"fn\">{name}</a>\
854854
{generics}{decl}{notable_traits}{where_clause}",
855855
indent = indent_str,
856856
vis = vis,

src/librustdoc/html/static/css/rustdoc.css

-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ h1 a,
242242
}
243243

244244
.content span.fn, .content a.fn,
245-
.content .fnname,
246245
.content span.method, .content a.method,
247246
.content span.tymethod, .content a.tymethod {
248247
color: var(--function-link-color);

src/test/rustdoc-gui/item-decl-colors.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ define-function: (
3030
("assert-css", (".item-decl .primitive", {"color": |primitive_color|}, ALL)),
3131
("goto", "file://" + |DOC_PATH| + "/test_docs/trait.TraitWithoutGenerics.html"),
3232
("assert-css", (".item-decl .constant", {"color": |constant_color|}, ALL)),
33-
("assert-css", (".item-decl .fnname", {"color": |fn_color|}, ALL)),
33+
("assert-css", (".item-decl .fn", {"color": |fn_color|}, ALL)),
3434
("assert-css", (".item-decl .associatedtype", {"color": |assoc_type_color|}, ALL)),
3535
],
3636
)

src/test/rustdoc-gui/notable-trait.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ assert: "#method\.create_an_iterator_from_read .notable-traits:focus"
226226
// Now we check that the focus isn't given back to the wrong item when opening
227227
// another popover.
228228
store-window-property: (scroll, "scrollY")
229-
click: "#method\.create_an_iterator_from_read .fnname"
229+
click: "#method\.create_an_iterator_from_read .fn"
230230
// We ensure that the scroll position changed.
231231
assert-window-property-false: {"scrollY": |scroll|}
232232
// Store the new position.
@@ -240,7 +240,7 @@ assert-window-property-false: {"scrollY": |scroll|}
240240

241241
// Same but with Escape handling.
242242
store-window-property: (scroll, "scrollY")
243-
click: "#method\.create_an_iterator_from_read .fnname"
243+
click: "#method\.create_an_iterator_from_read .fn"
244244
// We ensure that the scroll position changed.
245245
assert-window-property-false: {"scrollY": |scroll|}
246246
// Store the new position.

src/test/rustdoc-gui/where-whitespace.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ show-text: true
55
// line than "pub trait Whitespace<Idx>").
66
compare-elements-position-false: (".item-decl code", ".where.fmt-newline", ("y"))
77
// And that the code following it isn't on the same line either.
8-
compare-elements-position-false: (".item-decl .fnname", ".where.fmt-newline", ("y"))
8+
compare-elements-position-false: (".item-decl .fn", ".where.fmt-newline", ("y"))
99

1010
goto: "file://" + |DOC_PATH| + "/lib2/struct.WhereWhitespace.html"
1111
// We make the screen a bit wider to ensure that the trait impl is on one line.
1212
size: (915, 915)
1313

14-
compare-elements-position-false: ("#method\.new .fnname", "#method\.new .where.fmt-newline", ("y"))
14+
compare-elements-position-false: ("#method\.new .fn", "#method\.new .where.fmt-newline", ("y"))
1515
// We ensure that both the trait name and the struct name are on the same line in
1616
// "impl<K, T> Whitespace<&K> for WhereWhitespace<T>".
1717
compare-elements-position: (
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<section id="method.new" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#48">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>() -&gt; Self</h4></section>
1+
<section id="method.new" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#48">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -&gt; Self</h4></section>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<section id="method.bar" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#23">source</a><h4 class="code-header">fn <a href="#method.bar" class="fnname">bar</a>()</h4></section>
1+
<section id="method.bar" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#23">source</a><h4 class="code-header">fn <a href="#method.bar" class="fn">bar</a>()</h4></section>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<section id="tymethod.foo" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#20">source</a><h4 class="code-header">fn <a href="#tymethod.foo" class="fnname">foo</a>()</h4></section>
1+
<section id="tymethod.foo" class="method has-srclink"><a class="srclink rightside" href="../src/foo/anchors.rs.html#20">source</a><h4 class="code-header">fn <a href="#tymethod.foo" class="fn">foo</a>()</h4></section>
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<code>pub trait Write {
2-
fn <a href="#tymethod.poll_write" class="fnname">poll_write</a>(<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;buf: &amp;mut [<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>]<br />&#160;&#160;&#160;&#160;) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
3-
<span class="item-spacer" /> fn <a href="#tymethod.poll_flush" class="fnname">poll_flush</a>(<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;<br />&#160;&#160;&#160;&#160;) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
4-
<span class="item-spacer" /> fn <a href="#tymethod.poll_close" class="fnname">poll_close</a>(<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;<br />&#160;&#160;&#160;&#160;) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
2+
fn <a href="#tymethod.poll_write" class="fn">poll_write</a>(<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;buf: &amp;mut [<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>]<br />&#160;&#160;&#160;&#160;) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
3+
<span class="item-spacer" /> fn <a href="#tymethod.poll_flush" class="fn">poll_flush</a>(<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;<br />&#160;&#160;&#160;&#160;) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
4+
<span class="item-spacer" /> fn <a href="#tymethod.poll_close" class="fn">poll_close</a>(<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;<br />&#160;&#160;&#160;&#160;) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.unit.html">()</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt;;
55

6-
fn <a href="#method.poll_write_vectored" class="fnname">poll_write_vectored</a>(<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;bufs: &amp;[<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>]<br />&#160;&#160;&#160;&#160;) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt; { ... }
7-
}</code>
6+
fn <a href="#method.poll_write_vectored" class="fn">poll_write_vectored</a>(<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;self: <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;cx: &amp;mut <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="{{channel}}/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;bufs: &amp;[<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>]<br />&#160;&#160;&#160;&#160;) -&gt; <a class="enum" href="{{channel}}/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="{{channel}}/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="{{channel}}/std/primitive.usize.html">usize</a>, <a class="struct" href="struct.Error.html" title="struct foo::Error">Error</a>&gt;&gt; { ... }
7+
}</code>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<a class="fnname">provided</a>(&amp;self)
1+
<a class="fn">provided</a>(&amp;self)

src/test/rustdoc/extern-default-method.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ extern crate rustdoc_extern_default_method as ext;
1111
// However, the method in the trait impl should *not* have a link (an `href` attribute) to
1212
// its corresponding item in the trait declaration since it would otherwise be broken.
1313
//
14-
// In older versions of rustdoc, the impl item (`a[@class="fnname"]`) used to link to
14+
// In older versions of rustdoc, the impl item (`a[@class="fn"]`) used to link to
1515
// `#method.provided` – i.e. "to itself". Put in quotes since that was actually incorrect in
1616
// general: If the type `Struct` also had an inherent method called `provided`, the impl item
1717
// would link to that one even though those two methods are distinct items!
1818

1919
// @count extern_default_method/struct.Struct.html '//*[@id="method.provided"]' 1
20-
// @count extern_default_method/struct.Struct.html '//*[@id="method.provided"]//a[@class="fnname"]' 1
21-
// @snapshot no_href_on_anchor - '//*[@id="method.provided"]//a[@class="fnname"]'
20+
// @count extern_default_method/struct.Struct.html '//*[@id="method.provided"]//a[@class="fn"]' 1
21+
// @snapshot no_href_on_anchor - '//*[@id="method.provided"]//a[@class="fn"]'
2222
// @has extern_default_method/struct.Struct.html '//*[@id="method.provided"]//a[@class="anchor"]/@href' #method.provided
2323
pub use ext::Struct;

src/test/rustdoc/foreigntype.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extern "C" {
66
}
77

88
impl ExtType {
9-
// @has - '//a[@class="fnname"]' 'do_something'
9+
// @has - '//a[@class="fn"]' 'do_something'
1010
pub fn do_something(&self) {}
1111
}
1212

Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<h4 class="code-header">fn <a href="#method.touch" class="fnname">touch</a>(&amp;self)</h4>
1+
<h4 class="code-header">fn <a href="#method.touch" class="fn">touch</a>(&amp;self)</h4>

0 commit comments

Comments
 (0)