This commit is contained in:
Nadrieril 2024-01-18 17:43:27 +01:00
parent d9d89fd53d
commit dbc1f074bc

View File

@ -208,10 +208,10 @@ pub(super) fn check_expr_with_expectation_and_args(
// without the final expr (e.g. `try { return; }`). We don't want to generate an // without the final expr (e.g. `try { return; }`). We don't want to generate an
// unreachable_code lint for it since warnings for autogenerated code are confusing. // unreachable_code lint for it since warnings for autogenerated code are confusing.
let is_try_block_generated_unit_expr = match expr.kind { let is_try_block_generated_unit_expr = match expr.kind {
ExprKind::Call(_, args) if expr.span.is_desugaring(DesugaringKind::TryBlock) => { ExprKind::Call(_, [arg]) => {
args.len() == 1 && args[0].span.is_desugaring(DesugaringKind::TryBlock) expr.span.is_desugaring(DesugaringKind::TryBlock)
&& arg.span.is_desugaring(DesugaringKind::TryBlock)
} }
_ => false, _ => false,
}; };