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:
Alex Crichton 2014-07-10 10:19:38 -07:00
parent 6bd79d32e9
commit c26cd9f05d
2 changed files with 10 additions and 0 deletions

View File

@ -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)

View File

@ -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() { }