about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
m---------src/tools/cargo0
-rw-r--r--src/tools/clippy/clippy_lints/src/lib.rs1
-rw-r--r--src/tools/clippy/clippy_lints/src/methods/str_splitn.rs2
-rw-r--r--src/tools/clippy/clippy_lints/src/needless_late_init.rs11
-rw-r--r--src/tools/clippy/clippy_lints/src/needless_question_mark.rs2
-rw-r--r--src/tools/clippy/clippy_lints/src/strings.rs2
-rw-r--r--src/tools/clippy/clippy_lints/src/try_err.rs2
-rw-r--r--src/tools/clippy/clippy_lints/src/unused_io_amount.rs2
-rw-r--r--src/tools/clippy/clippy_lints/src/utils/author.rs2
-rw-r--r--src/tools/clippy/clippy_utils/src/higher.rs12
-rw-r--r--src/tools/clippy/clippy_utils/src/hir_utils.rs2
-rw-r--r--src/tools/clippy/clippy_utils/src/lib.rs1
-rw-r--r--src/tools/clippy/tests/ui/future_not_send.stderr24
-rw-r--r--src/tools/clippy/tests/ui/needless_late_init_fixable.fixed38
-rw-r--r--src/tools/clippy/tests/ui/needless_late_init_fixable.rs2
-rw-r--r--src/tools/clippy/tests/ui/needless_late_init_fixable.stderr26
16 files changed, 47 insertions, 82 deletions
diff --git a/src/tools/cargo b/src/tools/cargo
-Subproject 40dc281755137ee804bc9b3b08e782773b726e4
+Subproject a359ce16073401f28b84840da85b268aa3d37c8
diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs
index bd9710ec407..77b7fee6389 100644
--- a/src/tools/clippy/clippy_lints/src/lib.rs
+++ b/src/tools/clippy/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/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs b/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs
index 2595f734f11..e5fafdb075c 100644
--- a/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs
+++ b/src/tools/clippy/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/src/tools/clippy/clippy_lints/src/needless_late_init.rs b/src/tools/clippy/clippy_lints/src/needless_late_init.rs
index e0522f3fe0b..5b098659377 100644
--- a/src/tools/clippy/clippy_lints/src/needless_late_init.rs
+++ b/src/tools/clippy/clippy_lints/src/needless_late_init.rs
@@ -73,7 +73,7 @@ fn contains_assign_expr<'tcx>(cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'tcx>) ->
     seen
 }
 
-#[derive(Debug)]
+#[derive(Debug, Clone)]
 struct LocalAssign {
     lhs_id: HirId,
     lhs_span: Span,
@@ -154,9 +154,14 @@ fn assignment_suggestions<'tcx>(
         assignments.push(assign);
     }
 
-    let suggestions = assignments
+    let suggestions = assignments.clone()
         .into_iter()
