Skip to content

Commit 23d1142

Browse files
committed
Auto merge of #8134 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 40fd785 + 646a9cf commit 23d1142

32 files changed

+144
-161
lines changed

clippy_lints/src/asm_syntax.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ declare_clippy_lint! {
6565
/// ```rust,no_run
6666
/// # #![feature(asm)]
6767
/// # unsafe { let ptr = "".as_ptr();
68+
/// # use std::arch::asm;
6869
/// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr);
6970
/// # }
7071
/// ```
7172
/// Use instead:
7273
/// ```rust,no_run
7374
/// # #![feature(asm)]
7475
/// # unsafe { let ptr = "".as_ptr();
76+
/// # use std::arch::asm;
7577
/// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax));
7678
/// # }
7779
/// ```
@@ -102,13 +104,15 @@ declare_clippy_lint! {
102104
/// ```rust,no_run
103105
/// # #![feature(asm)]
104106
/// # unsafe { let ptr = "".as_ptr();
107+
/// # use std::arch::asm;
105108
/// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax));
106109
/// # }
107110
/// ```
108111
/// Use instead:
109112
/// ```rust,no_run
110113
/// # #![feature(asm)]
111114
/// # unsafe { let ptr = "".as_ptr();
115+
/// # use std::arch::asm;
112116
/// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr);
113117
/// # }
114118
/// ```

clippy_lints/src/bytecount.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'tcx> LateLintPass<'tcx> for ByteCount {
4242
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
4343
if_chain! {
4444
if let ExprKind::MethodCall(count, _, [count_recv], _) = expr.kind;
45-
if count.ident.name == sym!(count);
45+
if count.ident.name == sym::count;
4646
if let ExprKind::MethodCall(filter, _, [filter_recv, filter_arg], _) = count_recv.kind;
4747
if filter.ident.name == sym!(filter);
4848
if let ExprKind::Closure(_, _, body_id, _, _) = filter_arg.kind;

clippy_lints/src/future_not_send.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
6868
let mut is_future = false;
6969
for &(p, _span) in preds {
7070
let p = p.subst(cx.tcx, subst);
71-
if let Some(trait_ref) = p.to_opt_poly_trait_ref() {
72-
if Some(trait_ref.value.def_id()) == cx.tcx.lang_items().future_trait() {
71+
if let Some(trait_pred) = p.to_opt_poly_trait_pred() {
72+
if Some(trait_pred.skip_binder().trait_ref.def_id) == cx.tcx.lang_items().future_trait() {
7373
is_future = true;
7474
break;
7575
}

clippy_lints/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![feature(box_patterns)]
44
#![feature(drain_filter)]
55
#![feature(in_band_lifetimes)]
6-
#![feature(iter_zip)]
76
#![feature(once_cell)]
87
#![feature(rustc_private)]
98
#![feature(stmt_expr_attributes)]

clippy_lints/src/matches.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use clippy_utils::{
1313
strip_pat_refs,
1414
};
1515
use clippy_utils::{paths, search_same, SpanlessEq, SpanlessHash};
16-
use core::array;
1716
use core::iter::{once, ExactSizeIterator};
1817
use if_chain::if_chain;
1918
use rustc_ast::ast::{Attribute, LitKind};
@@ -1314,7 +1313,7 @@ fn check_match_like_matches<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>)
13141313
return find_matches_sugg(
13151314
cx,
13161315
let_expr,
1317-
array::IntoIter::new([(&[][..], Some(let_pat), if_then, None), (&[][..], None, if_else, None)]),
1316+
IntoIterator::into_iter([(&[][..], Some(let_pat), if_then, None), (&[][..], None, if_else, None)]),
13181317
expr,
13191318
true,
13201319
);

clippy_lints/src/methods/str_splitn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ fn parse_iter_usage(
204204
match e.kind {
205205
ExprKind::Call(
206206
Expr {
207-
kind: ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, _)),
207+
kind: ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, ..)),
208208
..
209209
},
210210
_,

clippy_lints/src/needless_late_init.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,14 @@ fn assignment_suggestions<'tcx>(
155155
}
156156

157157
let suggestions = assignments
158-
.into_iter()
159-
.map(|assignment| Some((assignment.span, snippet_opt(cx, assignment.rhs_span)?)))
158+
.iter()
159+
.map(|assignment| Some((assignment.span.until(assignment.rhs_span), String::new())))
160+
.chain(assignments.iter().map(|assignment| {
161+
Some((
162+
assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi()),
163+
String::new(),
164+
))
165+
}))
160166
.collect::<Option<Vec<(Span, String)>>>()?;
161167

162168
let applicability = if suggestions.len() > 1 {

clippy_lints/src/needless_question_mark.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn check(cx: &LateContext<'_>, expr: &Expr<'_>) {
105105
};
106106
if let ExprKind::Match(inner_expr_with_q, _, MatchSource::TryDesugar) = &arg.kind;
107107
if let ExprKind::Call(called, [inner_expr]) = &inner_expr_with_q.kind;
108-
if let ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, _)) = &called.kind;
108+
if let ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, ..)) = &called.kind;
109109
if expr.span.ctxt() == inner_expr.span.ctxt();
110110
let expr_ty = cx.typeck_results().expr_ty(expr);
111111
let inner_ty = cx.typeck_results().expr_ty(inner_expr);

clippy_lints/src/redundant_clone.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_middle::mir::{
1515
Mutability,
1616
};
1717
use rustc_middle::ty::{self, fold::TypeVisitor, Ty, TyCtxt};
18-
use rustc_mir_dataflow::{Analysis, AnalysisDomain, GenKill, GenKillAnalysis, ResultsCursor};
18+
use rustc_mir_dataflow::{Analysis, AnalysisDomain, CallReturnPlaces, GenKill, GenKillAnalysis, ResultsCursor};
1919
use rustc_session::{declare_lint_pass, declare_tool_lint};
2020
use rustc_span::source_map::{BytePos, Span};
2121
use rustc_span::sym;
@@ -500,11 +500,9 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeStorageLive {
500500

501501
fn call_return_effect(
502502
&self,
503-
_in_out: &mut impl GenKill<Self::Idx>,
503+
_trans: &mut impl GenKill<Self::Idx>,
504504
_block: mir::BasicBlock,
505-
_func: &mir::Operand<'tcx>,
506-
_args: &[mir::Operand<'tcx>],
507-
_return_place: mir::Place<'tcx>,
505+
_return_places: CallReturnPlaces<'_, 'tcx>,
508506
) {
509507
// Nothing to do when a call returns successfully
510508
}

clippy_lints/src/strings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes {
257257
if method_names[0] == sym!(as_bytes);
258258

259259
// Check for slicer
260-
if let ExprKind::Struct(QPath::LangItem(LangItem::Range, _), _, _) = right.kind;
260+
if let ExprKind::Struct(QPath::LangItem(LangItem::Range, ..), _, _) = right.kind;
261261

262262
then {
263263
let mut applicability = Applicability::MachineApplicable;

0 commit comments

Comments
 (0)