diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index d95e0d77d86..b3b737ab283 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -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]`) diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr index 3569eecd883..f351a9e69d0 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -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 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 warning: unused attribute