about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--clippy_lints/Cargo.toml2
-rw-r--r--clippy_lints/src/init_numbered_fields.rs2
-rw-r--r--clippy_lints/src/methods/unnecessary_literal_unwrap.rs15
-rw-r--r--clippy_lints/src/methods/unnecessary_to_owned.rs4
-rw-r--r--clippy_lints/src/mixed_read_write_in_expression.rs20
-rw-r--r--clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs4
-rw-r--r--clippy_utils/Cargo.toml2
-rw-r--r--clippy_utils/src/lib.rs2
-rw-r--r--clippy_utils/src/macros.rs16
-rw-r--r--clippy_utils/src/mir/mod.rs32
-rw-r--r--clippy_utils/src/qualify_min_const_fn.rs1
-rw-r--r--clippy_utils/src/ty/type_certainty/mod.rs2
-rw-r--r--declare_clippy_lint/Cargo.toml2
-rw-r--r--rust-toolchain2
-rw-r--r--tests/ui-toml/too_many_arguments/too_many_arguments.stderr2
-rw-r--r--tests/ui/crashes/ice-10645.stderr4
-rw-r--r--tests/ui/functions.stderr6
-rw-r--r--tests/ui/future_not_send.stderr37
-rw-r--r--tests/ui/match_same_arms_non_exhaustive.rs20
-rw-r--r--tests/ui/match_same_arms_non_exhaustive.stderr16
-rw-r--r--tests/ui/must_use_unit.stderr4
-rw-r--r--tests/ui/unnecessary_literal_unwrap.fixed4
-rw-r--r--tests/ui/unnecessary_literal_unwrap.stderr4
24 files changed, 118 insertions, 87 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 1eacc82d560..cbcb42dad79 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "clippy"
-version = "0.1.74"
+version = "0.1.75"
 description = "A bunch of helpful lints to avoid common pitfalls in Rust"
 repository = "https://github.com/rust-lang/rust-clippy"
 readme = "README.md"
diff --git a/clippy_lints/Cargo.toml b/clippy_lints/Cargo.toml
index 834753a2301..4d5b3bf8a94 100644
--- a/clippy_lints/Cargo.toml
+++ b/clippy_lints/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "clippy_lints"
-version = "0.1.74"
+version = "0.1.75"
 description = "A bunch of helpful lints to avoid common pitfalls in Rust"
 repository = "https://github.com/rust-lang/rust-clippy"
 readme = "README.md"
