mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
rustc: Exclude #[repr(C)] from non camel case
C structs predominately do not use camel case identifiers, and we have a clear indicator for what's a C struct now, so excuse all of them from this stylistic lint.
This commit is contained in:
parent
6bd79d32e9
commit
c26cd9f05d
@ -744,6 +744,11 @@ impl LintPass for NonCamelCaseTypes {
|
||||
}
|
||||
}
|
||||
|
||||
let has_extern_repr = it.attrs.iter().fold(attr::ReprAny, |acc, attr| {
|
||||
attr::find_repr_attr(cx.tcx.sess.diagnostic(), attr, acc)
|
||||
}) == attr::ReprExtern;
|
||||
if has_extern_repr { return }
|
||||
|
||||
match it.node {
|
||||
ast::ItemTy(..) | ast::ItemStruct(..) => {
|
||||
check_case(cx, "type", it.ident, it.span)
|
||||
|
@ -32,4 +32,9 @@ enum Foo5 {
|
||||
trait foo6 { //~ ERROR trait `foo6` should have a camel case name such as `Foo6`
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
struct foo7 {
|
||||
bar: int,
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
Loading…
Reference in New Issue
Block a user