This commit is contained in:
flip1995 2019-08-15 09:59:08 +02:00
parent d829d9f6b0
commit 9533fa5b19
No known key found for this signature in database
GPG Key ID: 693086869D506637
5 changed files with 6 additions and 7 deletions

View File

@ -43,10 +43,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
if cx.tcx.data_layout.pointer_size.bits() != 64 {
return;
}
if let ItemKind::Enum(ref def, _) = item.node {
if let ItemKind::Enum(def, _) = &item.node {
for var in &def.variants {
let variant = &var.node;
if let Some(ref anon_const) = variant.disr_expr {
if let Some(anon_const) = &var.disr_expr {
let param_env = ty::ParamEnv::empty();
let def_id = cx.tcx.hir().body_owner_def_id(anon_const.body);
let substs = InternalSubsts::identity_for_item(cx.tcx.global_tcx(), def_id);

View File

@ -123,7 +123,7 @@ impl_lint_pass!(EnumVariantNames => [
]);
fn var2str(var: &Variant) -> LocalInternedString {
var.node.ident.as_str()
var.ident.as_str()
}
/// Returns the number of chars that match from the start

View File

@ -85,7 +85,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LargeEnumVariant {
"large size difference between variants",
|db| {
if variant.fields.len() == 1 {
let span = match def.variants[i].node.data {
let span = match def.variants[i].data {
VariantData::Struct(ref fields, ..) | VariantData::Tuple(ref fields, ..) => {
fields[0].ty.span
},

View File

@ -197,6 +197,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
}
fn check_variant(&mut self, cx: &LateContext<'a, 'tcx>, v: &'tcx hir::Variant, _: &hir::Generics) {
self.check_missing_docs_attrs(cx, &v.node.attrs, v.span, "a variant");
self.check_missing_docs_attrs(cx, &v.attrs, v.span, "a variant");
}
}

View File

@ -91,7 +91,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Author {
}
fn check_variant(&mut self, cx: &LateContext<'a, 'tcx>, var: &'tcx hir::Variant, generics: &hir::Generics) {
if !has_attr(cx.sess(), &var.node.attrs) {
if !has_attr(cx.sess(), &var.attrs) {
return;
}
prelude();