mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-18 00:53:31 +00:00
Rustup to rust-lang/rust#63543
This commit is contained in:
parent
d829d9f6b0
commit
9533fa5b19
5 changed files with 6 additions and 7 deletions
|
@ -43,10 +43,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
|
||||||
if cx.tcx.data_layout.pointer_size.bits() != 64 {
|
if cx.tcx.data_layout.pointer_size.bits() != 64 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if let ItemKind::Enum(ref def, _) = item.node {
|
if let ItemKind::Enum(def, _) = &item.node {
|
||||||
for var in &def.variants {
|
for var in &def.variants {
|
||||||
let variant = &var.node;
|
if let Some(anon_const) = &var.disr_expr {
|
||||||
if let Some(ref anon_const) = variant.disr_expr {
|
|
||||||
let param_env = ty::ParamEnv::empty();
|
let param_env = ty::ParamEnv::empty();
|
||||||
let def_id = cx.tcx.hir().body_owner_def_id(anon_const.body);
|
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);
|
let substs = InternalSubsts::identity_for_item(cx.tcx.global_tcx(), def_id);
|
||||||
|
|
|
@ -123,7 +123,7 @@ impl_lint_pass!(EnumVariantNames => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
fn var2str(var: &Variant) -> LocalInternedString {
|
fn var2str(var: &Variant) -> LocalInternedString {
|
||||||
var.node.ident.as_str()
|
var.ident.as_str()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the number of chars that match from the start
|
/// Returns the number of chars that match from the start
|
||||||
|
|
|
@ -85,7 +85,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LargeEnumVariant {
|
||||||
"large size difference between variants",
|
"large size difference between variants",
|
||||||
|db| {
|
|db| {
|
||||||
if variant.fields.len() == 1 {
|
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, ..) => {
|
VariantData::Struct(ref fields, ..) | VariantData::Tuple(ref fields, ..) => {
|
||||||
fields[0].ty.span
|
fields[0].ty.span
|
||||||
},
|
},
|
||||||
|
|
|
@ -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) {
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
prelude();
|
prelude();
|
||||||
|
|
Loading…
Reference in a new issue