Use match ergonomics compatible with editions 2021 and 2024

This commit is contained in:
Samuel Tardieu 2024-10-29 19:48:09 +01:00
parent 625d391107
commit 0c1ef98454
33 changed files with 66 additions and 69 deletions

View File

@ -232,7 +232,7 @@ fn get_types_from_cast<'a>(
// or `to_type::MAX as from_type`
let call_from_cast: Option<(&Expr<'_>, &str)> = if let ExprKind::Cast(limit, from_type) = &expr.kind
// to_type::max_value(), from_type
&& let TyKind::Path(ref from_type_path) = &from_type.kind
&& let TyKind::Path(from_type_path) = &from_type.kind
&& let Some(from_sym) = int_ty_to_sym(from_type_path)
{
Some((limit, from_sym))
@ -245,7 +245,7 @@ fn get_types_from_cast<'a>(
if let ExprKind::Call(from_func, [limit]) = &expr.kind
// `from_type::from, to_type::max_value()`
// `from_type::from`
&& let ExprKind::Path(ref path) = &from_func.kind
&& let ExprKind::Path(path) = &from_func.kind
&& let Some(from_sym) = get_implementing_type(path, INTS, "from")
{
Some((limit, from_sym))

View File

@ -37,7 +37,7 @@
impl<'tcx> LateLintPass<'tcx> for CopyIterator {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Impl(Impl {
of_trait: Some(ref trait_ref),
of_trait: Some(trait_ref),
..
}) = item.kind
&& let ty = cx.tcx.type_of(item.owner_id).instantiate_identity()

View File

@ -187,7 +187,7 @@ fn check_enum<'tcx>(cx: &LateContext<'tcx>, item: &'tcx Item<'_>, func_expr: &Ex
impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Impl(Impl {
of_trait: Some(ref trait_ref),
of_trait: Some(trait_ref),
items: [child],
self_ty,
..

View File

@ -202,7 +202,7 @@
impl<'tcx> LateLintPass<'tcx> for Derive {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Impl(Impl {
of_trait: Some(ref trait_ref),
of_trait: Some(trait_ref),
..
}) = item.kind
{

View File

@ -80,7 +80,7 @@ fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &ast::Crate) {
let mut symbols: Vec<_> = symbols.iter().collect();
symbols.sort_unstable_by_key(|k| k.1);
for (symbol, &span) in &symbols {
for &(symbol, &span) in &symbols {
// Note: `symbol.as_str()` is an expensive operation, thus should not be called
// more than once for a single symbol.
let symbol_str = symbol.as_str();

View File

@ -36,7 +36,7 @@
impl LateLintPass<'_> for EmptyDrop {
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
if let ItemKind::Impl(Impl {
of_trait: Some(ref trait_ref),
of_trait: Some(trait_ref),
items: [child],
..
}) = item.kind

View File

@ -629,7 +629,7 @@ fn has_is_empty_impl(cx: &LateContext<'_>, id: DefId) -> bool {
.filter_by_name_unhygienic(is_empty)
.any(|item| is_is_empty(cx, item))
}),
ty::Alias(ty::Projection, ref proj) => has_is_empty_impl(cx, proj.def_id),
ty::Alias(ty::Projection, proj) => has_is_empty_impl(cx, proj.def_id),
ty::Adt(id, _) => has_is_empty_impl(cx, id.did()),
ty::Array(..) | ty::Slice(..) | ty::Str => true,
_ => false,

View File

@ -425,7 +425,7 @@ fn visit_ty(&mut self, ty: &'tcx Ty<'_>) {
self.visit_opaque_ty(opaque);
self.lts.truncate(len);
self.lts.extend(bounds.iter().filter_map(|bound| match bound {
GenericArg::Lifetime(&l) => Some(l),
&GenericArg::Lifetime(l) => Some(l),
_ => None,
}));
},

View File

@ -169,7 +169,7 @@ fn captures_all_lifetimes(inputs: &[Ty<'_>], output_lifetimes: &[LifetimeName])
}
fn desugared_async_block<'tcx>(cx: &LateContext<'tcx>, block: &'tcx Block<'tcx>) -> Option<&'tcx Body<'tcx>> {
if let Some(Expr {
if let Some(&Expr {
kind: ExprKind::Closure(&Closure { kind, body, .. }),
..
}) = block.expr

View File

@ -148,7 +148,7 @@ fn find_bool_lit(ex: &ExprKind<'_>) -> Option<bool> {
}) => Some(*b),
ExprKind::Block(
rustc_hir::Block {
stmts: &[],
stmts: [],
expr: Some(exp),
..
},

View File

@ -319,10 +319,9 @@ fn found_good_method<'tcx>(
node: (&PatKind<'_>, &PatKind<'_>),
) -> Option<(&'static str, Option<&'tcx Expr<'tcx>>)> {
match node {
(
PatKind::TupleStruct(ref path_left, patterns_left, _),
PatKind::TupleStruct(ref path_right, patterns_right, _),
) if patterns_left.len() == 1 && patterns_right.len() == 1 => {
(PatKind::TupleStruct(path_left, patterns_left, _), PatKind::TupleStruct(path_right, patterns_right, _))
if patterns_left.len() == 1 && patterns_right.len() == 1 =>
{
if let (PatKind::Wild, PatKind::Wild) = (&patterns_left[0].kind, &patterns_right[0].kind) {
find_good_method_for_match(
cx,
@ -350,8 +349,8 @@ fn found_good_method<'tcx>(
None
}
},
(PatKind::TupleStruct(ref path_left, patterns, _), PatKind::Path(ref path_right))
| (PatKind::Path(ref path_left), PatKind::TupleStruct(ref path_right, patterns, _))
(PatKind::TupleStruct(path_left, patterns, _), PatKind::Path(path_right))
| (PatKind::Path(path_left), PatKind::TupleStruct(path_right, patterns, _))
if patterns.len() == 1 =>
{
if let PatKind::Wild = patterns[0].kind {
@ -381,14 +380,14 @@ fn found_good_method<'tcx>(
None
}
},
(PatKind::TupleStruct(ref path_left, patterns, _), PatKind::Wild) if patterns.len() == 1 => {
(PatKind::TupleStruct(path_left, patterns, _), PatKind::Wild) if patterns.len() == 1 => {
if let PatKind::Wild = patterns[0].kind {
get_good_method(cx, arms, path_left)
} else {
None
}
},
(PatKind::Path(ref path_left), PatKind::Wild) => get_good_method(cx, arms, path_left),
(PatKind::Path(path_left), PatKind::Wild) => get_good_method(cx, arms, path_left),
_ => None,
}
}

View File

@ -21,8 +21,8 @@ fn is_method(cx: &LateContext<'_>, expr: &Expr<'_>, method_name: Symbol) -> bool
ExprKind::Path(QPath::TypeRelative(_, mname)) => mname.ident.name == method_name,
ExprKind::Path(QPath::Resolved(_, segments)) => segments.segments.last().unwrap().ident.name == method_name,
ExprKind::MethodCall(segment, _, _, _) => segment.ident.name == method_name,
ExprKind::Closure(&Closure { body, .. }) => {
let body = cx.tcx.hir().body(body);
ExprKind::Closure(Closure { body, .. }) => {
let body = cx.tcx.hir().body(*body);
let closure_expr = peel_blocks(body.value);
match closure_expr.kind {
ExprKind::MethodCall(PathSegment { ident, .. }, receiver, ..) => {

View File

@ -347,7 +347,7 @@ fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx LetStmt<'tcx>) {
if let LetStmt {
init: None,
pat:
&Pat {
Pat {
kind: PatKind::Binding(BindingMode::NONE, binding_id, _, None),
..
},
@ -357,7 +357,7 @@ fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx LetStmt<'tcx>) {
&& let Some((_, Node::Stmt(local_stmt))) = parents.next()
&& let Some((_, Node::Block(block))) = parents.next()
{
check(cx, local, local_stmt, block, binding_id);
check(cx, local, local_stmt, block, *binding_id);
}
}
}

View File

@ -183,7 +183,7 @@ fn check_fn(
.iter()
.zip(fn_sig.inputs())
.zip(body.params)
.filter(|((&input, &ty), arg)| !should_skip(cx, input, ty, arg))
.filter(|&((&input, &ty), arg)| !should_skip(cx, input, ty, arg))
.peekable();
if it.peek().is_none() {
return;

View File

@ -34,7 +34,7 @@
impl<'tcx> LateLintPass<'tcx> for PartialEqNeImpl {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Impl(Impl {
of_trait: Some(ref trait_ref),
of_trait: Some(trait_ref),
items: impl_items,
..
}) = item.kind

View File

@ -93,7 +93,7 @@ enum IfBlockType<'hir> {
fn find_let_else_ret_expression<'hir>(block: &'hir Block<'hir>) -> Option<&'hir Expr<'hir>> {
if let Block {
stmts: &[],
stmts: [],
expr: Some(els),
..
} = block

View File

@ -39,7 +39,7 @@ impl<'tcx> LateLintPass<'tcx> for RefOptionRef {
fn check_ty(&mut self, cx: &LateContext<'tcx>, ty: &'tcx Ty<'tcx>) {
if let TyKind::Ref(_, ref mut_ty) = ty.kind
&& mut_ty.mutbl == Mutability::Not
&& let TyKind::Path(ref qpath) = &mut_ty.ty.kind
&& let TyKind::Path(qpath) = &mut_ty.ty.kind
&& let last = last_path_segment(qpath)
&& let Some(def_id) = last.res.opt_def_id()
&& cx.tcx.is_diagnostic_item(sym::Option, def_id)

View File

@ -347,7 +347,7 @@ fn check_final_expr<'tcx>(
let peeled_drop_expr = expr.peel_drop_temps();
match &peeled_drop_expr.kind {
// simple return is always "bad"
ExprKind::Ret(ref inner) => {
ExprKind::Ret(inner) => {
// check if expr return nothing
let ret_span = if inner.is_none() && replacement == RetReplacement::Empty {
extend_span_to_previous_non_ws(cx, peeled_drop_expr.span)

View File

@ -26,7 +26,7 @@
impl<'tcx> LateLintPass<'tcx> for SerdeApi {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
if let ItemKind::Impl(Impl {
of_trait: Some(ref trait_ref),
of_trait: Some(trait_ref),
items,
..
}) = item.kind

View File

@ -174,7 +174,7 @@ fn track_uses(
}
match &item.kind {
ItemKind::Mod(_, ModKind::Loaded(ref items, ..)) => {
ItemKind::Mod(_, ModKind::Loaded(items, ..)) => {
self.check_mod(items);
},
ItemKind::MacroDef(MacroDef { macro_rules: true, .. }) => {

View File

@ -334,7 +334,7 @@ fn strip_non_ident_wrappers(expr: &Expr) -> &Expr {
let mut output = expr;
loop {
output = match &output.kind {
ExprKind::Paren(ref inner) | ExprKind::Unary(_, ref inner) => inner,
ExprKind::Paren(inner) | ExprKind::Unary(_, inner) => inner,
_ => {
return output;
},
@ -348,13 +348,13 @@ fn extract_related_binops(kind: &ExprKind) -> Option<Vec<BinaryOp<'_>>> {
fn if_statement_binops(kind: &ExprKind) -> Option<Vec<BinaryOp<'_>>> {
match kind {
ExprKind::If(ref condition, _, _) => chained_binops(&condition.kind),
ExprKind::Paren(ref e) => if_statement_binops(&e.kind),
ExprKind::Block(ref block, _) => {
ExprKind::If(condition, _, _) => chained_binops(&condition.kind),
ExprKind::Paren(e) => if_statement_binops(&e.kind),
ExprKind::Block(block, _) => {
let mut output = None;
for stmt in &block.stmts {
match stmt.kind {
StmtKind::Expr(ref e) | StmtKind::Semi(ref e) => {
match &stmt.kind {
StmtKind::Expr(e) | StmtKind::Semi(e) => {
output = append_opt_vecs(output, if_statement_binops(&e.kind));
},
_ => {},
@ -383,7 +383,7 @@ fn append_opt_vecs<A>(target_opt: Option<Vec<A>>, source_opt: Option<Vec<A>>) ->
fn chained_binops(kind: &ExprKind) -> Option<Vec<BinaryOp<'_>>> {
match kind {
ExprKind::Binary(_, left_outer, right_outer) => chained_binops_helper(left_outer, right_outer),
ExprKind::Paren(ref e) | ExprKind::Unary(_, ref e) => chained_binops(&e.kind),
ExprKind::Paren(e) | ExprKind::Unary(_, e) => chained_binops(&e.kind),
_ => None,
}
}
@ -391,16 +391,14 @@ fn chained_binops(kind: &ExprKind) -> Option<Vec<BinaryOp<'_>>> {
fn chained_binops_helper<'expr>(left_outer: &'expr Expr, right_outer: &'expr Expr) -> Option<Vec<BinaryOp<'expr>>> {
match (&left_outer.kind, &right_outer.kind) {
(
ExprKind::Paren(ref left_e) | ExprKind::Unary(_, ref left_e),
ExprKind::Paren(ref right_e) | ExprKind::Unary(_, ref right_e),
ExprKind::Paren(left_e) | ExprKind::Unary(_, left_e),
ExprKind::Paren(right_e) | ExprKind::Unary(_, right_e),
) => chained_binops_helper(left_e, right_e),
(ExprKind::Paren(ref left_e) | ExprKind::Unary(_, ref left_e), _) => chained_binops_helper(left_e, right_outer),
(_, ExprKind::Paren(ref right_e) | ExprKind::Unary(_, ref right_e)) => {
chained_binops_helper(left_outer, right_e)
},
(ExprKind::Paren(left_e) | ExprKind::Unary(_, left_e), _) => chained_binops_helper(left_e, right_outer),
(_, ExprKind::Paren(right_e) | ExprKind::Unary(_, right_e)) => chained_binops_helper(left_outer, right_e),
(
ExprKind::Binary(Spanned { node: left_op, .. }, ref left_left, ref left_right),
ExprKind::Binary(Spanned { node: right_op, .. }, ref right_left, ref right_right),
ExprKind::Binary(Spanned { node: left_op, .. }, left_left, left_right),
ExprKind::Binary(Spanned { node: right_op, .. }, right_left, right_right),
) => match (
chained_binops_helper(left_left, left_right),
chained_binops_helper(right_left, right_right),

View File

@ -392,7 +392,7 @@ fn is_used_after_swap(&mut self, idx_ident: Ident) -> bool {
for stmt in self.block.stmts {
match stmt.kind {
StmtKind::Expr(expr) | StmtKind::Semi(expr) => v.visit_expr(expr),
StmtKind::Let(LetStmt { ref init, .. }) => {
StmtKind::Let(LetStmt { init, .. }) => {
if let Some(init) = init.as_ref() {
v.visit_expr(init);
}

View File

@ -124,7 +124,7 @@ fn check_trait_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx TraitItem<'tc
let mut self_bounds_map = FxHashMap::default();
for predicate in item.generics.predicates {
if let WherePredicate::BoundPredicate(ref bound_predicate) = predicate
if let WherePredicate::BoundPredicate(bound_predicate) = predicate
&& bound_predicate.origin != PredicateOrigin::ImplTrait
&& !bound_predicate.span.from_expansion()
&& let TyKind::Path(QPath::Resolved(_, Path { segments, .. })) = bound_predicate.bounded_ty.kind
@ -268,7 +268,7 @@ impl Eq for SpanlessTy<'_, '_> {}
let mut map: UnhashMap<SpanlessTy<'_, '_>, Vec<&GenericBound<'_>>> = UnhashMap::default();
let mut applicability = Applicability::MaybeIncorrect;
for bound in generics.predicates {
if let WherePredicate::BoundPredicate(ref p) = bound
if let WherePredicate::BoundPredicate(p) = bound
&& p.origin != PredicateOrigin::ImplTrait
&& p.bounds.len() as u64 <= self.max_trait_bounds
&& !p.span.from_expansion()

View File

@ -295,7 +295,7 @@ fn expr_has_unnecessary_safety_comment<'tcx>(
if cx.tcx.hir().parent_iter(expr.hir_id).any(|(_, ref node)| {
matches!(
node,
Node::Block(&Block {
Node::Block(Block {
rules: BlockCheckMode::UnsafeBlock(UnsafeSource::UserProvided),
..
}),

View File

@ -194,7 +194,7 @@ fn needs_inferred_result_ty(
let (id, receiver, args) = match e.kind {
ExprKind::Call(
Expr {
kind: ExprKind::Path(ref path),
kind: ExprKind::Path(path),
hir_id,
..
},

View File

@ -149,7 +149,7 @@ fn is_empty_block(expr: &Expr<'_>) -> bool {
expr.kind,
ExprKind::Block(
Block {
stmts: &[],
stmts: [],
expr: None,
..
},

View File

@ -244,7 +244,7 @@ fn unpack_call_chain<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
}
fn unpack_try<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
while let ExprKind::Call(func, [ref arg_0]) = expr.kind
while let ExprKind::Call(func, [arg_0]) = expr.kind
&& matches!(
func.kind,
ExprKind::Path(hir::QPath::LangItem(hir::LangItem::TryTraitBranch, ..))
@ -266,7 +266,7 @@ fn unpack_match<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
/// waited on. Otherwise return None.
fn unpack_await<'a>(expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
if let ExprKind::Match(expr, _, hir::MatchSource::AwaitDesugar) = expr.kind {
if let ExprKind::Call(func, [ref arg_0]) = expr.kind {
if let ExprKind::Call(func, [arg_0]) = expr.kind {
if matches!(
func.kind,
ExprKind::Path(hir::QPath::LangItem(hir::LangItem::IntoFutureIntoFuture, ..))

View File

@ -396,7 +396,7 @@ macro_rules! kind {
self.pat(field!(let_expr.pat));
// Does what ExprKind::Cast does, only adds a clause for the type
// if it's a path
if let Some(TyKind::Path(ref qpath)) = let_expr.value.ty.as_ref().map(|ty| &ty.kind) {
if let Some(TyKind::Path(qpath)) = let_expr.value.ty.as_ref().map(|ty| &ty.kind) {
bind!(self, qpath);
chain!(self, "let TyKind::Path(ref {qpath}) = {let_expr}.ty.kind");
self.qpath(qpath);

View File

@ -79,7 +79,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
if let ExprKind::Call(func, [call_cx, call_lint, call_sp, call_msg, call_f]) = expr.kind
&& is_expr_path_def_path(cx, func, &["clippy_utils", "diagnostics", "span_lint_and_then"])
&& let ExprKind::Closure(&Closure { body, .. }) = &call_f.kind
&& let ExprKind::Closure(&Closure { body, .. }) = call_f.kind
&& let body = cx.tcx.hir().body(body)
&& let only_expr = peel_blocks_with_stmt(body.value)
&& let ExprKind::MethodCall(ps, recv, span_call_args, _) = &only_expr.kind

View File

@ -123,7 +123,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
.expect("lints must have a description field");
if let ExprKind::Lit(Spanned {
node: LitKind::Str(ref sym, _),
node: LitKind::Str(sym, _),
..
}) = field.expr.kind
{
@ -249,7 +249,7 @@ fn check_invalid_clippy_version_attribute(cx: &LateContext<'_>, item: &'_ Item<'
pub(super) fn extract_clippy_version_value(cx: &LateContext<'_>, item: &'_ Item<'_>) -> Option<Symbol> {
let attrs = cx.tcx.hir().attrs(item.hir_id());
attrs.iter().find_map(|attr| {
if let ast::AttrKind::Normal(ref attr_kind) = &attr.kind
if let ast::AttrKind::Normal(attr_kind) = &attr.kind
// Identify attribute
&& let [tool_name, attr_name] = &attr_kind.item.path.segments[..]
&& tool_name.ident.name == sym::clippy

View File

@ -103,7 +103,7 @@ impl<'hir> IfLet<'hir> {
/// Parses an `if let` expression
pub fn hir(cx: &LateContext<'_>, expr: &Expr<'hir>) -> Option<Self> {
if let ExprKind::If(
Expr {
&Expr {
kind:
ExprKind::Let(&hir::LetExpr {
pat: let_pat,
@ -381,12 +381,12 @@ impl<'hir> WhileLet<'hir> {
/// Parses a desugared `while let` loop
pub const fn hir(expr: &Expr<'hir>) -> Option<Self> {
if let ExprKind::Loop(
Block {
&Block {
expr:
Some(Expr {
Some(&Expr {
kind:
ExprKind::If(
Expr {
&Expr {
kind:
ExprKind::Let(&hir::LetExpr {
pat: let_pat,

View File

@ -1189,11 +1189,11 @@ pub fn hash_tykind(&mut self, ty: &TyKind<'_>) {
self.hash_ty(ty);
self.hash_pat(pat);
},
TyKind::Ptr(ref mut_ty) => {
TyKind::Ptr(mut_ty) => {
self.hash_ty(mut_ty.ty);
mut_ty.mutbl.hash(&mut self.s);
},
TyKind::Ref(lifetime, ref mut_ty) => {
TyKind::Ref(lifetime, mut_ty) => {
self.hash_lifetime(lifetime);
self.hash_ty(mut_ty.ty);
mut_ty.mutbl.hash(&mut self.s);
@ -1218,7 +1218,7 @@ pub fn hash_tykind(&mut self, ty: &TyKind<'_>) {
self.hash_ty(ty);
}
},
TyKind::Path(ref qpath) => self.hash_qpath(qpath),
TyKind::Path(qpath) => self.hash_qpath(qpath),
TyKind::OpaqueDef(_, arg_list) => {
self.hash_generic_args(arg_list);
},

View File

@ -689,11 +689,11 @@ pub fn find_crates(tcx: TyCtxt<'_>, name: Symbol) -> Vec<Res> {
///
/// This function is expensive and should be used sparingly.
pub fn def_path_res(tcx: TyCtxt<'_>, path: &[&str]) -> Vec<Res> {
let (base, path) = match *path {
let (base, path) = match path {
[primitive] => {
return vec![PrimTy::from_name(Symbol::intern(primitive)).map_or(Res::Err, Res::PrimTy)];
},
[base, ref path @ ..] => (base, path),
[base, path @ ..] => (base, path),
_ => return Vec::new(),
};
@ -935,7 +935,7 @@ pub fn is_default_equivalent(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
}
},
ExprKind::Call(repl_func, []) => is_default_equivalent_call(cx, repl_func),
ExprKind::Call(from_func, [ref arg]) => is_default_equivalent_from(cx, from_func, arg),
ExprKind::Call(from_func, [arg]) => is_default_equivalent_from(cx, from_func, arg),
ExprKind::Path(qpath) => is_res_lang_ctor(cx, cx.qpath_res(qpath, e.hir_id), OptionNone),
ExprKind::AddrOf(rustc_hir::BorrowKind::Ref, _, expr) => matches!(expr.kind, ExprKind::Array([])),
_ => false,
@ -948,7 +948,7 @@ fn is_default_equivalent_from(cx: &LateContext<'_>, from_func: &Expr<'_>, arg: &
{
match arg.kind {
ExprKind::Lit(hir::Lit {
node: LitKind::Str(ref sym, _),
node: LitKind::Str(sym, _),
..
}) => return sym.is_empty() && is_path_lang_item(cx, ty, LangItem::String),
ExprKind::Array([]) => return is_path_diagnostic_item(cx, ty, sym::Vec),
@ -3460,7 +3460,7 @@ fn maybe_get_relative_path(from: &DefPath, to: &DefPath, max_super: usize) -> St
pub fn is_parent_stmt(cx: &LateContext<'_>, id: HirId) -> bool {
matches!(
cx.tcx.parent_hir_node(id),
Node::Stmt(..) | Node::Block(Block { stmts: &[], .. })
Node::Stmt(..) | Node::Block(Block { stmts: [], .. })
)
}