提交 74e8e7bb 编写于 作者: J Jacob Hoffman-Andrews

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.
上级 0a8629bf
...@@ -965,14 +965,8 @@ fn method( ...@@ -965,14 +965,8 @@ fn method(
} }
} }
const ALLOWED_ATTRIBUTES: &[Symbol] = &[ const ALLOWED_ATTRIBUTES: &[Symbol] =
sym::export_name, &[sym::export_name, sym::link_section, sym::no_mangle, sym::repr, sym::non_exhaustive];
sym::link_section,
sym::must_use,
sym::no_mangle,
sym::repr,
sym::non_exhaustive,
];
fn attributes(it: &clean::Item) -> Vec<String> { fn attributes(it: &clean::Item) -> Vec<String> {
it.attrs it.attrs
......
...@@ -8,14 +8,6 @@ pub extern "C" fn f() {} ...@@ -8,14 +8,6 @@ pub extern "C" fn f() {}
#[export_name = "bar"] #[export_name = "bar"]
pub extern "C" fn g() {} pub extern "C" fn g() {}
// @matches foo/enum.Foo.html '//*[@class="rust enum"]' \
// '#\[repr\(i64\)\]\n#\[must_use\]'
#[repr(i64)]
#[must_use]
pub enum Foo {
Bar,
}
// @has foo/struct.Repr.html '//*[@class="docblock type-decl"]' '#[repr(C, align(8))]' // @has foo/struct.Repr.html '//*[@class="docblock type-decl"]' '#[repr(C, align(8))]'
#[repr(C, align(8))] #[repr(C, align(8))]
pub struct Repr; pub struct Repr;
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
// therefore should not concern itself with the lints. // therefore should not concern itself with the lints.
#[deny(warnings)] #[deny(warnings)]
// @has cap_lints/struct.Foo.html //pre '#[must_use]' // @has cap_lints/struct.Foo.html //* 'Struct Foo'
#[must_use]
pub struct Foo { pub struct Foo {
field: i32, field: i32,
} }
// @has must_use/struct.Struct.html //pre '#[must_use]'
#[must_use]
pub struct Struct {
field: i32,
}
// @has must_use/enum.Enum.html //pre '#[must_use = "message"]'
#[must_use = "message"]
pub enum Enum {
Variant(i32),
}
#![crate_name = "foo"]
pub trait Foo {
// @has foo/trait.Foo.html '//div[@id="tymethod.foo"]//div[@class="code-attribute"]' '#[must_use]'
#[must_use]
fn foo();
}
#[must_use]
pub struct Bar;
impl Bar {
// @has foo/struct.Bar.html '//div[@id="method.bar"]//div[@class="code-attribute"]' '#[must_use]'
#[must_use]
pub fn bar() {}
// @has foo/struct.Bar.html '//div[@id="method.bar2"]//div[@class="code-attribute"]' '#[must_use]'
#[must_use]
pub fn bar2() {}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册