-        .map(|assignment| Some((assignment.span, snippet_opt(cx, assignment.rhs_span)?)))
+        .map(|assignment| Some((assignment.span.until(assignment.rhs_span), String::new())))
+        .chain(
+            assignments
+                .into_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/src/tools/clippy/clippy_lints/src/needless_question_mark.rs b/src/tools/clippy/clippy_lints/src/needless_question_mark.rs
index 1ffed6a0524..0e7ae43ce2d 100644
--- a/src/tools/clippy/clippy_lints/src/needless_question_mark.rs
+++ b/src/tools/clippy/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/src/tools/clippy/clippy_lints/src/strings.rs b/src/tools/clippy/clippy_lints/src/strings.rs
index 368274440d5..c2163a24b7f 100644
--- a/src/tools/clippy/clippy_lints/src/strings.rs
+++ b/src/tools/clippy/clippy_lints/src/strings.rs
@@ -260,7 +260,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/src/tools/clippy/clippy_lints/src/try_err.rs b/src/tools/clippy/clippy_lints/src/try_err.rs
index e0e7ec9a452..4da32c52e75 100644
--- a/src/tools/clippy/clippy_lints/src/try_err.rs
+++ b/src/tools/clippy/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/src/tools/clippy/clippy_lints/src/unused_io_amount.rs b/src/tools/clippy/clippy_lints/src/unused_io_amount.rs
index d4b5c9770a2..111413e5193 100644
--- a/src/tools/clippy/clippy_lints/src/unused_io_amount.rs
+++ b/src/tools/clippy/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/src/tools/clippy/clippy_lints/src/utils/author.rs b/src/tools/clippy/clippy_lints/src/utils/author.rs
index d20bf341318..f186e1f05a0 100644
--- a/src/tools/clippy/clippy_lints/src/utils/author.rs
+++ b/src/tools/clippy/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));
diff --git a/src/tools/clippy/clippy_utils/src/higher.rs b/src/tools/clippy/clippy_utils/src/higher.rs
index 7297265d08c..fc32e49420e 100644
--- a/src/tools/clippy/clippy_utils/src/higher.rs
+++ b/src/tools/clippy/clippy_utils/src/higher.rs
@@ -218,7 +218,7 @@ impl<'a> Range<'a> {
             hir::ExprKind::Call(path, args)
                 if matches!(
                     path.kind,
-                    hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, _))
+                    hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, ..))
                 ) =>
             {
                 Some(Range {
@@ -228,27 +228,27 @@ impl<'a> Range<'a> {
                 })
             },
             hir::ExprKind::Struct(path, fields, None) => match &path {
-                hir::QPath::LangItem(hir::LangItem::RangeFull, _) => Some(Range {
+                hir::QPath::LangItem(hir::LangItem::RangeFull, ..) => Some(Range {
                     start: None,
                     end: None,
                     limits: ast::RangeLimits::HalfOpen,
                 }),
-                hir::QPath::LangItem(hir::LangItem::RangeFrom, _) => Some(Range {
+                hir::QPath::LangItem(hir::LangItem::RangeFrom, ..) => Some(Range {
                     start: Some(get_field("start", fields)?),
                     end: None,
                     limits: ast::RangeLimits::HalfOpen,
                 }),
-                hir::QPath::LangItem(hir::LangItem::Range, _) => Some(Range {
+                hir::QPath::LangItem(hir::LangItem::Range, ..) => Some(Range {
                     start: Some(get_field("start", fields)?),
                     end: Some(get_field("end", fields)?),
                     limits: ast::RangeLimits::HalfOpen,
                 }),
-                hir::QPath::LangItem(hir::LangItem::RangeToInclusive, _) => Some(Range {
+                hir::QPath::LangItem(hir::LangItem::RangeToInclusive, ..) => Some(Range {
                     start: None,
                     end: Some(get_field("end", fields)?),
                     limits: ast::RangeLimits::Closed,
                 }),
-                hir::QPath::LangItem(hir::LangItem::RangeTo, _) => Some(Range {
+                hir::QPath::LangItem(hir::LangItem::RangeTo, ..) => Some(Range {
                     start: None,
                     end: Some(get_field("end", fields)?),
                     limits: ast::RangeLimits::HalfOpen,
diff --git a/src/tools/clippy/clippy_utils/src/hir_utils.rs b/src/tools/clippy/clippy_utils/src/hir_utils.rs
index 7438b6eabf9..5b059e37886 100644
--- a/src/tools/clippy/clippy_utils/src/hir_utils.rs
+++ b/src/tools/clippy/clippy_utils/src/hir_utils.rs
@@ -346,7 +346,7 @@ impl HirEqInterExpr<'_, '_, '_> {
             (&QPath::TypeRelative(lty, lseg), &QPath::TypeRelative(rty, rseg)) => {
                 self.eq_ty(lty, rty) && self.eq_path_segment(lseg, rseg)
             },
-            (&QPath::LangItem(llang_item, _), &QPath::LangItem(rlang_item, _)) => llang_item == rlang_item,
+            (&QPath::LangItem(llang_item, ..), &QPath::LangItem(rlang_item, ..)) => llang_item == rlang_item,
             _ => false,
         }
     }
diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs
index f011380c127..8413b8c8280 100644
--- a/src/tools/clippy/clippy_utils/src/lib.rs
+++ b/src/tools/clippy/clippy_utils/src/lib.rs
@@ -1,6 +1,5 @@
 #![feature(box_patterns)]
 #![feature(in_band_lifetimes)]
-#![feature(iter_zip)]
 #![feature(let_else)]
 #![feature(rustc_private)]
 #![feature(control_flow_enum)]
diff --git a/src/tools/clippy/tests/ui/future_not_send.stderr b/src/tools/clippy/tests/ui/future_not_send.stderr
index 3cc05e2fdbe..a9f2ad36d0a 100644
--- a/src/tools/clippy/tests/ui/future_not_send.stderr
+++ b/src/tools/clippy/tests/ui/future_not_send.stderr
@@ -6,22 +6,22 @@ LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
    |
    = note: `-D clippy::future-not-send` implied by `-D warnings`
 note: future is not `Send` as this value is used across an await
-  --> $DIR/future_not_send.rs:8:5
+  --> $DIR/future_not_send.rs:8:19
    |
 LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
    |                         -- has type `std::rc::Rc<[u8]>` which is not `Send`
 LL |     async { true }.await
-   |     ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `rc` maybe used later
+   |                   ^^^^^^ await occurs here, with `rc` maybe used later
 LL | }
    | - `rc` is later dropped here
    = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
 note: future is not `Send` as this value is used across an await
-  --> $DIR/future_not_send.rs:8:5
+  --> $DIR/future_not_send.rs:8:19
    |
 LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
    |                                       ---- has type `&std::cell::Cell<usize>` which is not `Send`
 LL |     async { true }.await
-   |     ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `cell` maybe used later
+   |                   ^^^^^^ await occurs here, with `cell` maybe used later
 LL | }
    | - `cell` is later dropped here
    = note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync`
@@ -33,12 +33,12 @@ LL | pub async fn public_future(rc: Rc<[u8]>) {
    |                                          ^ future returned by `public_future` is not `Send`
    |
 note: future is not `Send` as this value is used across an await
-  --> $DIR/future_not_send.rs:12:5
+  --> $DIR/future_not_send.rs:12:19
    |
 LL | pub async fn public_future(rc: Rc<[u8]>) {
    |                            -- has type `std::rc::Rc<[u8]>` which is not `Send`
 LL |     async { true }.await;
-   |     ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `rc` maybe used later
+   |                   ^^^^^^ await occurs here, with `rc` maybe used later
 LL | }
    | - `rc` is later dropped here
    = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
@@ -82,12 +82,12 @@ LL |     async fn private_future(&self) -> usize {
    |                                       ^^^^^ future returned by `private_future` is not `Send`
    |
 note: future is not `Send` as this value is used across an await
-  --> $DIR/future_not_send.rs:35:9
+  --> $DIR/future_not_send.rs:35:23
    |
 LL |     async fn private_future(&self) -> usize {
    |                             ----- has type `&Dummy` which is not `Send`
 LL |         async { true }.await;
-   |         ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `&self` maybe used later
+   |                       ^^^^^^ await occurs here, with `&self` maybe used later
 LL |         self.rc.len()
 LL |     }
    |     - `&self` is later dropped here
@@ -100,12 +100,12 @@ LL |     pub async fn public_future(&self) {
    |                                       ^ future returned by `public_future` is not `Send`
    |
 note: future is not `Send` as this value is used across an await
-  --> $DIR/future_not_send.rs:40:9
+  --> $DIR/future_not_send.rs:40:30
    |
 LL |     pub async fn public_future(&self) {
    |                                ----- has type `&Dummy` which is not `Send`
 LL |         self.private_future().await;
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here, with `&self` maybe used later
+   |                              ^^^^^^ await occurs here, with `&self` maybe used later
 LL |     }
    |     - `&self` is later dropped here
    = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
@@ -117,12 +117,12 @@ LL | async fn generic_future<T>(t: T) -> T
    |                                     ^ future returned by `generic_future` is not `Send`
    |
 note: future is not `Send` as this value is used across an await
-  --> $DIR/future_not_send.rs:54:5
+  --> $DIR/future_not_send.rs:54:19
    |
 LL |     let rt = &t;
    |         -- has type `&T` which is not `Send`
 LL |     async { true }.await;
-   |     ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `rt` maybe used later
+   |                   ^^^^^^ await occurs here, with `rt` maybe used later
 LL |     t
 LL | }
    | - `rt` is later dropped here
diff --git a/src/tools/clippy/tests/ui/needless_late_init_fixable.fixed b/src/tools/clippy/tests/ui/needless_late_init_fixable.fixed
deleted file mode 100644
index 32d5d04fde4..00000000000
--- a/src/tools/clippy/tests/ui/needless_late_init_fixable.fixed
+++ /dev/null
@@ -1,38 +0,0 @@
-// run-rustfix
-
-#![allow(unused, clippy::assign_op_pattern)]
-
-fn main() {
-    
-    let a = "zero";
-
-    
-    
-    let b = 1;
-    let c = 2;
-
-    
-    let d: usize = 1;
-
-    
-    let mut e = 1;
-    e = 2;
-
-    
-    let f = match 1 {
-        1 => "three",
-        _ => return,
-    }; // has semi
-
-    
-    let g: usize = if true {
-        5
-    } else {
-        panic!();
-    };
-
-    
-    let h = format!("{}", e);
-
-    println!("{}", a);
-}
diff --git a/src/tools/clippy/tests/ui/needless_late_init_fixable.rs b/src/tools/clippy/tests/ui/needless_late_init_fixable.rs
index 6bc85f68632..76099df0e06 100644
--- a/src/tools/clippy/tests/ui/needless_late_init_fixable.rs
+++ b/src/tools/clippy/tests/ui/needless_late_init_fixable.rs
@@ -1,5 +1,3 @@
-// run-rustfix
-
 #![allow(unused, clippy::assign_op_pattern)]
 
 fn main() {
diff --git a/src/tools/clippy/tests/ui/needless_late_init_fixable.stderr b/src/tools/clippy/tests/ui/needless_late_init_fixable.stderr
index a0ce4f812f4..728e19252ea 100644
--- a/src/tools/clippy/tests/ui/needless_late_init_fixable.stderr
+++ b/src/tools/clippy/tests/ui/needless_late_init_fixable.stderr
@@ -1,5 +1,5 @@
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:6:5
+  --> $DIR/needless_late_init_fixable.rs:4:5
    |
 LL |     let a;
    |     ^^^^^^
@@ -11,7 +11,7 @@ LL |     let a = "zero";
    |     ~~~~~
 
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:9:5
+  --> $DIR/needless_late_init_fixable.rs:7:5
    |
 LL |     let b;
    |     ^^^^^^
@@ -22,7 +22,7 @@ LL |     let b = 1;
    |     ~~~~~
 
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:10:5
+  --> $DIR/needless_late_init_fixable.rs:8:5
    |
 LL |     let c;
    |     ^^^^^^
@@ -33,7 +33,7 @@ LL |     let c = 2;
    |     ~~~~~
 
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:14:5
+  --> $DIR/needless_late_init_fixable.rs:12:5
    |
 LL |     let d: usize;
    |     ^^^^^^^^^^^^^
@@ -44,7 +44,7 @@ LL |     let d: usize = 1;
    |     ~~~~~~~~~~~~
 
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:17:5
+  --> $DIR/needless_late_init_fixable.rs:15:5
    |
 LL |     let mut e;
    |     ^^^^^^^^^^
@@ -55,7 +55,7 @@ LL |     let mut e = 1;
    |     ~~~~~~~~~
 
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:21:5
+  --> $DIR/needless_late_init_fixable.rs:19:5
    |
 LL |     let f;
    |     ^^^^^^
@@ -66,11 +66,12 @@ LL |     let f = match 1 {
    |     +++++++
 help: remove the assignments from the `match` arms
    |
-LL |         1 => "three",
-   |              ~~~~~~~
+LL -         1 => f = "three",
+LL +         1 => "three",
+   | 
 
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:27:5
+  --> $DIR/needless_late_init_fixable.rs:25:5
    |
 LL |     let g: usize;
    |     ^^^^^^^^^^^^^
@@ -81,15 +82,16 @@ LL |     let g: usize = if true {
    |     ++++++++++++++
 help: remove the assignments from the branches
    |
-LL |         5
-   |
+LL -         g = 5;
+LL +         5
+   | 
 help: add a semicolon after the `if` expression
    |
 LL |     };
    |      +
 
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:34:5
+  --> $DIR/needless_late_init_fixable.rs:32:5
    |
 LL |     let h;
    |     ^^^^^^