Skip to content

Commit d921055

Browse files
authored
Rollup merge of rust-lang#86277 - jsha:remove-must-use, r=Manishearth
Remove must_use from ALLOWED_ATTRIBUTES This is a fairly common attribute on methods, but is not something you need to know when reading the method docs - the purpose of the attribute is for the compiler to tell you about it if you forget to use a value. Removing reclaims some valuable space in the summary of methods, particularly when the attribute has a long string value. As discussed in rust-lang#84309. Partially addresses rust-lang#81482. r? ```@Manishearth```
2 parents e84ee52 + 74e8e7b commit d921055

File tree

5 files changed

+3
-50
lines changed

5 files changed

+3
-50
lines changed

src/librustdoc/html/render/mod.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -965,14 +965,8 @@ fn render_assoc_item(
965965
}
966966
}
967967

968-
const ALLOWED_ATTRIBUTES: &[Symbol] = &[
969-
sym::export_name,
970-
sym::link_section,
971-
sym::must_use,
972-
sym::no_mangle,
973-
sym::repr,
974-
sym::non_exhaustive,
975-
];
968+
const ALLOWED_ATTRIBUTES: &[Symbol] =
969+
&[sym::export_name, sym::link_section, sym::no_mangle, sym::repr, sym::non_exhaustive];
976970

977971
fn attributes(it: &clean::Item) -> Vec<String> {
978972
it.attrs

src/test/rustdoc/attributes.rs

-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ pub extern "C" fn f() {}
88
#[export_name = "bar"]
99
pub extern "C" fn g() {}
1010

11-
// @matches foo/enum.Foo.html '//*[@class="rust enum"]' \
12-
// '#\[repr\(i64\)\]\n#\[must_use\]'
13-
#[repr(i64)]
14-
#[must_use]
15-
pub enum Foo {
16-
Bar,
17-
}
18-
1911
// @has foo/struct.Repr.html '//*[@class="docblock type-decl"]' '#[repr(C, align(8))]'
2012
#[repr(C, align(8))]
2113
pub struct Repr;

src/test/rustdoc/cap-lints.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
// therefore should not concern itself with the lints.
44
#[deny(warnings)]
55

6-
// @has cap_lints/struct.Foo.html //pre '#[must_use]'
7-
#[must_use]
6+
// @has cap_lints/struct.Foo.html //* 'Struct Foo'
87
pub struct Foo {
98
field: i32,
109
}

src/test/rustdoc/must-use.rs

-11
This file was deleted.

src/test/rustdoc/trait-attributes.rs

-21
This file was deleted.

0 commit comments

Comments
 (0)