Do not account for inner/outer attr
This commit is contained in:
parent
3cc09c8380
commit
0e3f19d3f1
@ -687,18 +687,8 @@ impl EarlyLintPass for BadRepr {
|
||||
fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) {
|
||||
if attr.name() == "repr" {
|
||||
let list = attr.meta_item_list();
|
||||
let outer = match attr.style {
|
||||
ast::AttrStyle::Outer => true,
|
||||
ast::AttrStyle::Inner => false,
|
||||
};
|
||||
|
||||
let repr_str = move |lit: &str| {
|
||||
if outer {
|
||||
format!("#[repr({})]", lit)
|
||||
} else {
|
||||
format!("#![repr({})]", lit)
|
||||
}
|
||||
};
|
||||
let repr_str = |lit: &str| { format!("#[repr({})]", lit) };
|
||||
|
||||
// Emit warnings with `repr` either has a literal assignment (`#[repr = "C"]`) or
|
||||
// no hints (``#[repr]`)
|
||||
|
@ -193,7 +193,7 @@ LL | mod inner { #![repr="3900"] }
|
||||
| ^^^^^^^^^^^^^^^ needs a hint
|
||||
|
|
||||
= note: #[warn(bad_repr)] on by default
|
||||
= help: valid hints include `#![repr(C)]`, `#![repr(packed)]`, `#![repr(rust)]` and `#![repr(transparent)]`
|
||||
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html>
|
||||
|
||||
warning: `repr` attribute isn't configurable with a literal
|
||||
@ -238,7 +238,7 @@ warning: `repr` attribute isn't configurable with a literal
|
||||
LL | #![repr = "3900"]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ needs a hint
|
||||
|
|
||||
= help: valid hints include `#![repr(C)]`, `#![repr(packed)]`, `#![repr(rust)]` and `#![repr(transparent)]`
|
||||
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html>
|
||||
|
||||
warning: unused attribute
|
||||
|
Loading…
Reference in New Issue
Block a user