Skip to content

Commit f0826b0

Browse files
committed
Auto merge of rust-lang#3217 - RalfJung:rustup, r=RalfJung
Rustup Pulls in rust-lang/rust#117953 (in preparation for implementing those intrinsics)
2 parents 40bd722 + b4f2b5d commit f0826b0

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

clippy_lints/src/doc/needless_doctest_main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub fn check(
6969
if !ignore {
7070
get_test_spans(&item, &mut test_attr_spans);
7171
}
72-
let is_async = matches!(sig.header.coro_kind, Some(CoroutineKind::Async { .. }));
72+
let is_async = matches!(sig.header.coroutine_kind, Some(CoroutineKind::Async { .. }));
7373
let returns_nothing = match &sig.decl.output {
7474
FnRetTy::Default(..) => true,
7575
FnRetTy::Ty(ty) if ty.kind.is_unit() => true,

clippy_lints/src/non_expressive_names.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,9 @@ impl<'a, 'tcx> Visitor<'tcx> for SimilarNamesLocalVisitor<'a, 'tcx> {
341341

342342
self.apply(|this| {
343343
SimilarNamesNameVisitor(this).visit_pat(&arm.pat);
344-
this.apply(|this| walk_expr(this, &arm.body));
344+
if let Some(body) = &arm.body {
345+
this.apply(|this| walk_expr(this, body));
346+
}
345347
});
346348

347349
self.check_single_char_names();

clippy_lints/src/redundant_else.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ impl<'ast> Visitor<'ast> for BreakVisitor {
105105
fn visit_expr(&mut self, expr: &'ast Expr) {
106106
self.is_break = match expr.kind {
107107
ExprKind::Break(..) | ExprKind::Continue(..) | ExprKind::Ret(..) => true,
108-
ExprKind::Match(_, ref arms) => arms.iter().all(|arm| self.check_expr(&arm.body)),
108+
ExprKind::Match(_, ref arms) => arms.iter().all(|arm|
109+
arm.body.is_none() || arm.body.as_deref().is_some_and(|body| self.check_expr(body))
110+
),
109111
ExprKind::If(_, ref then, Some(ref els)) => self.check_block(then) && self.check_expr(els),
110112
ExprKind::If(_, _, None)
111113
// ignore loops for simplicity

clippy_utils/src/ast_utils.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
188188
Closure(box ast::Closure {
189189
binder: lb,
190190
capture_clause: lc,
191-
coro_kind: la,
191+
coroutine_kind: la,
192192
movability: lm,
193193
fn_decl: lf,
194194
body: le,
@@ -197,7 +197,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
197197
Closure(box ast::Closure {
198198
binder: rb,
199199
capture_clause: rc,
200-
coro_kind: ra,
200+
coroutine_kind: ra,
201201
movability: rm,
202202
fn_decl: rf,
203203
body: re,
@@ -236,7 +236,7 @@ pub fn eq_field(l: &ExprField, r: &ExprField) -> bool {
236236
pub fn eq_arm(l: &Arm, r: &Arm) -> bool {
237237
l.is_placeholder == r.is_placeholder
238238
&& eq_pat(&l.pat, &r.pat)
239-
&& eq_expr(&l.body, &r.body)
239+
&& eq_expr_opt(&l.body, &r.body)
240240
&& eq_expr_opt(&l.guard, &r.guard)
241241
&& over(&l.attrs, &r.attrs, eq_attr)
242242
}
@@ -563,18 +563,19 @@ pub fn eq_fn_sig(l: &FnSig, r: &FnSig) -> bool {
563563
eq_fn_decl(&l.decl, &r.decl) && eq_fn_header(&l.header, &r.header)
564564
}
565565

566-
fn eq_opt_coro_kind(l: Option<CoroutineKind>, r: Option<CoroutineKind>) -> bool {
566+
fn eq_opt_coroutine_kind(l: Option<CoroutineKind>, r: Option<CoroutineKind>) -> bool {
567567
match (l, r) {
568568
(Some(CoroutineKind::Async { .. }), Some(CoroutineKind::Async { .. }))
569-
| (Some(CoroutineKind::Gen { .. }), Some(CoroutineKind::Gen { .. })) => true,
569+
| (Some(CoroutineKind::Gen { .. }), Some(CoroutineKind::Gen { .. }))
570+
| (Some(CoroutineKind::AsyncGen { .. }), Some(CoroutineKind::AsyncGen { .. })) => true,
570571
(None, None) => true,
571572
_ => false,
572573
}
573574
}
574575

575576
pub fn eq_fn_header(l: &FnHeader, r: &FnHeader) -> bool {
576577
matches!(l.unsafety, Unsafe::No) == matches!(r.unsafety, Unsafe::No)
577-
&& eq_opt_coro_kind(l.coro_kind, r.coro_kind)
578+
&& eq_opt_coroutine_kind(l.coroutine_kind, r.coroutine_kind)
578579
&& matches!(l.constness, Const::No) == matches!(r.constness, Const::No)
579580
&& eq_ext(&l.ext, &r.ext)
580581
}

0 commit comments

Comments
 (0)