Skip to content

Commit 0e3f19d

Browse files
committed
Do not account for inner/outer attr
1 parent 3cc09c8 commit 0e3f19d

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

src/librustc_lint/builtin.rs

+1-11
Original file line numberDiff line numberDiff line change
@@ -687,18 +687,8 @@ impl EarlyLintPass for BadRepr {
687687
fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) {
688688
if attr.name() == "repr" {
689689
let list = attr.meta_item_list();
690-
let outer = match attr.style {
691-
ast::AttrStyle::Outer => true,
692-
ast::AttrStyle::Inner => false,
693-
};
694690

695-
let repr_str = move |lit: &str| {
696-
if outer {
697-
format!("#[repr({})]", lit)
698-
} else {
699-
format!("#![repr({})]", lit)
700-
}
701-
};
691+
let repr_str = |lit: &str| { format!("#[repr({})]", lit) };
702692

703693
// Emit warnings with `repr` either has a literal assignment (`#[repr = "C"]`) or
704694
// no hints (``#[repr]`)

src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ LL | mod inner { #![repr="3900"] }
193193
| ^^^^^^^^^^^^^^^ needs a hint
194194
|
195195
= note: #[warn(bad_repr)] on by default
196-
= help: valid hints include `#![repr(C)]`, `#![repr(packed)]`, `#![repr(rust)]` and `#![repr(transparent)]`
196+
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
197197
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html>
198198

199199
warning: `repr` attribute isn't configurable with a literal
@@ -238,7 +238,7 @@ warning: `repr` attribute isn't configurable with a literal
238238
LL | #![repr = "3900"]
239239
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ needs a hint
240240
|
241-
= help: valid hints include `#![repr(C)]`, `#![repr(packed)]`, `#![repr(rust)]` and `#![repr(transparent)]`
241+
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
242242
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html>
243243

244244
warning: unused attribute

0 commit comments

Comments
 (0)