mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Merge commit '97a5daa65908e59744e2bc625b14849352231c75' into clippyup
This commit is contained in:
@@ -53,13 +53,12 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
|
||||
}
|
||||
}
|
||||
|
||||
fn is_struct_with_trailing_zero_sized_array(cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) -> bool {
|
||||
fn is_struct_with_trailing_zero_sized_array(cx: &LateContext<'_>, item: &Item<'_>) -> bool {
|
||||
if_chain! {
|
||||
// First check if last field is an array
|
||||
if let ItemKind::Struct(data, _) = &item.kind;
|
||||
if let Some(last_field) = data.fields().last();
|
||||
if let rustc_hir::TyKind::Array(_, length) = last_field.ty.kind;
|
||||
if let rustc_hir::ArrayLen::Body(length) = length;
|
||||
if let rustc_hir::TyKind::Array(_, rustc_hir::ArrayLen::Body(length)) = last_field.ty.kind;
|
||||
|
||||
// Then check if that that array zero-sized
|
||||
let length_ldid = cx.tcx.hir().local_def_id(length.hir_id);
|
||||
|
||||
Reference in New Issue
Block a user