diff --git a/clippy_lints/src/init_numbered_fields.rs b/clippy_lints/src/init_numbered_fields.rs
index b00fa104f98..f95d2c2edb1 100644
--- a/clippy_lints/src/init_numbered_fields.rs
+++ b/clippy_lints/src/init_numbered_fields.rs
@@ -50,7 +50,7 @@ impl<'tcx> LateLintPass<'tcx> for NumberedFields {
                 && fields
                     .iter()
                     .all(|f| f.ident.as_str().as_bytes().iter().all(u8::is_ascii_digit))
-                && !matches!(cx.qpath_res(path, e.hir_id), Res::Def(DefKind::TyAlias { .. }, ..))
+                && !matches!(cx.qpath_res(path, e.hir_id), Res::Def(DefKind::TyAlias, ..))
             {
                 let expr_spans = fields
                     .iter()
diff --git a/clippy_lints/src/methods/unnecessary_literal_unwrap.rs b/clippy_lints/src/methods/unnecessary_literal_unwrap.rs
index 937aac8d25e..3e19d72ec91 100644
--- a/clippy_lints/src/methods/unnecessary_literal_unwrap.rs
+++ b/clippy_lints/src/methods/unnecessary_literal_unwrap.rs
@@ -24,7 +24,6 @@ fn get_ty_from_args<'a>(args: Option<&'a [hir::GenericArg<'a>]>, index: usize) -
     }
 }
 
-#[expect(clippy::too_many_lines)]
 pub(super) fn check(
     cx: &LateContext<'_>,
     expr: &hir::Expr<'_>,
@@ -101,15 +100,11 @@ pub(super) fn check(
                 (expr.span.with_lo(args[0].span.hi()), String::new()),
             ]),
             ("None", "unwrap_or_else", _) => match args[0].kind {
-                hir::ExprKind::Closure(hir::Closure {
-                    fn_decl:
-                        hir::FnDecl {
-                            output: hir::FnRetTy::DefaultReturn(span) | hir::FnRetTy::Return(hir::Ty { span, .. }),
-                            ..
-                        },
-                    ..
-                }) => Some(vec![
-                    (expr.span.with_hi(span.hi()), String::new()),
+                hir::ExprKind::Closure(hir::Closure { body, .. }) => Some(vec![
+                    (
+                        expr.span.with_hi(cx.tcx.hir().body(*body).value.span.lo()),
+                        String::new(),
+                    ),
                     (expr.span.with_lo(args[0].span.hi()), String::new()),
                 ]),
                 _ => None,
diff --git a/clippy_lints/src/methods/unnecessary_to_owned.rs b/clippy_lints/src/methods/unnecessary_to_owned.rs
index 5c5ee262052..50d6f3b7e55 100644
--- a/clippy_lints/src/methods/unnecessary_to_owned.rs
+++ b/clippy_lints/src/methods/unnecessary_to_owned.rs
@@ -401,7 +401,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
                     = get_callee_generic_args_and_args(cx, parent_expr)
                 {
                     // FIXME: the `instantiate_identity()` below seems incorrect, since we eventually
-                    // call `tcx.try_subst_and_normalize_erasing_regions` further down
+                    // call `tcx.try_instantiate_and_normalize_erasing_regions` further down
                     // (i.e., we are explicitly not in the identity context).
                     let fn_sig = cx.tcx.fn_sig(callee_def_id).instantiate_identity().skip_binder();
                     if let Some(arg_index) = recv.into_iter().chain(call_args).position(|arg| arg.hir_id == expr.hir_id)
@@ -452,7 +452,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty<
 
                         let output_ty = fn_sig.output();
                         if output_ty.contains(*param_ty) {
-                            if let Ok(new_ty)  = cx.tcx.try_subst_and_normalize_erasing_regions(
+                            if let Ok(new_ty)  = cx.tcx.try_instantiate_and_normalize_erasing_regions(
                                 new_subst, cx.param_env, EarlyBinder::bind(output_ty)) {
                                 expr = parent_expr;
                                 ty = new_ty;
diff --git a/clippy_lints/src/mixed_read_write_in_expression.rs b/clippy_lints/src/mixed_read_write_in_expression.rs
index 367cd6bd413..e87aea263d4 100644
--- a/clippy_lints/src/mixed_read_write_in_expression.rs
+++ b/clippy_lints/src/mixed_read_write_in_expression.rs
@@ -134,15 +134,27 @@ impl<'a, 'tcx> DivergenceVisitor<'a, 'tcx> {
     }
 }
 
+fn stmt_might_diverge(stmt: &Stmt<'_>) -> bool {
+    !matches!(stmt.kind, StmtKind::Item(..))
+}
+
 impl<'a, 'tcx> Visitor<'tcx> for DivergenceVisitor<'a, 'tcx> {
     fn visit_expr(&mut self, e: &'tcx Expr<'_>) {
         match e.kind {
             // fix #10776
             ExprKind::Block(block, ..) => match (block.stmts, block.expr) {
-                ([], Some(e)) => self.visit_expr(e),
-                ([stmt], None) => match stmt.kind {
-                    StmtKind::Expr(e) | StmtKind::Semi(e) => self.visit_expr(e),
-                    _ => {},
+                (stmts, Some(e)) => {
+                    if stmts.iter().all(|stmt| !stmt_might_diverge(stmt)) {
+                        self.visit_expr(e);
+                    }
+                },
+                ([first @ .., stmt], None) => {
+                    if first.iter().all(|stmt| !stmt_might_diverge(stmt)) {
+                        match stmt.kind {
+                            StmtKind::Expr(e) | StmtKind::Semi(e) => self.visit_expr(e),
+                            _ => {},
+                        }
+                    }
                 },
                 _ => {},
             },
diff --git a/clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs b/clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs
index 87380f14f9a..bbb5ade8b9f 100644
--- a/clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs
+++ b/clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs
@@ -28,8 +28,8 @@ declare_clippy_lint! {
     /// know the name of the lint.
     ///
     /// ### Known problems
-    /// Only checks for lints associated using the
-    /// `declare_lint_pass!`, `impl_lint_pass!`, and `lint_array!` macros.
+    /// Only checks for lints associated using the `declare_lint_pass!` and
+    /// `impl_lint_pass!` macros.
     ///
     /// ### Example
     /// ```rust,ignore
diff --git a/clippy_utils/Cargo.toml b/clippy_utils/Cargo.toml
index 1596bb77397..8522493f67b 100644
--- a/clippy_utils/Cargo.toml
+++ b/clippy_utils/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "clippy_utils"
-version = "0.1.74"
+version = "0.1.75"
 edition = "2021"
 publish = false
 
diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs
index 6711d007388..7e2e4f74ca1 100644
--- a/clippy_utils/src/lib.rs
+++ b/clippy_utils/src/lib.rs
@@ -287,7 +287,7 @@ pub fn is_wild(pat: &Pat<'_>) -> bool {
 /// Checks if the given `QPath` belongs to a type alias.
 pub fn is_ty_alias(qpath: &QPath<'_>) -> bool {
     match *qpath {
-        QPath::Resolved(_, path) => matches!(path.res, Res::Def(DefKind::TyAlias { .. } | DefKind::AssocTy, ..)),
+        QPath::Resolved(_, path) => matches!(path.res, Res::Def(DefKind::TyAlias | DefKind::AssocTy, ..)),
         QPath::TypeRelative(ty, _) if let TyKind::Path(qpath) = ty.kind => { is_ty_alias(&qpath) },
         _ => false,
     }
diff --git a/clippy_utils/src/macros.rs b/clippy_utils/src/macros.rs
index 82508bcdb85..eaf590f6ad7 100644
--- a/clippy_utils/src/macros.rs
+++ b/clippy_utils/src/macros.rs
@@ -228,16 +228,26 @@ pub enum PanicExpn<'a> {
 
 impl<'a> PanicExpn<'a> {
     pub fn parse(expr: &'a Expr<'a>) -> Option<Self> {
-        let ExprKind::Call(callee, [arg, rest @ ..]) = &expr.kind else {
+        let ExprKind::Call(callee, args) = &expr.kind else {
             return None;
         };
         let ExprKind::Path(QPath::Resolved(_, path)) = &callee.kind else {
             return None;
         };
-        let result = match path.segments.last().unwrap().ident.as_str() {
+        let name = path.segments.last().unwrap().ident.as_str();
+
+        // This has no argument
+        if name == "panic_cold_explicit" {
+            return Some(Self::Empty);
+        };
+
+        let [arg, rest @ ..] = args else {
+            return None;
+        };
+        let result = match name {
             "panic" if arg.span.ctxt() == expr.span.ctxt() => Self::Empty,
             "panic" | "panic_str" => Self::Str(arg),
-            "panic_display" => {
+            "panic_display" | "panic_cold_display" => {
                 let ExprKind::AddrOf(_, _, e) = &arg.kind else {
                     return None;
                 };
diff --git a/clippy_utils/src/mir/mod.rs b/clippy_utils/src/mir/mod.rs
index f04467dc19d..9dbb4c68d13 100644
--- a/clippy_utils/src/mir/mod.rs
+++ b/clippy_utils/src/mir/mod.rs
@@ -30,20 +30,26 @@ pub fn visit_local_usage(locals: &[Local], mir: &Body<'_>, location: Location) -
         locals.len()
     ];
 
-    traversal::ReversePostorder::new(mir, location.block).try_fold(init, |usage, (tbb, tdata)| {
-        // Give up on loops
-        if tdata.terminator().successors().any(|s| s == location.block) {
-            return None;
-        }
+    traversal::Postorder::new(&mir.basic_blocks, location.block)
+        .collect::<Vec<_>>()
+        .into_iter()
+        .rev()
+        .try_fold(init, |usage, tbb| {
+            let tdata = &mir.basic_blocks[tbb];
+
+            // Give up on loops
+            if tdata.terminator().successors().any(|s| s == location.block) {
+                return None;
+            }
 
-        let mut v = V {
-            locals,
-            location,
-            results: usage,
-        };
-        v.visit_basic_block_data(tbb, tdata);
-        Some(v.results)
-    })
+            let mut v = V {
+                locals,
+                location,
+                results: usage,
+            };
+            v.visit_basic_block_data(tbb, tdata);
+            Some(v.results)
+        })
 }
 
 struct V<'a> {
diff --git a/clippy_utils/src/qualify_min_const_fn.rs b/clippy_utils/src/qualify_min_const_fn.rs
index 17233058c9c..55f9cb27ad4 100644
--- a/clippy_utils/src/qualify_min_const_fn.rs
+++ b/clippy_utils/src/qualify_min_const_fn.rs
@@ -272,6 +272,7 @@ fn check_place<'tcx>(tcx: TyCtxt<'tcx>, place: Place<'tcx>, span: Span, body: &B
             | ProjectionElem::Downcast(..)
             | ProjectionElem::Subslice { .. }
             | ProjectionElem::Deref
+            | ProjectionElem::Subtype(_)
             | ProjectionElem::Index(_) => {},
         }
     }
diff --git a/clippy_utils/src/ty/type_certainty/mod.rs b/clippy_utils/src/ty/type_certainty/mod.rs
index d05d9e7640f..75064672326 100644
--- a/clippy_utils/src/ty/type_certainty/mod.rs
+++ b/clippy_utils/src/ty/type_certainty/mod.rs
@@ -219,7 +219,7 @@ fn path_segment_certainty(
                 // See the comment preceding `qpath_certainty`. `def_id` could refer to a type or a value.
                 let certainty = lhs.join_clearing_def_ids(rhs);
                 if resolves_to_type {
-                    if let DefKind::TyAlias { .. } = cx.tcx.def_kind(def_id) {
+                    if let DefKind::TyAlias = cx.tcx.def_kind(def_id) {
                         adt_def_id(cx.tcx.type_of(def_id).instantiate_identity())
                             .map_or(certainty, |def_id| certainty.with_def_id(def_id))
                     } else {
diff --git a/declare_clippy_lint/Cargo.toml b/declare_clippy_lint/Cargo.toml
index 1470da61fac..beea9fd00e7 100644
--- a/declare_clippy_lint/Cargo.toml
+++ b/declare_clippy_lint/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "declare_clippy_lint"
-version = "0.1.74"
+version = "0.1.75"
 edition = "2021"
 publish = false
 
diff --git a/rust-toolchain b/rust-toolchain
index 5ce22b65f00..fe2c77ab47f 100644
--- a/rust-toolchain
+++ b/rust-toolchain
@@ -1,3 +1,3 @@
 [toolchain]
-channel = "nightly-2023-09-25"
+channel = "nightly-2023-10-06"
 components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
diff --git a/tests/ui-toml/too_many_arguments/too_many_arguments.stderr b/tests/ui-toml/too_many_arguments/too_many_arguments.stderr
index a52e1fcb9e3..8b9d159b59c 100644
--- a/tests/ui-toml/too_many_arguments/too_many_arguments.stderr
+++ b/tests/ui-toml/too_many_arguments/too_many_arguments.stderr
@@ -2,7 +2,7 @@ error: this function has too many arguments (11/10)
   --> $DIR/too_many_arguments.rs:4:1
    |
 LL | fn too_many(p1: u8, p2: u8, p3: u8, p4: u8, p5: u8, p6: u8, p7: u8, p8: u8, p9: u8, p10: u8, p11: u8) {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::too-many-arguments` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::too_many_arguments)]`
diff --git a/tests/ui/crashes/ice-10645.stderr b/tests/ui/crashes/ice-10645.stderr
index fc5347c86cd..7fc62d4fcf8 100644
--- a/tests/ui/crashes/ice-10645.stderr
+++ b/tests/ui/crashes/ice-10645.stderr
@@ -1,8 +1,8 @@
 warning: future cannot be sent between threads safely
-  --> $DIR/ice-10645.rs:5:35
+  --> $DIR/ice-10645.rs:5:1
    |
 LL | pub async fn bar<'a, T: 'a>(_: T) {}
-   |                                   ^ future returned by `bar` is not `Send`
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `bar` is not `Send`
    |
 note: captured value is not `Send`
   --> $DIR/ice-10645.rs:5:29
diff --git a/tests/ui/functions.stderr b/tests/ui/functions.stderr
index 371ea161260..4b06cd03889 100644
--- a/tests/ui/functions.stderr
+++ b/tests/ui/functions.stderr
@@ -2,7 +2,7 @@ error: this function has too many arguments (8/7)
   --> $DIR/functions.rs:8:1
    |
 LL | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::too-many-arguments` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::too_many_arguments)]`
@@ -17,7 +17,7 @@ LL | |     two: u32,
 ...  |
 LL | |     eight: ()
 LL | | ) {
-   | |__^
+   | |_^
 
 error: this function has too many arguments (8/7)
   --> $DIR/functions.rs:48:5
@@ -29,7 +29,7 @@ error: this function has too many arguments (8/7)
   --> $DIR/functions.rs:58:5
    |
 LL |     fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: this public function might dereference a raw pointer but is not marked `unsafe`
   --> $DIR/functions.rs:68:34
diff --git a/tests/ui/future_not_send.stderr b/tests/ui/future_not_send.stderr
index f43e3c8ff9f..7ef4947f1d6 100644
--- a/tests/ui/future_not_send.stderr
+++ b/tests/ui/future_not_send.stderr
@@ -1,8 +1,8 @@
 error: future cannot be sent between threads safely
-  --> $DIR/future_not_send.rs:7:62
+  --> $DIR/future_not_send.rs:7:1
    |
 LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
-   |                                                              ^^^^ future returned by `private_future` is not `Send`
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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:9:20
@@ -23,10 +23,10 @@ LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
    = help: to override `-D warnings` add `#[allow(clippy::future_not_send)]`
 
 error: future cannot be sent between threads safely
-  --> $DIR/future_not_send.rs:12:42
+  --> $DIR/future_not_send.rs:12:1
    |
 LL | pub async fn public_future(rc: Rc<[u8]>) {
-   |                                          ^ future returned by `public_future` is not `Send`
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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:14:20
@@ -39,10 +39,10 @@ LL |     async { true }.await;
    = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
 
 error: future cannot be sent between threads safely
-  --> $DIR/future_not_send.rs:21:63
+  --> $DIR/future_not_send.rs:21:1
    |
 LL | async fn private_future2(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
-   |                                                               ^^^^ future returned by `private_future2` is not `Send`
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `private_future2` is not `Send`
    |
 note: captured value is not `Send`
   --> $DIR/future_not_send.rs:21:26
@@ -58,10 +58,10 @@ LL | async fn private_future2(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
    = note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync`
 
 error: future cannot be sent between threads safely
-  --> $DIR/future_not_send.rs:26:43
+  --> $DIR/future_not_send.rs:26:1
    |
 LL | pub async fn public_future2(rc: Rc<[u8]>) {}
-   |                                           ^ future returned by `public_future2` is not `Send`
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `public_future2` is not `Send`
    |
 note: captured value is not `Send`
   --> $DIR/future_not_send.rs:26:29
@@ -71,10 +71,10 @@ LL | pub async fn public_future2(rc: Rc<[u8]>) {}
    = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
 
 error: future cannot be sent between threads safely
-  --> $DIR/future_not_send.rs:38:39
+  --> $DIR/future_not_send.rs:38:5
    |
 LL |     async fn private_future(&self) -> usize {
-   |                                       ^^^^^ future returned by `private_future` is not `Send`
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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:40:24
@@ -87,10 +87,10 @@ LL |         async { true }.await;
    = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
 
 error: future cannot be sent between threads safely
-  --> $DIR/future_not_send.rs:44:39
+  --> $DIR/future_not_send.rs:44:5
    |
 LL |     pub async fn public_future(&self) {
-   |                                       ^ future returned by `public_future` is not `Send`
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `public_future` is not `Send`
    |
 note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
   --> $DIR/future_not_send.rs:44:32
@@ -100,10 +100,13 @@ LL |     pub async fn public_future(&self) {
    = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
 
 error: future cannot be sent between threads safely
-  --> $DIR/future_not_send.rs:55:37
+  --> $DIR/future_not_send.rs:55:1
    |
-LL | async fn generic_future<T>(t: T) -> T
-   |                                     ^ future returned by `generic_future` is not `Send`
+LL | / async fn generic_future<T>(t: T) -> T
+LL | |
+LL | | where
+LL | |     T: Send,
+   | |____________^ 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:61:20
@@ -115,10 +118,10 @@ LL |     async { true }.await;
    = note: `T` doesn't implement `std::marker::Sync`
 
 error: future cannot be sent between threads safely
-  --> $DIR/future_not_send.rs:73:34
+  --> $DIR/future_not_send.rs:73:1
    |
 LL | async fn unclear_future<T>(t: T) {}
-   |                                  ^ future returned by `unclear_future` is not `Send`
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `unclear_future` is not `Send`
    |
 note: captured value is not `Send`
   --> $DIR/future_not_send.rs:73:28
diff --git a/tests/ui/match_same_arms_non_exhaustive.rs b/tests/ui/match_same_arms_non_exhaustive.rs
index 1ee048bf7f6..e1b95aa5776 100644
--- a/tests/ui/match_same_arms_non_exhaustive.rs
+++ b/tests/ui/match_same_arms_non_exhaustive.rs
@@ -4,14 +4,18 @@
 //@no-rustfix
 use std::sync::atomic::Ordering; // #[non_exhaustive] enum
 
+fn repeat() -> ! {
+    panic!()
+}
+
 pub fn f(x: Ordering) {
     match x {
         Ordering::Relaxed => println!("relaxed"),
         Ordering::Release => println!("release"),
         Ordering::Acquire => println!("acquire"),
-        Ordering::AcqRel | Ordering::SeqCst => panic!(),
+        Ordering::AcqRel | Ordering::SeqCst => repeat(),
         #[deny(non_exhaustive_omitted_patterns)]
-        _ => panic!(),
+        _ => repeat(),
     }
 }
 
@@ -25,8 +29,8 @@ mod f {
             Ordering::Relaxed => println!("relaxed"),
             Ordering::Release => println!("release"),
             Ordering::Acquire => println!("acquire"),
-            Ordering::AcqRel | Ordering::SeqCst => panic!(),
-            _ => panic!(),
+            Ordering::AcqRel | Ordering::SeqCst => repeat(),
+            _ => repeat(),
         }
     }
 }
@@ -38,9 +42,9 @@ pub fn g(x: Ordering) {
         Ordering::Relaxed => println!("relaxed"),
         Ordering::Release => println!("release"),
         Ordering::Acquire => println!("acquire"),
-        Ordering::AcqRel | Ordering::SeqCst => panic!(),
+        Ordering::AcqRel | Ordering::SeqCst => repeat(),
         //~^ ERROR: this match arm has an identical body to the `_` wildcard arm
-        _ => panic!(),
+        _ => repeat(),
     }
 }
 
@@ -52,9 +56,9 @@ mod g {
             Ordering::Relaxed => println!("relaxed"),
             Ordering::Release => println!("release"),
             Ordering::Acquire => println!("acquire"),
-            Ordering::AcqRel | Ordering::SeqCst => panic!(),
+            Ordering::AcqRel | Ordering::SeqCst => repeat(),
             //~^ ERROR: this match arm has an identical body to the `_` wildcard arm
-            _ => panic!(),
+            _ => repeat(),
         }
     }
 }
diff --git a/tests/ui/match_same_arms_non_exhaustive.stderr b/tests/ui/match_same_arms_non_exhaustive.stderr
index a039536338b..ae6b02ab1b5 100644
--- a/tests/ui/match_same_arms_non_exhaustive.stderr
+++ b/tests/ui/match_same_arms_non_exhaustive.stderr
@@ -1,29 +1,29 @@
 error: this match arm has an identical body to the `_` wildcard arm
-  --> $DIR/match_same_arms_non_exhaustive.rs:41:9
+  --> $DIR/match_same_arms_non_exhaustive.rs:45:9
    |
-LL |         Ordering::AcqRel | Ordering::SeqCst => panic!(),
+LL |         Ordering::AcqRel | Ordering::SeqCst => repeat(),
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the arm
    |
    = help: or try changing either arm body
 note: `_` wildcard arm here
-  --> $DIR/match_same_arms_non_exhaustive.rs:43:9
+  --> $DIR/match_same_arms_non_exhaustive.rs:47:9
    |
-LL |         _ => panic!(),
+LL |         _ => repeat(),
    |         ^^^^^^^^^^^^^
    = note: `-D clippy::match-same-arms` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::match_same_arms)]`
 
 error: this match arm has an identical body to the `_` wildcard arm
-  --> $DIR/match_same_arms_non_exhaustive.rs:55:13
+  --> $DIR/match_same_arms_non_exhaustive.rs:59:13
    |
-LL |             Ordering::AcqRel | Ordering::SeqCst => panic!(),
+LL |             Ordering::AcqRel | Ordering::SeqCst => repeat(),
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the arm
    |
    = help: or try changing either arm body
 note: `_` wildcard arm here
-  --> $DIR/match_same_arms_non_exhaustive.rs:57:13
+  --> $DIR/match_same_arms_non_exhaustive.rs:61:13
    |
-LL |             _ => panic!(),
+LL |             _ => repeat(),
    |             ^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/must_use_unit.stderr b/tests/ui/must_use_unit.stderr
index e67d9b5b9d8..f2ee185857d 100644
--- a/tests/ui/must_use_unit.stderr
+++ b/tests/ui/must_use_unit.stderr
@@ -4,7 +4,7 @@ error: this unit-returning function has a `#[must_use]` attribute
 LL | #[must_use]
    | ----------- help: remove the attribute
 LL | pub fn must_use_default() {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::must-use-unit` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::must_use_unit)]`
@@ -23,7 +23,7 @@ error: this unit-returning function has a `#[must_use]` attribute
 LL | #[must_use = "With note"]
    | ------------------------- help: remove the attribute
 LL | pub fn must_use_with_note() {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/unnecessary_literal_unwrap.fixed b/tests/ui/unnecessary_literal_unwrap.fixed
index 87df1f8cb08..b17343aa9ba 100644
--- a/tests/ui/unnecessary_literal_unwrap.fixed
+++ b/tests/ui/unnecessary_literal_unwrap.fixed
@@ -23,7 +23,7 @@ fn unwrap_option_none() {
     let _val: u16 = 234;
     let _val: u16 = 234;
     let _val: u16 = { 234 };
-    let _val: u16 =  { 234 };
+    let _val: u16 = { 234 };
 
     panic!();
     panic!("this always happens");
@@ -31,7 +31,7 @@ fn unwrap_option_none() {
     234;
     234;
     { 234 };
-     { 234 };
+    { 234 };
 }
 
 fn unwrap_result_ok() {
diff --git a/tests/ui/unnecessary_literal_unwrap.stderr b/tests/ui/unnecessary_literal_unwrap.stderr
index 013907f59c4..4940091be60 100644
--- a/tests/ui/unnecessary_literal_unwrap.stderr
+++ b/tests/ui/unnecessary_literal_unwrap.stderr
@@ -116,7 +116,7 @@ LL |     let _val: u16 = None.unwrap_or_else(|| -> u16 { 234 });
 help: remove the `None` and `unwrap_or_else()`
    |
 LL -     let _val: u16 = None.unwrap_or_else(|| -> u16 { 234 });
-LL +     let _val: u16 =  { 234 };
+LL +     let _val: u16 = { 234 };
    |
 
 error: used `unwrap()` on `None` value
@@ -187,7 +187,7 @@ LL |     None::<u16>.unwrap_or_else(|| -> u16 { 234 });
 help: remove the `None` and `unwrap_or_else()`
    |
 LL -     None::<u16>.unwrap_or_else(|| -> u16 { 234 });
-LL +      { 234 };
+LL +     { 234 };
    |
 
 error: used `unwrap()` on `Ok` value