diff options
Diffstat (limited to 'clippy_lints/src')
| -rw-r--r-- | clippy_lints/src/asm_syntax.rs | 4 | ||||
| -rw-r--r-- | clippy_lints/src/bytecount.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/future_not_send.rs | 4 | ||||
| -rw-r--r-- | clippy_lints/src/lib.rs | 1 | ||||
| -rw-r--r-- | clippy_lints/src/matches.rs | 3 | ||||
| -rw-r--r-- | clippy_lints/src/methods/str_splitn.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/needless_late_init.rs | 10 | ||||
| -rw-r--r-- | clippy_lints/src/needless_question_mark.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/redundant_clone.rs | 8 | ||||
| -rw-r--r-- | clippy_lints/src/strings.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/try_err.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/unused_io_amount.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/utils/author.rs | 2 |
13 files changed, 25 insertions, 19 deletions
diff --git a/clippy_lints/src/asm_syntax.rs b/clippy_lints/src/asm_syntax.rs index 0322698f029..f419781dbc8 100644 --- a/clippy_lints/src/asm_syntax.rs +++ b/clippy_lints/src/asm_syntax.rs @@ -65,6 +65,7 @@ declare_clippy_lint! { /// ```rust,no_run /// # #![feature(asm)] /// # unsafe { let ptr = "".as_ptr(); + /// # use std::arch::asm; /// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr); /// # } /// ``` @@ -72,6 +73,7 @@ declare_clippy_lint! { /// ```rust,no_run /// # #![feature(asm)] /// # unsafe { let ptr = "".as_ptr(); + /// # use std::arch::asm; /// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax)); /// # } /// ``` @@ -102,6 +104,7 @@ declare_clippy_lint! { /// ```rust,no_run /// # #![feature(asm)] /// # unsafe { let ptr = "".as_ptr(); + /// # use std::arch::asm; /// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax)); /// # } /// ``` @@ -109,6 +112,7 @@ declare_clippy_lint! { /// ```rust,no_run /// # #![feature(asm)] /// # unsafe { let ptr = "".as_ptr(); + /// # use std::arch::asm; /// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr); /// # } /// ``` diff --git a/clippy_lints/src/bytecount.rs b/clippy_lints/src/bytecount.rs index 657c1f88c7d..92336a54e27 100644 --- a/clippy_lints/src/bytecount.rs +++ b/clippy_lints/src/bytecount.rs @@ -42,7 +42,7 @@ impl<'tcx> LateLintPass<'tcx> for ByteCount { fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { if_chain! { if let ExprKind::MethodCall(count, _, [count_recv], _) = expr.kind; - if count.ident.name == sym!(count); + if count.ident.name == sym::count; if let ExprKind::MethodCall(filter, _, [filter_recv, filter_arg], _) = count_recv.kind; if filter.ident.name == sym!(filter); if let ExprKind::Closure(_, _, body_id, _, _) = filter_arg.kind; diff --git a/clippy_lints/src/future_not_send.rs b/clippy_lints/src/future_not_send.rs index fefdcfed42f..43911a313d5 100644 --- a/clippy_lints/src/future_not_send.rs +++ b/clippy_lints/src/future_not_send.rs @@ -68,8 +68,8 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend { let mut is_future = false; for &(p, _span) in preds { let p = p.subst(cx.tcx, subst); - if let Some(trait_ref) = p.to_opt_poly_trait_ref() { - if Some(trait_ref.value.def_id()) == cx.tcx.lang_items().future_trait() { + if let Some(trait_pred) = p.to_opt_poly_trait_pred() { + if Some(trait_pred.skip_binder().trait_ref.def_id) == cx.tcx.lang_items().future_trait() { is_future = true; break; } diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index c6b14ecac43..d1c7956a7a5 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -3,7 +3,6 @@ #![feature(box_patterns)] #![feature(drain_filter)] #![feature(in_band_lifetimes)] -#![feature(iter_zip)] #![feature(once_cell)] #![feature(rustc_private)] #![feature(stmt_expr_attributes)] diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 385232f4d71..acac0887226 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -13,7 +13,6 @@ use clippy_utils::{ strip_pat_refs, }; use clippy_utils::{paths, search_same, SpanlessEq, SpanlessHash}; -use core::array; use core::iter::{once, ExactSizeIterator}; use if_chain::if_chain; use rustc_ast::ast::{Attribute, LitKind}; @@ -1314,7 +1313,7 @@ fn check_match_like_matches<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) return find_matches_sugg( cx, let_expr, - array::IntoIter::new([(&[][..], Some(let_pat), if_then, None), (&[][..], None, if_else, None)]), + IntoIterator::into_iter([(&[][..], Some(let_pat), if_then, None), (&[][..], None, if_else, None)]), expr, true, ); diff --git a/clippy_lints/src/methods/str_splitn.rs b/clippy_lints/src/methods/str_splitn.rs index 2595f734f11..e5fafdb075c 100644 --- a/clippy_lints/src/methods/str_splitn.rs +++ b/clippy_lints/src/methods/str_splitn.rs @@ -204,7 +204,7 @@ fn parse_iter_usage( match e.kind { ExprKind::Call( Expr { - kind: ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, _)), + kind: ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, ..)), .. }, _, diff --git a/clippy_lints/src/needless_late_init.rs b/clippy_lints/src/needless_late_init.rs index e0522f3fe0b..094a3f111ba 100644 --- a/clippy_lints/src/needless_late_init.rs +++ b/clippy_lints/src/needless_late_init.rs @@ -155,8 +155,14 @@ fn assignment_suggestions<'tcx>( } let suggestions = assignments - .into_iter() - .map(|assignment| Some((assignment.span, snippet_opt(cx, assignment.rhs_span)?))) + .iter() + .map(|assignment| Some((assignment.span.until(assignment.rhs_span), String::new()))) + .chain(assignments.iter().map(|assignment| { + Some(( + assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi()), + String::new(), + )) + })) .collect::<Option<Vec<(Span, String)>>>()?; let applicability = if suggestions.len() > 1 { diff --git a/clippy_lints/src/needless_question_mark.rs b/clippy_lints/src/needless_question_mark.rs index 1ffed6a0524..0e7ae43ce2d 100644 --- a/clippy_lints/src/needless_question_mark.rs +++ b/clippy_lints/src/needless_question_mark.rs @@ -105,7 +105,7 @@ fn check(cx: &LateContext<'_>, expr: &Expr<'_>) { }; if let ExprKind::Match(inner_expr_with_q, _, MatchSource::TryDesugar) = &arg.kind; if let ExprKind::Call(called, [inner_expr]) = &inner_expr_with_q.kind; - if let ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, _)) = &called.kind; + if let ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, ..)) = &called.kind; if expr.span.ctxt() == inner_expr.span.ctxt(); let expr_ty = cx.typeck_results().expr_ty(expr); let inner_ty = cx.typeck_results().expr_ty(inner_expr); diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs index 1a2c86a7686..1cf349f8aa7 100644 --- a/clippy_lints/src/redundant_clone.rs +++ b/clippy_lints/src/redundant_clone.rs @@ -15,7 +15,7 @@ use rustc_middle::mir::{ Mutability, }; use rustc_middle::ty::{self, fold::TypeVisitor, Ty, TyCtxt}; -use rustc_mir_dataflow::{Analysis, AnalysisDomain, GenKill, GenKillAnalysis, ResultsCursor}; +use rustc_mir_dataflow::{Analysis, AnalysisDomain, CallReturnPlaces, GenKill, GenKillAnalysis, ResultsCursor}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::{BytePos, Span}; use rustc_span::sym; @@ -500,11 +500,9 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeStorageLive { fn call_return_effect( &self, - _in_out: &mut impl GenKill<Self::Idx>, + _trans: &mut impl GenKill<Self::Idx>, _block: mir::BasicBlock, - _func: &mir::Operand<'tcx>, - _args: &[mir::Operand<'tcx>], - _return_place: mir::Place<'tcx>, + _return_places: CallReturnPlaces<'_, 'tcx>, ) { // Nothing to do when a call returns successfully } diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs index b03f4583365..73600a8a087 100644 --- a/clippy_lints/src/strings.rs +++ b/clippy_lints/src/strings.rs @@ -257,7 +257,7 @@ impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes { if method_names[0] == sym!(as_bytes); // Check for slicer - if let ExprKind::Struct(QPath::LangItem(LangItem::Range, _), _, _) = right.kind; + if let ExprKind::Struct(QPath::LangItem(LangItem::Range, ..), _, _) = right.kind; then { let mut applicability = Applicability::MachineApplicable; diff --git a/clippy_lints/src/try_err.rs b/clippy_lints/src/try_err.rs index e0e7ec9a452..4da32c52e75 100644 --- a/clippy_lints/src/try_err.rs +++ b/clippy_lints/src/try_err.rs @@ -65,7 +65,7 @@ impl<'tcx> LateLintPass<'tcx> for TryErr { if let ExprKind::Match(match_arg, _, MatchSource::TryDesugar) = expr.kind; if let ExprKind::Call(match_fun, try_args) = match_arg.kind; if let ExprKind::Path(ref match_fun_path) = match_fun.kind; - if matches!(match_fun_path, QPath::LangItem(LangItem::TryTraitBranch, _)); + if matches!(match_fun_path, QPath::LangItem(LangItem::TryTraitBranch, ..)); if let Some(try_arg) = try_args.get(0); if let ExprKind::Call(err_fun, err_args) = try_arg.kind; if let Some(err_arg) = err_args.get(0); diff --git a/clippy_lints/src/unused_io_amount.rs b/clippy_lints/src/unused_io_amount.rs index d4b5c9770a2..111413e5193 100644 --- a/clippy_lints/src/unused_io_amount.rs +++ b/clippy_lints/src/unused_io_amount.rs @@ -49,7 +49,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedIoAmount { if let hir::ExprKind::Call(func, [ref arg_0, ..]) = res.kind { if matches!( func.kind, - hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::TryTraitBranch, _)) + hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::TryTraitBranch, ..)) ) { check_map_error(cx, arg_0, expr); } diff --git a/clippy_lints/src/utils/author.rs b/clippy_lints/src/utils/author.rs index d20bf341318..f186e1f05a0 100644 --- a/clippy_lints/src/utils/author.rs +++ b/clippy_lints/src/utils/author.rs @@ -260,7 +260,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> { } fn qpath(&self, qpath: &Binding<&QPath<'_>>) { - if let QPath::LangItem(lang_item, _) = *qpath.value { + if let QPath::LangItem(lang_item, ..) = *qpath.value { out!("if matches!({qpath}, QPath::LangItem(LangItem::{lang_item:?}, _));"); } else { out!("if match_qpath({qpath}, &[{}]);", path_to_string(qpath.value)); |
