about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/compile-test.rs2
-rw-r--r--tests/ui-internal/custom_ice_message.stderr2
-rw-r--r--tests/ui-internal/invalid_paths.rs2
-rw-r--r--tests/ui-internal/unnecessary_def_path.fixed6
-rw-r--r--tests/ui-internal/unnecessary_def_path.rs6
-rw-r--r--tests/ui-internal/unnecessary_def_path_hardcoded_path.rs16
-rw-r--r--tests/ui-internal/unnecessary_def_path_hardcoded_path.stderr27
-rw-r--r--tests/ui/as_ptr_cast_mut.rs37
-rw-r--r--tests/ui/as_ptr_cast_mut.stderr16
-rw-r--r--tests/ui/author.stdout24
-rw-r--r--tests/ui/author/blocks.stdout116
-rw-r--r--tests/ui/author/call.stdout28
-rw-r--r--tests/ui/author/if.stdout92
-rw-r--r--tests/ui/author/issue_3849.stdout24
-rw-r--r--tests/ui/author/loop.stdout202
-rw-r--r--tests/ui/author/matches.stdout72
-rw-r--r--tests/ui/author/repeat.stdout20
-rw-r--r--tests/ui/author/struct.stdout112
-rw-r--r--tests/ui/box_default.fixed43
-rw-r--r--tests/ui/box_default.rs14
-rw-r--r--tests/ui/box_default.stderr77
-rw-r--r--tests/ui/box_default_no_std.rs33
-rw-r--r--tests/ui/cast_nan_to_int.rs18
-rw-r--r--tests/ui/cast_nan_to_int.stderr51
-rw-r--r--tests/ui/crashes/ice-9625.rs4
-rw-r--r--tests/ui/default_numeric_fallback_f64.fixed9
-rw-r--r--tests/ui/default_numeric_fallback_f64.rs9
-rw-r--r--tests/ui/default_numeric_fallback_f64.stderr34
-rw-r--r--tests/ui/default_numeric_fallback_i32.fixed10
-rw-r--r--tests/ui/default_numeric_fallback_i32.rs10
-rw-r--r--tests/ui/default_numeric_fallback_i32.stderr34
-rw-r--r--tests/ui/derive.rs1
-rw-r--r--tests/ui/derive.stderr20
-rw-r--r--tests/ui/expect_tool_lint_rfc_2383.rs12
-rw-r--r--tests/ui/format_args.fixed3
-rw-r--r--tests/ui/format_args.rs3
-rw-r--r--tests/ui/format_args.stderr60
-rw-r--r--tests/ui/from_over_into.fixed62
-rw-r--r--tests/ui/from_over_into.rs41
-rw-r--r--tests/ui/from_over_into.stderr57
-rw-r--r--tests/ui/from_over_into_unfixable.rs35
-rw-r--r--tests/ui/from_over_into_unfixable.stderr29
-rw-r--r--tests/ui/implicit_saturating_sub.fixed50
-rw-r--r--tests/ui/implicit_saturating_sub.rs50
-rw-r--r--tests/ui/implicit_saturating_sub.stderr46
-rw-r--r--tests/ui/literals.rs7
-rw-r--r--tests/ui/literals.stderr35
-rw-r--r--tests/ui/manual_assert.edition2018.fixed39
-rw-r--r--tests/ui/manual_assert.edition2018.stderr97
-rw-r--r--tests/ui/manual_assert.edition2021.fixed4
-rw-r--r--tests/ui/manual_assert.rs4
-rw-r--r--tests/ui/manual_filter.fixed119
-rw-r--r--tests/ui/manual_filter.rs243
-rw-r--r--tests/ui/manual_filter.stderr191
-rw-r--r--tests/ui/match_overlapping_arm.rs1
-rw-r--r--tests/ui/match_overlapping_arm.stderr32
-rw-r--r--tests/ui/match_single_binding.fixed9
-rw-r--r--tests/ui/match_single_binding.rs8
-rw-r--r--tests/ui/match_single_binding.stderr19
-rw-r--r--tests/ui/match_wild_err_arm.edition2021.stderr35
-rw-r--r--tests/ui/match_wild_err_arm.rs3
-rw-r--r--tests/ui/match_wild_err_arm.stderr (renamed from tests/ui/match_wild_err_arm.edition2018.stderr)8
-rw-r--r--tests/ui/needless_borrow.fixed62
-rw-r--r--tests/ui/needless_borrow.rs60
-rw-r--r--tests/ui/needless_borrow.stderr96
-rw-r--r--tests/ui/or_fun_call.fixed11
-rw-r--r--tests/ui/or_fun_call.rs11
-rw-r--r--tests/ui/partial_pub_fields.rs40
-rw-r--r--tests/ui/partial_pub_fields.stderr35
-rw-r--r--tests/ui/ptr_arg.rs30
-rw-r--r--tests/ui/ptr_arg.stderr20
-rw-r--r--tests/ui/temporary_assignment.rs1
-rw-r--r--tests/ui/temporary_assignment.stderr8
-rw-r--r--tests/ui/uninlined_format_args.fixed13
-rw-r--r--tests/ui/uninlined_format_args.rs13
-rw-r--r--tests/ui/uninlined_format_args.stderr40
-rw-r--r--tests/ui/uninlined_format_args_panic.edition2018.fixed29
-rw-r--r--tests/ui/uninlined_format_args_panic.edition2018.stderr15
-rw-r--r--tests/ui/uninlined_format_args_panic.edition2021.fixed29
-rw-r--r--tests/ui/uninlined_format_args_panic.edition2021.stderr51
-rw-r--r--tests/ui/uninlined_format_args_panic.rs29
-rw-r--r--tests/ui/unnecessary_cast.fixed4
-rw-r--r--tests/ui/unnecessary_cast.rs4
-rw-r--r--tests/ui/unnecessary_to_owned.fixed2
-rw-r--r--tests/ui/unnecessary_to_owned.rs2
-rw-r--r--tests/ui/unused_format_specs.fixed18
-rw-r--r--tests/ui/unused_format_specs.rs18
-rw-r--r--tests/ui/unused_format_specs.stderr54
-rw-r--r--tests/ui/unused_format_specs_unfixable.rs30
-rw-r--r--tests/ui/unused_format_specs_unfixable.stderr69
-rw-r--r--tests/versioncheck.rs2
91 files changed, 2553 insertions, 716 deletions
diff --git a/tests/compile-test.rs b/tests/compile-test.rs
index fa769222d1a..c10ee969c01 100644
--- a/tests/compile-test.rs
+++ b/tests/compile-test.rs
@@ -283,7 +283,7 @@ fn run_ui_cargo() {
                 env::set_current_dir(&src_path)?;
 
                 let cargo_toml_path = case.path().join("Cargo.toml");
-                let cargo_content = fs::read(&cargo_toml_path)?;
+                let cargo_content = fs::read(cargo_toml_path)?;
                 let cargo_parsed: toml::Value = toml::from_str(
                     std::str::from_utf8(&cargo_content).expect("`Cargo.toml` is not a valid utf-8 file!"),
                 )
diff --git a/tests/ui-internal/custom_ice_message.stderr b/tests/ui-internal/custom_ice_message.stderr
index a1b8e2ee162..07c5941013c 100644
--- a/tests/ui-internal/custom_ice_message.stderr
+++ b/tests/ui-internal/custom_ice_message.stderr
@@ -1,4 +1,4 @@
-thread 'rustc' panicked at 'Would you like some help with that?', clippy_lints/src/utils/internal_lints.rs
+thread 'rustc' panicked at 'Would you like some help with that?', clippy_lints/src/utils/internal_lints/produce_ice.rs:28:9
 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
 
 error: internal compiler error: unexpected panic
diff --git a/tests/ui-internal/invalid_paths.rs b/tests/ui-internal/invalid_paths.rs
index b823ff7fe37..9a9790a4bae 100644
--- a/tests/ui-internal/invalid_paths.rs
+++ b/tests/ui-internal/invalid_paths.rs
@@ -1,5 +1,5 @@
 #![warn(clippy::internal)]
-#![allow(clippy::missing_clippy_version_attribute)]
+#![allow(clippy::missing_clippy_version_attribute, clippy::unnecessary_def_path)]
 
 mod paths {
     // Good path
diff --git a/tests/ui-internal/unnecessary_def_path.fixed b/tests/ui-internal/unnecessary_def_path.fixed
index 4c050332f2c..cbbb4652306 100644
--- a/tests/ui-internal/unnecessary_def_path.fixed
+++ b/tests/ui-internal/unnecessary_def_path.fixed
@@ -28,9 +28,9 @@ use rustc_hir::Expr;
 use rustc_lint::LateContext;
 use rustc_middle::ty::Ty;
 
-#[allow(unused)]
+#[allow(unused, clippy::unnecessary_def_path)]
 static OPTION: [&str; 3] = ["core", "option", "Option"];
-#[allow(unused)]
+#[allow(unused, clippy::unnecessary_def_path)]
 const RESULT: &[&str] = &["core", "result", "Result"];
 
 fn _f<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, did: DefId, expr: &Expr<'_>) {
@@ -38,7 +38,7 @@ fn _f<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, did: DefId, expr: &Expr<'_>) {
     let _ = is_type_diagnostic_item(cx, ty, sym::Result);
     let _ = is_type_diagnostic_item(cx, ty, sym::Result);
 
-    #[allow(unused)]
+    #[allow(unused, clippy::unnecessary_def_path)]
     let rc_path = &["alloc", "rc", "Rc"];
     let _ = is_type_diagnostic_item(cx, ty, sym::Rc);
 
diff --git a/tests/ui-internal/unnecessary_def_path.rs b/tests/ui-internal/unnecessary_def_path.rs
index 6506f1f164a..f17fed6c653 100644
--- a/tests/ui-internal/unnecessary_def_path.rs
+++ b/tests/ui-internal/unnecessary_def_path.rs
@@ -28,9 +28,9 @@ use rustc_hir::Expr;
 use rustc_lint::LateContext;
 use rustc_middle::ty::Ty;
 
-#[allow(unused)]
+#[allow(unused, clippy::unnecessary_def_path)]
 static OPTION: [&str; 3] = ["core", "option", "Option"];
-#[allow(unused)]
+#[allow(unused, clippy::unnecessary_def_path)]
 const RESULT: &[&str] = &["core", "result", "Result"];
 
 fn _f<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, did: DefId, expr: &Expr<'_>) {
@@ -38,7 +38,7 @@ fn _f<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, did: DefId, expr: &Expr<'_>) {
     let _ = match_type(cx, ty, RESULT);
     let _ = match_type(cx, ty, &["core", "result", "Result"]);
 
-    #[allow(unused)]
+    #[allow(unused, clippy::unnecessary_def_path)]
     let rc_path = &["alloc", "rc", "Rc"];
     let _ = clippy_utils::ty::match_type(cx, ty, rc_path);
 
diff --git a/tests/ui-internal/unnecessary_def_path_hardcoded_path.rs b/tests/ui-internal/unnecessary_def_path_hardcoded_path.rs
new file mode 100644
index 00000000000..b5ff3a54205
--- /dev/null
+++ b/tests/ui-internal/unnecessary_def_path_hardcoded_path.rs
@@ -0,0 +1,16 @@
+#![feature(rustc_private)]
+#![allow(unused)]
+#![warn(clippy::unnecessary_def_path)]
+
+extern crate rustc_hir;
+
+use rustc_hir::LangItem;
+
+fn main() {
+    const DEREF_TRAIT: [&str; 4] = ["core", "ops", "deref", "Deref"];
+    const DEREF_MUT_TRAIT: [&str; 4] = ["core", "ops", "deref", "DerefMut"];
+    const DEREF_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "Deref", "deref"];
+
+    // Don't lint, not yet a diagnostic or language item
+    const DEREF_MUT_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "DerefMut", "deref_mut"];
+}
diff --git a/tests/ui-internal/unnecessary_def_path_hardcoded_path.stderr b/tests/ui-internal/unnecessary_def_path_hardcoded_path.stderr
new file mode 100644
index 00000000000..af46d87bf67
--- /dev/null
+++ b/tests/ui-internal/unnecessary_def_path_hardcoded_path.stderr
@@ -0,0 +1,27 @@
+error: hardcoded path to a language item
+  --> $DIR/unnecessary_def_path_hardcoded_path.rs:11:40
+   |
+LL |     const DEREF_MUT_TRAIT: [&str; 4] = ["core", "ops", "deref", "DerefMut"];
+   |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: convert all references to use `LangItem::DerefMut`
+   = note: `-D clippy::unnecessary-def-path` implied by `-D warnings`
+
+error: hardcoded path to a diagnostic item
+  --> $DIR/unnecessary_def_path_hardcoded_path.rs:12:43
+   |
+LL |     const DEREF_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "Deref", "deref"];
+   |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: convert all references to use `sym::deref_method`
+
+error: hardcoded path to a diagnostic item
+  --> $DIR/unnecessary_def_path_hardcoded_path.rs:10:36
+   |
+LL |     const DEREF_TRAIT: [&str; 4] = ["core", "ops", "deref", "Deref"];
+   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: convert all references to use `sym::Deref`
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/as_ptr_cast_mut.rs b/tests/ui/as_ptr_cast_mut.rs
new file mode 100644
index 00000000000..0d1d9258433
--- /dev/null
+++ b/tests/ui/as_ptr_cast_mut.rs
@@ -0,0 +1,37 @@
+#![allow(unused)]
+#![warn(clippy::as_ptr_cast_mut)]
+#![allow(clippy::wrong_self_convention)]
+
+struct MutPtrWrapper(Vec<u8>);
+impl MutPtrWrapper {
+    fn as_ptr(&mut self) -> *const u8 {
+        self.0.as_mut_ptr() as *const u8
+    }
+}
+
+struct Covariant<T>(*const T);
+impl<T> Covariant<T> {
+    fn as_ptr(self) -> *const T {
+        self.0
+    }
+}
+
+fn main() {
+    let mut string = String::new();
+    let _ = string.as_ptr() as *mut u8;
+    let _: *mut i8 = string.as_ptr() as *mut _;
+    let _ = string.as_ptr() as *const i8;
+    let _ = string.as_mut_ptr();
+    let _ = string.as_mut_ptr() as *mut u8;
+    let _ = string.as_mut_ptr() as *const u8;
+
+    let nn = std::ptr::NonNull::new(4 as *mut u8).unwrap();
+    let _ = nn.as_ptr() as *mut u8;
+
+    let mut wrap = MutPtrWrapper(Vec::new());
+    let _ = wrap.as_ptr() as *mut u8;
+
+    let mut local = 4;
+    let ref_with_write_perm = Covariant(std::ptr::addr_of_mut!(local) as *const _);
+    let _ = ref_with_write_perm.as_ptr() as *mut u8;
+}
diff --git a/tests/ui/as_ptr_cast_mut.stderr b/tests/ui/as_ptr_cast_mut.stderr
new file mode 100644
index 00000000000..2189c3d2f85
--- /dev/null
+++ b/tests/ui/as_ptr_cast_mut.stderr
@@ -0,0 +1,16 @@
+error: casting the result of `as_ptr` to *mut u8
+  --> $DIR/as_ptr_cast_mut.rs:21:13
+   |
+LL |     let _ = string.as_ptr() as *mut u8;
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `string.as_mut_ptr()`
+   |
+   = note: `-D clippy::as-ptr-cast-mut` implied by `-D warnings`
+
+error: casting the result of `as_ptr` to *mut i8
+  --> $DIR/as_ptr_cast_mut.rs:22:22
+   |
+LL |     let _: *mut i8 = string.as_ptr() as *mut _;
+   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `string.as_mut_ptr()`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/author.stdout b/tests/ui/author.stdout
index 597318a556b..27ad538f24d 100644
--- a/tests/ui/author.stdout
+++ b/tests/ui/author.stdout
@@ -1,14 +1,12 @@
-if_chain! {
-    if let StmtKind::Local(local) = stmt.kind;
-    if let Some(init) = local.init;
-    if let ExprKind::Cast(expr, cast_ty) = init.kind;
-    if let TyKind::Path(ref qpath) = cast_ty.kind;
-    if match_qpath(qpath, &["char"]);
-    if let ExprKind::Lit(ref lit) = expr.kind;
-    if let LitKind::Int(69, LitIntType::Unsuffixed) = lit.node;
-    if let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local.pat.kind;
-    if name.as_str() == "x";
-    then {
-        // report your lint here
-    }
+if let StmtKind::Local(local) = stmt.kind
+    && let Some(init) = local.init
+    && let ExprKind::Cast(expr, cast_ty) = init.kind
+    && let TyKind::Path(ref qpath) = cast_ty.kind
+    && match_qpath(qpath, &["char"])
+    && let ExprKind::Lit(ref lit) = expr.kind
+    && let LitKind::Int(69, LitIntType::Unsuffixed) = lit.node
+    && let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local.pat.kind
+    && name.as_str() == "x"
+{
+    // report your lint here
 }
diff --git a/tests/ui/author/blocks.stdout b/tests/ui/author/blocks.stdout
index a529981e2e6..9de0550d81d 100644
--- a/tests/ui/author/blocks.stdout
+++ b/tests/ui/author/blocks.stdout
@@ -1,64 +1,58 @@
-if_chain! {
-    if let ExprKind::Block(block, None) = expr.kind;
-    if block.stmts.len() == 3;
-    if let StmtKind::Local(local) = block.stmts[0].kind;
-    if let Some(init) = local.init;
-    if let ExprKind::Lit(ref lit) = init.kind;
-    if let LitKind::Int(42, LitIntType::Signed(IntTy::I32)) = lit.node;
-    if let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local.pat.kind;
-    if name.as_str() == "x";
-    if let StmtKind::Local(local1) = block.stmts[1].kind;
-    if let Some(init1) = local1.init;
-    if let ExprKind::Lit(ref lit1) = init1.kind;
-    if let LitKind::Float(_, LitFloatType::Suffixed(FloatTy::F32)) = lit1.node;
-    if let PatKind::Binding(BindingAnnotation::NONE, _, name1, None) = local1.pat.kind;
-    if name1.as_str() == "_t";
-    if let StmtKind::Semi(e) = block.stmts[2].kind;
-    if let ExprKind::Unary(UnOp::Neg, inner) = e.kind;
-    if let ExprKind::Path(ref qpath) = inner.kind;
-    if match_qpath(qpath, &["x"]);
-    if block.expr.is_none();
-    then {
-        // report your lint here
-    }
+if let ExprKind::Block(block, None) = expr.kind
+    && block.stmts.len() == 3
+    && let StmtKind::Local(local) = block.stmts[0].kind
+    && let Some(init) = local.init
+    && let ExprKind::Lit(ref lit) = init.kind
+    && let LitKind::Int(42, LitIntType::Signed(IntTy::I32)) = lit.node
+    && let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local.pat.kind
+    && name.as_str() == "x"
+    && let StmtKind::Local(local1) = block.stmts[1].kind
+    && let Some(init1) = local1.init
+    && let ExprKind::Lit(ref lit1) = init1.kind
+    && let LitKind::Float(_, LitFloatType::Suffixed(FloatTy::F32)) = lit1.node
+    && let PatKind::Binding(BindingAnnotation::NONE, _, name1, None) = local1.pat.kind
+    && name1.as_str() == "_t"
+    && let StmtKind::Semi(e) = block.stmts[2].kind
+    && let ExprKind::Unary(UnOp::Neg, inner) = e.kind
+    && let ExprKind::Path(ref qpath) = inner.kind
+    && match_qpath(qpath, &["x"])
+    && block.expr.is_none()
+{
+    // report your lint here
 }
-if_chain! {
-    if let ExprKind::Block(block, None) = expr.kind;
-    if block.stmts.len() == 1;
-    if let StmtKind::Local(local) = block.stmts[0].kind;
-    if let Some(init) = local.init;
-    if let ExprKind::Call(func, args) = init.kind;
-    if let ExprKind::Path(ref qpath) = func.kind;
-    if match_qpath(qpath, &["String", "new"]);
-    if args.is_empty();
-    if let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local.pat.kind;
-    if name.as_str() == "expr";
-    if let Some(trailing_expr) = block.expr;
-    if let ExprKind::Call(func1, args1) = trailing_expr.kind;
-    if let ExprKind::Path(ref qpath1) = func1.kind;
-    if match_qpath(qpath1, &["drop"]);
-    if args1.len() == 1;
-    if let ExprKind::Path(ref qpath2) = args1[0].kind;
-    if match_qpath(qpath2, &["expr"]);
-    then {
-        // report your lint here
-    }
+if let ExprKind::Block(block, None) = expr.kind
+    && block.stmts.len() == 1
+    && let StmtKind::Local(local) = block.stmts[0].kind
+    && let Some(init) = local.init
+    && let ExprKind::Call(func, args) = init.kind
+    && let ExprKind::Path(ref qpath) = func.kind
+    && match_qpath(qpath, &["String", "new"])
+    && args.is_empty()
+    && let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local.pat.kind
+    && name.as_str() == "expr"
+    && let Some(trailing_expr) = block.expr
+    && let ExprKind::Call(func1, args1) = trailing_expr.kind
+    && let ExprKind::Path(ref qpath1) = func1.kind
+    && match_qpath(qpath1, &["drop"])
+    && args1.len() == 1
+    && let ExprKind::Path(ref qpath2) = args1[0].kind
+    && match_qpath(qpath2, &["expr"])
+{
+    // report your lint here
 }
-if_chain! {
-    if let ExprKind::Closure(CaptureBy::Value, fn_decl, body_id, _, None) = expr.kind;
-    if let FnRetTy::DefaultReturn(_) = fn_decl.output;
-    let expr1 = &cx.tcx.hir().body(body_id).value;
-    if let ExprKind::Call(func, args) = expr1.kind;
-    if let ExprKind::Path(ref qpath) = func.kind;
-    if matches!(qpath, QPath::LangItem(LangItem::FromGenerator, _));
-    if args.len() == 1;
-    if let ExprKind::Closure(CaptureBy::Value, fn_decl1, body_id1, _, Some(Movability::Static)) = args[0].kind;
-    if let FnRetTy::DefaultReturn(_) = fn_decl1.output;
-    let expr2 = &cx.tcx.hir().body(body_id1).value;
-    if let ExprKind::Block(block, None) = expr2.kind;
-    if block.stmts.is_empty();
-    if block.expr.is_none();
-    then {
-        // report your lint here
-    }
+if let ExprKind::Closure(CaptureBy::Value, fn_decl, body_id, _, None) = expr.kind
+    && let FnRetTy::DefaultReturn(_) = fn_decl.output
+    && expr1 = &cx.tcx.hir().body(body_id).value
+    && let ExprKind::Call(func, args) = expr1.kind
+    && let ExprKind::Path(ref qpath) = func.kind
+    && matches!(qpath, QPath::LangItem(LangItem::FromGenerator, _))
+    && args.len() == 1
+    && let ExprKind::Closure(CaptureBy::Value, fn_decl1, body_id1, _, Some(Movability::Static)) = args[0].kind
+    && let FnRetTy::DefaultReturn(_) = fn_decl1.output
+    && expr2 = &cx.tcx.hir().body(body_id1).value
+    && let ExprKind::Block(block, None) = expr2.kind
+    && block.stmts.is_empty()
+    && block.expr.is_none()
+{
+    // report your lint here
 }
diff --git a/tests/ui/author/call.stdout b/tests/ui/author/call.stdout
index 266312d63e5..f040f6330a6 100644
--- a/tests/ui/author/call.stdout
+++ b/tests/ui/author/call.stdout
@@ -1,16 +1,14 @@
-if_chain! {
-    if let StmtKind::Local(local) = stmt.kind;
-    if let Some(init) = local.init;
-    if let ExprKind::Call(func, args) = init.kind;
-    if let ExprKind::Path(ref qpath) = func.kind;
-    if match_qpath(qpath, &["{{root}}", "std", "cmp", "min"]);
-    if args.len() == 2;
-    if let ExprKind::Lit(ref lit) = args[0].kind;
-    if let LitKind::Int(3, LitIntType::Unsuffixed) = lit.node;
-    if let ExprKind::Lit(ref lit1) = args[1].kind;
-    if let LitKind::Int(4, LitIntType::Unsuffixed) = lit1.node;
-    if let PatKind::Wild = local.pat.kind;
-    then {
-        // report your lint here
-    }
+if let StmtKind::Local(local) = stmt.kind
+    && let Some(init) = local.init
+    && let ExprKind::Call(func, args) = init.kind
+    && let ExprKind::Path(ref qpath) = func.kind
+    && match_qpath(qpath, &["{{root}}", "std", "cmp", "min"])
+    && args.len() == 2
+    && let ExprKind::Lit(ref lit) = args[0].kind
+    && let LitKind::Int(3, LitIntType::Unsuffixed) = lit.node
+    && let ExprKind::Lit(ref lit1) = args[1].kind
+    && let LitKind::Int(4, LitIntType::Unsuffixed) = lit1.node
+    && let PatKind::Wild = local.pat.kind
+{
+    // report your lint here
 }
diff --git a/tests/ui/author/if.stdout b/tests/ui/author/if.stdout
index 8d92849b366..5d79618820d 100644
--- a/tests/ui/author/if.stdout
+++ b/tests/ui/author/if.stdout
@@ -1,50 +1,46 @@
-if_chain! {
-    if let StmtKind::Local(local) = stmt.kind;
-    if let Some(init) = local.init;
-    if let ExprKind::If(cond, then, Some(else_expr)) = init.kind;
-    if let ExprKind::DropTemps(expr) = cond.kind;
-    if let ExprKind::Lit(ref lit) = expr.kind;
-    if let LitKind::Bool(true) = lit.node;
-    if let ExprKind::Block(block, None) = then.kind;
-    if block.stmts.len() == 1;
-    if let StmtKind::Semi(e) = block.stmts[0].kind;
-    if let ExprKind::Binary(op, left, right) = e.kind;
-    if BinOpKind::Eq == op.node;
-    if let ExprKind::Lit(ref lit1) = left.kind;
-    if let LitKind::Int(1, LitIntType::Unsuffixed) = lit1.node;
-    if let ExprKind::Lit(ref lit2) = right.kind;
-    if let LitKind::Int(1, LitIntType::Unsuffixed) = lit2.node;
-    if block.expr.is_none();
-    if let ExprKind::Block(block1, None) = else_expr.kind;
-    if block1.stmts.len() == 1;
-    if let StmtKind::Semi(e1) = block1.stmts[0].kind;
-    if let ExprKind::Binary(op1, left1, right1) = e1.kind;
-    if BinOpKind::Eq == op1.node;
-    if let ExprKind::Lit(ref lit3) = left1.kind;
-    if let LitKind::Int(2, LitIntType::Unsuffixed) = lit3.node;
-    if let ExprKind::Lit(ref lit4) = right1.kind;
-    if let LitKind::Int(2, LitIntType::Unsuffixed) = lit4.node;
-    if block1.expr.is_none();
-    if let PatKind::Wild = local.pat.kind;
-    then {
-        // report your lint here
-    }
+if let StmtKind::Local(local) = stmt.kind
+    && let Some(init) = local.init
+    && let ExprKind::If(cond, then, Some(else_expr)) = init.kind
+    && let ExprKind::DropTemps(expr) = cond.kind
+    && let ExprKind::Lit(ref lit) = expr.kind
+    && let LitKind::Bool(true) = lit.node
+    && let ExprKind::Block(block, None) = then.kind
+    && block.stmts.len() == 1
+    && let StmtKind::Semi(e) = block.stmts[0].kind
+    && let ExprKind::Binary(op, left, right) = e.kind
+    && BinOpKind::Eq == op.node
+    && let ExprKind::Lit(ref lit1) = left.kind
+    && let LitKind::Int(1, LitIntType::Unsuffixed) = lit1.node
+    && let ExprKind::Lit(ref lit2) = right.kind
+    && let LitKind::Int(1, LitIntType::Unsuffixed) = lit2.node
+    && block.expr.is_none()
+    && let ExprKind::Block(block1, None) = else_expr.kind
+    && block1.stmts.len() == 1
+    && let StmtKind::Semi(e1) = block1.stmts[0].kind
+    && let ExprKind::Binary(op1, left1, right1) = e1.kind
+    && BinOpKind::Eq == op1.node
+    && let ExprKind::Lit(ref lit3) = left1.kind
+    && let LitKind::Int(2, LitIntType::Unsuffixed) = lit3.node
+    && let ExprKind::Lit(ref lit4) = right1.kind
+    && let LitKind::Int(2, LitIntType::Unsuffixed) = lit4.node
+    && block1.expr.is_none()
+    && let PatKind::Wild = local.pat.kind
+{
+    // report your lint here
 }
-if_chain! {
-    if let ExprKind::If(cond, then, Some(else_expr)) = expr.kind;
-    if let ExprKind::Let(let_expr) = cond.kind;
-    if let PatKind::Lit(lit_expr) = let_expr.pat.kind;
-    if let ExprKind::Lit(ref lit) = lit_expr.kind;
-    if let LitKind::Bool(true) = lit.node;
-    if let ExprKind::Path(ref qpath) = let_expr.init.kind;
-    if match_qpath(qpath, &["a"]);
-    if let ExprKind::Block(block, None) = then.kind;
-    if block.stmts.is_empty();
-    if block.expr.is_none();
-    if let ExprKind::Block(block1, None) = else_expr.kind;
-    if block1.stmts.is_empty();
-    if block1.expr.is_none();
-    then {
-        // report your lint here
-    }
+if let ExprKind::If(cond, then, Some(else_expr)) = expr.kind
+    && let ExprKind::Let(let_expr) = cond.kind
+    && let PatKind::Lit(lit_expr) = let_expr.pat.kind
+    && let ExprKind::Lit(ref lit) = lit_expr.kind
+    && let LitKind::Bool(true) = lit.node
+    && let ExprKind::Path(ref qpath) = let_expr.init.kind
+    && match_qpath(qpath, &["a"])
+    && let ExprKind::Block(block, None) = then.kind
+    && block.stmts.is_empty()
+    && block.expr.is_none()
+    && let ExprKind::Block(block1, None) = else_expr.kind
+    && block1.stmts.is_empty()
+    && block1.expr.is_none()
+{
+    // report your lint here
 }
diff --git a/tests/ui/author/issue_3849.stdout b/tests/ui/author/issue_3849.stdout
index bce4bc70273..32a3127b85a 100644
--- a/tests/ui/author/issue_3849.stdout
+++ b/tests/ui/author/issue_3849.stdout
@@ -1,14 +1,12 @@
-if_chain! {
-    if let StmtKind::Local(local) = stmt.kind;
-    if let Some(init) = local.init;
-    if let ExprKind::Call(func, args) = init.kind;
-    if let ExprKind::Path(ref qpath) = func.kind;
-    if match_qpath(qpath, &["std", "mem", "transmute"]);
-    if args.len() == 1;
-    if let ExprKind::Path(ref qpath1) = args[0].kind;
-    if match_qpath(qpath1, &["ZPTR"]);
-    if let PatKind::Wild = local.pat.kind;
-    then {
-        // report your lint here
-    }
+if let StmtKind::Local(local) = stmt.kind
+    && let Some(init) = local.init
+    && let ExprKind::Call(func, args) = init.kind
+    && let ExprKind::Path(ref qpath) = func.kind
+    && match_qpath(qpath, &["std", "mem", "transmute"])
+    && args.len() == 1
+    && let ExprKind::Path(ref qpath1) = args[0].kind
+    && match_qpath(qpath1, &["ZPTR"])
+    && let PatKind::Wild = local.pat.kind
+{
+    // report your lint here
 }
diff --git a/tests/ui/author/loop.stdout b/tests/ui/author/loop.stdout
index ceb53fcd496..94a6436ed54 100644
--- a/tests/ui/author/loop.stdout
+++ b/tests/ui/author/loop.stdout
@@ -1,113 +1,101 @@
-if_chain! {
-    if let Some(higher::ForLoop { pat: pat, arg: arg, body: body, .. }) = higher::ForLoop::hir(expr);
-    if let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = pat.kind;
-    if name.as_str() == "y";
-    if let ExprKind::Struct(qpath, fields, None) = arg.kind;
-    if matches!(qpath, QPath::LangItem(LangItem::Range, _));
-    if fields.len() == 2;
-    if fields[0].ident.as_str() == "start";
-    if let ExprKind::Lit(ref lit) = fields[0].expr.kind;
-    if let LitKind::Int(0, LitIntType::Unsuffixed) = lit.node;
-    if fields[1].ident.as_str() == "end";
-    if let ExprKind::Lit(ref lit1) = fields[1].expr.kind;
-    if let LitKind::Int(10, LitIntType::Unsuffixed) = lit1.node;
-    if let ExprKind::Block(block, None) = body.kind;
-    if block.stmts.len() == 1;
-    if let StmtKind::Local(local) = block.stmts[0].kind;
-    if let Some(init) = local.init;
-    if let ExprKind::Path(ref qpath1) = init.kind;
-    if match_qpath(qpath1, &["y"]);
-    if let PatKind::Binding(BindingAnnotation::NONE, _, name1, None) = local.pat.kind;
-    if name1.as_str() == "z";
-    if block.expr.is_none();
-    then {
-        // report your lint here
-    }
+if let Some(higher::ForLoop { pat: pat, arg: arg, body: body, .. }) = higher::ForLoop::hir(expr)
+    && let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = pat.kind
+    && name.as_str() == "y"
+    && let ExprKind::Struct(qpath, fields, None) = arg.kind
+    && matches!(qpath, QPath::LangItem(LangItem::Range, _))
+    && fields.len() == 2
+    && fields[0].ident.as_str() == "start"
+    && let ExprKind::Lit(ref lit) = fields[0].expr.kind
+    && let LitKind::Int(0, LitIntType::Unsuffixed) = lit.node
+    && fields[1].ident.as_str() == "end"
+    && let ExprKind::Lit(ref lit1) = fields[1].expr.kind
+    && let LitKind::Int(10, LitIntType::Unsuffixed) = lit1.node
+    && let ExprKind::Block(block, None) = body.kind
+    && block.stmts.len() == 1
+    && let StmtKind::Local(local) = block.stmts[0].kind
+    && let Some(init) = local.init
+    && let ExprKind::Path(ref qpath1) = init.kind
+    && match_qpath(qpath1, &["y"])
+    && let PatKind::Binding(BindingAnnotation::NONE, _, name1, None) = local.pat.kind
+    && name1.as_str() == "z"
+    && block.expr.is_none()
+{
+    // report your lint here
 }
-if_chain! {
-    if let Some(higher::ForLoop { pat: pat, arg: arg, body: body, .. }) = higher::ForLoop::hir(expr);
-    if let PatKind::Wild = pat.kind;
-    if let ExprKind::Struct(qpath, fields, None) = arg.kind;
-    if matches!(qpath, QPath::LangItem(LangItem::Range, _));
-    if fields.len() == 2;
-    if fields[0].ident.as_str() == "start";
-    if let ExprKind::Lit(ref lit) = fields[0].expr.kind;
-    if let LitKind::Int(0, LitIntType::Unsuffixed) = lit.node;
-    if fields[1].ident.as_str() == "end";
-    if let ExprKind::Lit(ref lit1) = fields[1].expr.kind;
-    if let LitKind::Int(10, LitIntType::Unsuffixed) = lit1.node;
-    if let ExprKind::Block(block, None) = body.kind;
-    if block.stmts.len() == 1;
-    if let StmtKind::Semi(e) = block.stmts[0].kind;
-    if let ExprKind::Break(destination, None) = e.kind;
-    if destination.label.is_none();
-    if block.expr.is_none();
-    then {
-        // report your lint here
-    }
+if let Some(higher::ForLoop { pat: pat, arg: arg, body: body, .. }) = higher::ForLoop::hir(expr)
+    && let PatKind::Wild = pat.kind
+    && let ExprKind::Struct(qpath, fields, None) = arg.kind
+    && matches!(qpath, QPath::LangItem(LangItem::Range, _))
+    && fields.len() == 2
+    && fields[0].ident.as_str() == "start"
+    && let ExprKind::Lit(ref lit) = fields[0].expr.kind
+    && let LitKind::Int(0, LitIntType::Unsuffixed) = lit.node
+    && fields[1].ident.as_str() == "end"
+    && let ExprKind::Lit(ref lit1) = fields[1].expr.kind
+    && let LitKind::Int(10, LitIntType::Unsuffixed) = lit1.node
+    && let ExprKind::Block(block, None) = body.kind
+    && block.stmts.len() == 1
+    && let StmtKind::Semi(e) = block.stmts[0].kind
+    && let ExprKind::Break(destination, None) = e.kind
+    && destination.label.is_none()
+    && block.expr.is_none()
+{
+    // report your lint here
 }
-if_chain! {
-    if let Some(higher::ForLoop { pat: pat, arg: arg, body: body, .. }) = higher::ForLoop::hir(expr);
-    if let PatKind::Wild = pat.kind;
-    if let ExprKind::Struct(qpath, fields, None) = arg.kind;
-    if matches!(qpath, QPath::LangItem(LangItem::Range, _));
-    if fields.len() == 2;
-    if fields[0].ident.as_str() == "start";
-    if let ExprKind::Lit(ref lit) = fields[0].expr.kind;
-    if let LitKind::Int(0, LitIntType::Unsuffixed) = lit.node;
-    if fields[1].ident.as_str() == "end";
-    if let ExprKind::Lit(ref lit1) = fields[1].expr.kind;
-    if let LitKind::Int(10, LitIntType::Unsuffixed) = lit1.node;
-    if let ExprKind::Block(block, None) = body.kind;
-    if block.stmts.len() == 1;
-    if let StmtKind::Semi(e) = block.stmts[0].kind;
-    if let ExprKind::Break(destination, None) = e.kind;
-    if let Some(label) = destination.label;
-    if label.ident.as_str() == "'label";
-    if block.expr.is_none();
-    then {
-        // report your lint here
-    }
+if let Some(higher::ForLoop { pat: pat, arg: arg, body: body, .. }) = higher::ForLoop::hir(expr)
+    && let PatKind::Wild = pat.kind
+    && let ExprKind::Struct(qpath, fields, None) = arg.kind
+    && matches!(qpath, QPath::LangItem(LangItem::Range, _))
+    && fields.len() == 2
+    && fields[0].ident.as_str() == "start"
+    && let ExprKind::Lit(ref lit) = fields[0].expr.kind
+    && let LitKind::Int(0, LitIntType::Unsuffixed) = lit.node
+    && fields[1].ident.as_str() == "end"
+    && let ExprKind::Lit(ref lit1) = fields[1].expr.kind
+    && let LitKind::Int(10, LitIntType::Unsuffixed) = lit1.node
+    && let ExprKind::Block(block, None) = body.kind
+    && block.stmts.len() == 1
+    && let StmtKind::Semi(e) = block.stmts[0].kind
+    && let ExprKind::Break(destination, None) = e.kind
+    && let Some(label) = destination.label
+    && label.ident.as_str() == "'label"
+    && block.expr.is_none()
+{
+    // report your lint here
 }
-if_chain! {
-    if let Some(higher::While { condition: condition, body: body }) = higher::While::hir(expr);
-    if let ExprKind::Path(ref qpath) = condition.kind;
-    if match_qpath(qpath, &["a"]);
-    if let ExprKind::Block(block, None) = body.kind;
-    if block.stmts.len() == 1;
-    if let StmtKind::Semi(e) = block.stmts[0].kind;
-    if let ExprKind::Break(destination, None) = e.kind;
-    if destination.label.is_none();
-    if block.expr.is_none();
-    then {
-        // report your lint here
-    }
+if let Some(higher::While { condition: condition, body: body }) = higher::While::hir(expr)
+    && let ExprKind::Path(ref qpath) = condition.kind
+    && match_qpath(qpath, &["a"])
+    && let ExprKind::Block(block, None) = body.kind
+    && block.stmts.len() == 1
+    && let StmtKind::Semi(e) = block.stmts[0].kind
+    && let ExprKind::Break(destination, None) = e.kind
+    && destination.label.is_none()
+    && block.expr.is_none()
+{
+    // report your lint here
 }
-if_chain! {
-    if let Some(higher::WhileLet { let_pat: let_pat, let_expr: let_expr, if_then: if_then }) = higher::WhileLet::hir(expr);
-    if let PatKind::Lit(lit_expr) = let_pat.kind;
-    if let ExprKind::Lit(ref lit) = lit_expr.kind;
-    if let LitKind::Bool(true) = lit.node;
-    if let ExprKind::Path(ref qpath) = let_expr.kind;
-    if match_qpath(qpath, &["a"]);
-    if let ExprKind::Block(block, None) = if_then.kind;
-    if block.stmts.len() == 1;
-    if let StmtKind::Semi(e) = block.stmts[0].kind;
-    if let ExprKind::Break(destination, None) = e.kind;
-    if destination.label.is_none();
-    if block.expr.is_none();
-    then {
-        // report your lint here
-    }
+if let Some(higher::WhileLet { let_pat: let_pat, let_expr: let_expr, if_then: if_then }) = higher::WhileLet::hir(expr)
+    && let PatKind::Lit(lit_expr) = let_pat.kind
+    && let ExprKind::Lit(ref lit) = lit_expr.kind
+    && let LitKind::Bool(true) = lit.node
+    && let ExprKind::Path(ref qpath) = let_expr.kind
+    && match_qpath(qpath, &["a"])
+    && let ExprKind::Block(block, None) = if_then.kind
+    && block.stmts.len() == 1
+    && let StmtKind::Semi(e) = block.stmts[0].kind
+    && let ExprKind::Break(destination, None) = e.kind
+    && destination.label.is_none()
+    && block.expr.is_none()
+{
+    // report your lint here
 }
-if_chain! {
-    if let ExprKind::Loop(body, None, LoopSource::Loop, _) = expr.kind;
-    if body.stmts.len() == 1;
-    if let StmtKind::Semi(e) = body.stmts[0].kind;
-    if let ExprKind::Break(destination, None) = e.kind;
-    if destination.label.is_none();
-    if body.expr.is_none();
-    then {
-        // report your lint here
-    }
+if let ExprKind::Loop(body, None, LoopSource::Loop, _) = expr.kind
+    && body.stmts.len() == 1
+    && let StmtKind::Semi(e) = body.stmts[0].kind
+    && let ExprKind::Break(destination, None) = e.kind
+    && destination.label.is_none()
+    && body.expr.is_none()
+{
+    // report your lint here
 }
diff --git a/tests/ui/author/matches.stdout b/tests/ui/author/matches.stdout
index 2cf69a035b4..88e2ca656a4 100644
--- a/tests/ui/author/matches.stdout
+++ b/tests/ui/author/matches.stdout
@@ -1,38 +1,36 @@
-if_chain! {
-    if let StmtKind::Local(local) = stmt.kind;
-    if let Some(init) = local.init;
-    if let ExprKind::Match(scrutinee, arms, MatchSource::Normal) = init.kind;
-    if let ExprKind::Lit(ref lit) = scrutinee.kind;
-    if let LitKind::Int(42, LitIntType::Unsuffixed) = lit.node;
-    if arms.len() == 3;
-    if let PatKind::Lit(lit_expr) = arms[0].pat.kind;
-    if let ExprKind::Lit(ref lit1) = lit_expr.kind;
-    if let LitKind::Int(16, LitIntType::Unsuffixed) = lit1.node;
-    if arms[0].guard.is_none();
-    if let ExprKind::Lit(ref lit2) = arms[0].body.kind;
-    if let LitKind::Int(5, LitIntType::Unsuffixed) = lit2.node;
-    if let PatKind::Lit(lit_expr1) = arms[1].pat.kind;
-    if let ExprKind::Lit(ref lit3) = lit_expr1.kind;
-    if let LitKind::Int(17, LitIntType::Unsuffixed) = lit3.node;
-    if arms[1].guard.is_none();
-    if let ExprKind::Block(block, None) = arms[1].body.kind;
-    if block.stmts.len() == 1;
-    if let StmtKind::Local(local1) = block.stmts[0].kind;
-    if let Some(init1) = local1.init;
-    if let ExprKind::Lit(ref lit4) = init1.kind;
-    if let LitKind::Int(3, LitIntType::Unsuffixed) = lit4.node;
-    if let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local1.pat.kind;
-    if name.as_str() == "x";
-    if let Some(trailing_expr) = block.expr;
-    if let ExprKind::Path(ref qpath) = trailing_expr.kind;
-    if match_qpath(qpath, &["x"]);
-    if let PatKind::Wild = arms[2].pat.kind;
-    if arms[2].guard.is_none();
-    if let ExprKind::Lit(ref lit5) = arms[2].body.kind;
-    if let LitKind::Int(1, LitIntType::Unsuffixed) = lit5.node;
-    if let PatKind::Binding(BindingAnnotation::NONE, _, name1, None) = local.pat.kind;
-    if name1.as_str() == "a";
-    then {
-        // report your lint here
-    }
+if let StmtKind::Local(local) = stmt.kind
+    && let Some(init) = local.init
+    && let ExprKind::Match(scrutinee, arms, MatchSource::Normal) = init.kind
+    && let ExprKind::Lit(ref lit) = scrutinee.kind
+    && let LitKind::Int(42, LitIntType::Unsuffixed) = lit.node
+    && arms.len() == 3
+    && let PatKind::Lit(lit_expr) = arms[0].pat.kind
+    && let ExprKind::Lit(ref lit1) = lit_expr.kind
+    && let LitKind::Int(16, LitIntType::Unsuffixed) = lit1.node
+    && arms[0].guard.is_none()
+    && let ExprKind::Lit(ref lit2) = arms[0].body.kind
+    && let LitKind::Int(5, LitIntType::Unsuffixed) = lit2.node
+    && let PatKind::Lit(lit_expr1) = arms[1].pat.kind
+    && let ExprKind::Lit(ref lit3) = lit_expr1.kind
+    && let LitKind::Int(17, LitIntType::Unsuffixed) = lit3.node
+    && arms[1].guard.is_none()
+    && let ExprKind::Block(block, None) = arms[1].body.kind
+    && block.stmts.len() == 1
+    && let StmtKind::Local(local1) = block.stmts[0].kind
+    && let Some(init1) = local1.init
+    && let ExprKind::Lit(ref lit4) = init1.kind
+    && let LitKind::Int(3, LitIntType::Unsuffixed) = lit4.node
+    && let PatKind::Binding(BindingAnnotation::NONE, _, name, None) = local1.pat.kind
+    && name.as_str() == "x"
+    && let Some(trailing_expr) = block.expr
+    && let ExprKind::Path(ref qpath) = trailing_expr.kind
+    && match_qpath(qpath, &["x"])
+    && let PatKind::Wild = arms[2].pat.kind
+    && arms[2].guard.is_none()
+    && let ExprKind::Lit(ref lit5) = arms[2].body.kind
+    && let LitKind::Int(1, LitIntType::Unsuffixed) = lit5.node
+    && let PatKind::Binding(BindingAnnotation::NONE, _, name1, None) = local.pat.kind
+    && name1.as_str() == "a"
+{
+    // report your lint here
 }
diff --git a/tests/ui/author/repeat.stdout b/tests/ui/author/repeat.stdout
index 471bbce4f41..c2a369610cc 100644
--- a/tests/ui/author/repeat.stdout
+++ b/tests/ui/author/repeat.stdout
@@ -1,12 +1,10 @@
-if_chain! {
-    if let ExprKind::Repeat(value, length) = expr.kind;
-    if let ExprKind::Lit(ref lit) = value.kind;
-    if let LitKind::Int(1, LitIntType::Unsigned(UintTy::U8)) = lit.node;
-    if let ArrayLen::Body(anon_const) = length;
-    let expr1 = &cx.tcx.hir().body(anon_const.body).value;
-    if let ExprKind::Lit(ref lit1) = expr1.kind;
-    if let LitKind::Int(5, LitIntType::Unsuffixed) = lit1.node;
-    then {
-        // report your lint here
-    }
+if let ExprKind::Repeat(value, length) = expr.kind
+    && let ExprKind::Lit(ref lit) = value.kind
+    && let LitKind::Int(1, LitIntType::Unsigned(UintTy::U8)) = lit.node
+    && let ArrayLen::Body(anon_const) = length
+    && expr1 = &cx.tcx.hir().body(anon_const.body).value
+    && let ExprKind::Lit(ref lit1) = expr1.kind
+    && let LitKind::Int(5, LitIntType::Unsuffixed) = lit1.node
+{
+    // report your lint here
 }
diff --git a/tests/ui/author/struct.stdout b/tests/ui/author/struct.stdout
index b5bbc9e213c..0b332d5e7d0 100644
--- a/tests/ui/author/struct.stdout
+++ b/tests/ui/author/struct.stdout
@@ -1,64 +1,56 @@
-if_chain! {
-    if let ExprKind::Struct(qpath, fields, None) = expr.kind;
-    if match_qpath(qpath, &["Test"]);
-    if fields.len() == 1;
-    if fields[0].ident.as_str() == "field";
-    if let ExprKind::If(cond, then, Some(else_expr)) = fields[0].expr.kind;
-    if let ExprKind::DropTemps(expr1) = cond.kind;
-    if let ExprKind::Lit(ref lit) = expr1.kind;
-    if let LitKind::Bool(true) = lit.node;
-    if let ExprKind::Block(block, None) = then.kind;
-    if block.stmts.is_empty();
-    if let Some(trailing_expr) = block.expr;
-    if let ExprKind::Lit(ref lit1) = trailing_expr.kind;
-    if let LitKind::Int(1, LitIntType::Unsuffixed) = lit1.node;
-    if let ExprKind::Block(block1, None) = else_expr.kind;
-    if block1.stmts.is_empty();
-    if let Some(trailing_expr1) = block1.expr;
-    if let ExprKind::Lit(ref lit2) = trailing_expr1.kind;
-    if let LitKind::Int(0, LitIntType::Unsuffixed) = lit2.node;
-    then {
-        // report your lint here
-    }
+if let ExprKind::Struct(qpath, fields, None) = expr.kind
+    && match_qpath(qpath, &["Test"])
+    && fields.len() == 1
+    && fields[0].ident.as_str() == "field"
+    && let ExprKind::If(cond, then, Some(else_expr)) = fields[0].expr.kind
+    && let ExprKind::DropTemps(expr1) = cond.kind
+    && let ExprKind::Lit(ref lit) = expr1.kind
+    && let LitKind::Bool(true) = lit.node
+    && let ExprKind::Block(block, None) = then.kind
+    && block.stmts.is_empty()
+    && let Some(trailing_expr) = block.expr
+    && let ExprKind::Lit(ref lit1) = trailing_expr.kind
+    && let LitKind::Int(1, LitIntType::Unsuffixed) = lit1.node
+    && let ExprKind::Block(block1, None) = else_expr.kind
+    && block1.stmts.is_empty()
+    && let Some(trailing_expr1) = block1.expr
+    && let ExprKind::Lit(ref lit2) = trailing_expr1.kind
+    && let LitKind::Int(0, LitIntType::Unsuffixed) = lit2.node
+{
+    // report your lint here
 }
-if_chain! {
-    if let PatKind::Struct(ref qpath, fields, false) = arm.pat.kind;
-    if match_qpath(qpath, &["Test"]);
-    if fields.len() == 1;
-    if fields[0].ident.as_str() == "field";
-    if let PatKind::Lit(lit_expr) = fields[0].pat.kind;
-    if let ExprKind::Lit(ref lit) = lit_expr.kind;
-    if let LitKind::Int(1, LitIntType::Unsuffixed) = lit.node;
-    if arm.guard.is_none();
-    if let ExprKind::Block(block, None) = arm.body.kind;
-    if block.stmts.is_empty();
-    if block.expr.is_none();
-    then {
-        // report your lint here
-    }
+if let PatKind::Struct(ref qpath, fields, false) = arm.pat.kind
+    && match_qpath(qpath, &["Test"])
+    && fields.len() == 1
+    && fields[0].ident.as_str() == "field"
+    && let PatKind::Lit(lit_expr) = fields[0].pat.kind
+    && let ExprKind::Lit(ref lit) = lit_expr.kind
+    && let LitKind::Int(1, LitIntType::Unsuffixed) = lit.node
+    && arm.guard.is_none()
+    && let ExprKind::Block(block, None) = arm.body.kind
+    && block.stmts.is_empty()
+    && block.expr.is_none()
+{
+    // report your lint here
 }
-if_chain! {
-    if let PatKind::TupleStruct(ref qpath, fields, None) = arm.pat.kind;
-    if match_qpath(qpath, &["TestTuple"]);
-    if fields.len() == 1;
-    if let PatKind::Lit(lit_expr) = fields[0].kind;
-    if let ExprKind::Lit(ref lit) = lit_expr.kind;
-    if let LitKind::Int(1, LitIntType::Unsuffixed) = lit.node;
-    if arm.guard.is_none();
-    if let ExprKind::Block(block, None) = arm.body.kind;
-    if block.stmts.is_empty();
-    if block.expr.is_none();
-    then {
-        // report your lint here
-    }
+if let PatKind::TupleStruct(ref qpath, fields, None) = arm.pat.kind
+    && match_qpath(qpath, &["TestTuple"])
+    && fields.len() == 1
+    && let PatKind::Lit(lit_expr) = fields[0].kind
+    && let ExprKind::Lit(ref lit) = lit_expr.kind
+    && let LitKind::Int(1, LitIntType::Unsuffixed) = lit.node
+    && arm.guard.is_none()
+    && let ExprKind::Block(block, None) = arm.body.kind
+    && block.stmts.is_empty()
+    && block.expr.is_none()
+{
+    // report your lint here
 }
-if_chain! {
-    if let ExprKind::MethodCall(method_name, receiver, args, _) = expr.kind;
-    if method_name.ident.as_str() == "test";
-    if let ExprKind::Path(ref qpath) = receiver.kind;
-    if match_qpath(qpath, &["test_method_call"]);
-    if args.is_empty();
-    then {
-        // report your lint here
-    }
+if let ExprKind::MethodCall(method_name, receiver, args, _) = expr.kind
+    && method_name.ident.as_str() == "test"
+    && let ExprKind::Path(ref qpath) = receiver.kind
+    && match_qpath(qpath, &["test_method_call"])
+    && args.is_empty()
+{
+    // report your lint here
 }
diff --git a/tests/ui/box_default.fixed b/tests/ui/box_default.fixed
new file mode 100644
index 00000000000..7fbb272ce5a
--- /dev/null
+++ b/tests/ui/box_default.fixed
@@ -0,0 +1,43 @@
+// run-rustfix
+#![warn(clippy::box_default)]
+
+#[derive(Default)]
+struct ImplementsDefault;
+
+struct OwnDefault;
+
+impl OwnDefault {
+    fn default() -> Self {
+        Self
+    }
+}
+
+macro_rules! outer {
+    ($e: expr) => {
+        $e
+    };
+}
+
+fn main() {
+    let _string: Box<String> = Box::default();
+    let _byte = Box::<u8>::default();
+    let _vec = Box::<std::vec::Vec<u8>>::default();
+    let _impl = Box::<ImplementsDefault>::default();
+    let _impl2 = Box::<ImplementsDefault>::default();
+    let _impl3: Box<ImplementsDefault> = Box::default();
+    let _own = Box::new(OwnDefault::default()); // should not lint
+    let _in_macro = outer!(Box::<std::string::String>::default());
+    let _string_default = outer!(Box::<std::string::String>::default());
+    let _vec2: Box<Vec<ImplementsDefault>> = Box::default();
+    let _vec3: Box<Vec<bool>> = Box::default();
+    let _vec4: Box<_> = Box::<std::vec::Vec<bool>>::default();
+    let _more = ret_ty_fn();
+    call_ty_fn(Box::default());
+}
+
+fn ret_ty_fn() -> Box<bool> {
+    Box::<bool>::default()
+}
+
+#[allow(clippy::boxed_local)]
+fn call_ty_fn(_b: Box<u8>) {}
diff --git a/tests/ui/box_default.rs b/tests/ui/box_default.rs
index dc522705bc6..64c4f3887af 100644
--- a/tests/ui/box_default.rs
+++ b/tests/ui/box_default.rs
@@ -1,3 +1,4 @@
+// run-rustfix
 #![warn(clippy::box_default)]
 
 #[derive(Default)]
@@ -26,6 +27,17 @@ fn main() {
     let _impl3: Box<ImplementsDefault> = Box::new(Default::default());
     let _own = Box::new(OwnDefault::default()); // should not lint
     let _in_macro = outer!(Box::new(String::new()));
-    // false negative: default is from different expansion
+    let _string_default = outer!(Box::new(String::from("")));
     let _vec2: Box<Vec<ImplementsDefault>> = Box::new(vec![]);
+    let _vec3: Box<Vec<bool>> = Box::new(Vec::from([]));
+    let _vec4: Box<_> = Box::new(Vec::from([false; 0]));
+    let _more = ret_ty_fn();
+    call_ty_fn(Box::new(u8::default()));
 }
+
+fn ret_ty_fn() -> Box<bool> {
+    Box::new(bool::default())
+}
+
+#[allow(clippy::boxed_local)]
+fn call_ty_fn(_b: Box<u8>) {}
diff --git a/tests/ui/box_default.stderr b/tests/ui/box_default.stderr
index b2030e95acb..313255fc950 100644
--- a/tests/ui/box_default.stderr
+++ b/tests/ui/box_default.stderr
@@ -1,59 +1,82 @@
 error: `Box::new(_)` of default value
-  --> $DIR/box_default.rs:21:32
+  --> $DIR/box_default.rs:22:32
    |
 LL |     let _string: Box<String> = Box::new(Default::default());
-   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
    |
-   = help: use `Box::default()` instead
    = note: `-D clippy::box-default` implied by `-D warnings`
 
 error: `Box::new(_)` of default value
-  --> $DIR/box_default.rs:22:17
+  --> $DIR/box_default.rs:23:17
    |
 LL |     let _byte = Box::new(u8::default());
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: use `Box::default()` instead
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<u8>::default()`
 
 error: `Box::new(_)` of default value
-  --> $DIR/box_default.rs:23:16
+  --> $DIR/box_default.rs:24:16
    |
 LL |     let _vec = Box::new(Vec::<u8>::new());
-   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: use `Box::default()` instead
+   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<std::vec::Vec<u8>>::default()`
 
 error: `Box::new(_)` of default value
-  --> $DIR/box_default.rs:24:17
+  --> $DIR/box_default.rs:25:17
    |
 LL |     let _impl = Box::new(ImplementsDefault::default());
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: use `Box::default()` instead
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<ImplementsDefault>::default()`
 
 error: `Box::new(_)` of default value
-  --> $DIR/box_default.rs:25:18
+  --> $DIR/box_default.rs:26:18
    |
 LL |     let _impl2 = Box::new(<ImplementsDefault as Default>::default());
-   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: use `Box::default()` instead
+   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<ImplementsDefault>::default()`
 
 error: `Box::new(_)` of default value
-  --> $DIR/box_default.rs:26:42
+  --> $DIR/box_default.rs:27:42
    |
 LL |     let _impl3: Box<ImplementsDefault> = Box::new(Default::default());
-   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: use `Box::default()` instead
+   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
 
 error: `Box::new(_)` of default value
-  --> $DIR/box_default.rs:28:28
+  --> $DIR/box_default.rs:29:28
    |
 LL |     let _in_macro = outer!(Box::new(String::new()));
-   |                            ^^^^^^^^^^^^^^^^^^^^^^^
+   |                            ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<std::string::String>::default()`
+
+error: `Box::new(_)` of default value
+  --> $DIR/box_default.rs:30:34
+   |
+LL |     let _string_default = outer!(Box::new(String::from("")));
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<std::string::String>::default()`
+
+error: `Box::new(_)` of default value
+  --> $DIR/box_default.rs:31:46
+   |
+LL |     let _vec2: Box<Vec<ImplementsDefault>> = Box::new(vec![]);
+   |                                              ^^^^^^^^^^^^^^^^ help: try: `Box::default()`
+
+error: `Box::new(_)` of default value
+  --> $DIR/box_default.rs:32:33
+   |
+LL |     let _vec3: Box<Vec<bool>> = Box::new(Vec::from([]));
+   |                                 ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
+
+error: `Box::new(_)` of default value
+  --> $DIR/box_default.rs:33:25
+   |
+LL |     let _vec4: Box<_> = Box::new(Vec::from([false; 0]));
+   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<std::vec::Vec<bool>>::default()`
+
+error: `Box::new(_)` of default value
+  --> $DIR/box_default.rs:35:16
+   |
+LL |     call_ty_fn(Box::new(u8::default()));
+   |                ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
+
+error: `Box::new(_)` of default value
+  --> $DIR/box_default.rs:39:5
    |
-   = help: use `Box::default()` instead
+LL |     Box::new(bool::default())
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<bool>::default()`
 
-error: aborting due to 7 previous errors
+error: aborting due to 13 previous errors
 
diff --git a/tests/ui/box_default_no_std.rs b/tests/ui/box_default_no_std.rs
new file mode 100644
index 00000000000..4326abc9a54
--- /dev/null
+++ b/tests/ui/box_default_no_std.rs
@@ -0,0 +1,33 @@
+#![feature(lang_items, start, libc)]
+#![warn(clippy::box_default)]
+#![no_std]
+
+pub struct NotBox<T> {
+    _value: T,
+}
+
+impl<T> NotBox<T> {
+    pub fn new(value: T) -> Self {
+        Self { _value: value }
+    }
+}
+
+impl<T: Default> Default for NotBox<T> {
+    fn default() -> Self {
+        Self::new(T::default())
+    }
+}
+
+#[start]
+fn main(_argc: isize, _argv: *const *const u8) -> isize {
+    let _p = NotBox::new(isize::default());
+    0
+}
+
+#[panic_handler]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+    loop {}
+}
+
+#[lang = "eh_personality"]
+extern "C" fn eh_personality() {}
diff --git a/tests/ui/cast_nan_to_int.rs b/tests/ui/cast_nan_to_int.rs
new file mode 100644
index 00000000000..287c5aa216b
--- /dev/null
+++ b/tests/ui/cast_nan_to_int.rs
@@ -0,0 +1,18 @@
+#![warn(clippy::cast_nan_to_int)]
+#![allow(clippy::eq_op)]
+
+fn main() {
+    let _ = (0.0_f32 / -0.0) as usize;
+    let _ = (f64::INFINITY * -0.0) as usize;
+    let _ = (0.0 * f32::INFINITY) as usize;
+
+    let _ = (f64::INFINITY + f64::NEG_INFINITY) as usize;
+    let _ = (f32::INFINITY - f32::INFINITY) as usize;
+    let _ = (f32::INFINITY / f32::NEG_INFINITY) as usize;
+
+    // those won't be linted:
+    let _ = (1.0_f32 / 0.0) as usize;
+    let _ = (f32::INFINITY * f32::NEG_INFINITY) as usize;
+    let _ = (f32::INFINITY - f32::NEG_INFINITY) as usize;
+    let _ = (f64::INFINITY - 0.0) as usize;
+}
diff --git a/tests/ui/cast_nan_to_int.stderr b/tests/ui/cast_nan_to_int.stderr
new file mode 100644
index 00000000000..3539be75a19
--- /dev/null
+++ b/tests/ui/cast_nan_to_int.stderr
@@ -0,0 +1,51 @@
+error: casting a known NaN to usize
+  --> $DIR/cast_nan_to_int.rs:5:13
+   |
+LL |     let _ = (0.0_f32 / -0.0) as usize;
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this always evaluates to 0
+   = note: `-D clippy::cast-nan-to-int` implied by `-D warnings`
+
+error: casting a known NaN to usize
+  --> $DIR/cast_nan_to_int.rs:6:13
+   |
+LL |     let _ = (f64::INFINITY * -0.0) as usize;
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this always evaluates to 0
+
+error: casting a known NaN to usize
+  --> $DIR/cast_nan_to_int.rs:7:13
+   |
+LL |     let _ = (0.0 * f32::INFINITY) as usize;
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this always evaluates to 0
+
+error: casting a known NaN to usize
+  --> $DIR/cast_nan_to_int.rs:9:13
+   |
+LL |     let _ = (f64::INFINITY + f64::NEG_INFINITY) as usize;
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this always evaluates to 0
+
+error: casting a known NaN to usize
+  --> $DIR/cast_nan_to_int.rs:10:13
+   |
+LL |     let _ = (f32::INFINITY - f32::INFINITY) as usize;
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this always evaluates to 0
+
+error: casting a known NaN to usize
+  --> $DIR/cast_nan_to_int.rs:11:13
+   |
+LL |     let _ = (f32::INFINITY / f32::NEG_INFINITY) as usize;
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this always evaluates to 0
+
+error: aborting due to 6 previous errors
+
diff --git a/tests/ui/crashes/ice-9625.rs b/tests/ui/crashes/ice-9625.rs
new file mode 100644
index 00000000000..a765882b5d8
--- /dev/null
+++ b/tests/ui/crashes/ice-9625.rs
@@ -0,0 +1,4 @@
+fn main() {
+    let x = &1;
+    let _ = &1 < x && x < &10;
+}
diff --git a/tests/ui/default_numeric_fallback_f64.fixed b/tests/ui/default_numeric_fallback_f64.fixed
index a28bff76755..a370ccc7696 100644
--- a/tests/ui/default_numeric_fallback_f64.fixed
+++ b/tests/ui/default_numeric_fallback_f64.fixed
@@ -33,6 +33,7 @@ mod basic_expr {
         let x: [f64; 3] = [1., 2., 3.];
         let x: (f64, f64) = if true { (1., 2.) } else { (3., 4.) };
         let x: _ = 1.;
+        const X: f32 = 1.;
     }
 }
 
@@ -59,6 +60,14 @@ mod nested_local {
             // Should NOT lint this because this literal is bound to `_` of outer `Local`.
             2.
         };
+
+        const X: f32 = {
+            // Should lint this because this literal is not bound to any types.
+            let y = 1.0_f64;
+
+            // Should NOT lint this because this literal is bound to `_` of outer `Local`.
+            1.
+        };
     }
 }
 
diff --git a/tests/ui/default_numeric_fallback_f64.rs b/tests/ui/default_numeric_fallback_f64.rs
index b48435cc7b2..2476fe95141 100644
--- a/tests/ui/default_numeric_fallback_f64.rs
+++ b/tests/ui/default_numeric_fallback_f64.rs
@@ -33,6 +33,7 @@ mod basic_expr {
         let x: [f64; 3] = [1., 2., 3.];
         let x: (f64, f64) = if true { (1., 2.) } else { (3., 4.) };
         let x: _ = 1.;
+        const X: f32 = 1.;
     }
 }
 
@@ -59,6 +60,14 @@ mod nested_local {
             // Should NOT lint this because this literal is bound to `_` of outer `Local`.
             2.
         };
+
+        const X: f32 = {
+            // Should lint this because this literal is not bound to any types.
+            let y = 1.;
+
+            // Should NOT lint this because this literal is bound to `_` of outer `Local`.
+            1.
+        };
     }
 }
 
diff --git a/tests/ui/default_numeric_fallback_f64.stderr b/tests/ui/default_numeric_fallback_f64.stderr
index f8b6c7746ed..5df2f642388 100644
--- a/tests/ui/default_numeric_fallback_f64.stderr
+++ b/tests/ui/default_numeric_fallback_f64.stderr
@@ -61,79 +61,85 @@ LL |             _ => 1.,
    |                  ^^ help: consider adding suffix: `1.0_f64`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_f64.rs:43:21
+  --> $DIR/default_numeric_fallback_f64.rs:44:21
    |
 LL |             let y = 1.;
    |                     ^^ help: consider adding suffix: `1.0_f64`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_f64.rs:51:21
+  --> $DIR/default_numeric_fallback_f64.rs:52:21
    |
 LL |             let y = 1.;
    |                     ^^ help: consider adding suffix: `1.0_f64`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_f64.rs:57:21
+  --> $DIR/default_numeric_fallback_f64.rs:58:21
    |
 LL |             let y = 1.;
    |                     ^^ help: consider adding suffix: `1.0_f64`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_f64.rs:69:9
+  --> $DIR/default_numeric_fallback_f64.rs:66:21
+   |
+LL |             let y = 1.;
+   |                     ^^ help: consider adding suffix: `1.0_f64`
+
+error: default numeric fallback might occur
+  --> $DIR/default_numeric_fallback_f64.rs:78:9
    |
 LL |         1.
    |         ^^ help: consider adding suffix: `1.0_f64`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_f64.rs:75:27
+  --> $DIR/default_numeric_fallback_f64.rs:84:27
    |
 LL |         let f = || -> _ { 1. };
    |                           ^^ help: consider adding suffix: `1.0_f64`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_f64.rs:79:29
+  --> $DIR/default_numeric_fallback_f64.rs:88:29
    |
 LL |         let f = || -> f64 { 1. };
    |                             ^^ help: consider adding suffix: `1.0_f64`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_f64.rs:93:21
+  --> $DIR/default_numeric_fallback_f64.rs:102:21
    |
 LL |         generic_arg(1.);
    |                     ^^ help: consider adding suffix: `1.0_f64`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_f64.rs:96:32
+  --> $DIR/default_numeric_fallback_f64.rs:105:32
    |
 LL |         let x: _ = generic_arg(1.);
    |                                ^^ help: consider adding suffix: `1.0_f64`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_f64.rs:114:28
+  --> $DIR/default_numeric_fallback_f64.rs:123:28
    |
 LL |         GenericStruct { x: 1. };
    |                            ^^ help: consider adding suffix: `1.0_f64`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_f64.rs:117:36
+  --> $DIR/default_numeric_fallback_f64.rs:126:36
    |
 LL |         let _ = GenericStruct { x: 1. };
    |                                    ^^ help: consider adding suffix: `1.0_f64`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_f64.rs:135:24
+  --> $DIR/default_numeric_fallback_f64.rs:144:24
    |
 LL |         GenericEnum::X(1.);
    |                        ^^ help: consider adding suffix: `1.0_f64`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_f64.rs:155:23
+  --> $DIR/default_numeric_fallback_f64.rs:164:23
    |
 LL |         s.generic_arg(1.);
    |                       ^^ help: consider adding suffix: `1.0_f64`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_f64.rs:162:21
+  --> $DIR/default_numeric_fallback_f64.rs:171:21
    |
 LL |             let x = 22.;
    |                     ^^^ help: consider adding suffix: `22.0_f64`
@@ -143,5 +149,5 @@ LL |         internal_macro!();
    |
    = note: this error originates in the macro `internal_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: aborting due to 23 previous errors
+error: aborting due to 24 previous errors
 
diff --git a/tests/ui/default_numeric_fallback_i32.fixed b/tests/ui/default_numeric_fallback_i32.fixed
index 55451cf2f7d..3f4994f0453 100644
--- a/tests/ui/default_numeric_fallback_i32.fixed
+++ b/tests/ui/default_numeric_fallback_i32.fixed
@@ -33,6 +33,8 @@ mod basic_expr {
         let x: [i32; 3] = [1, 2, 3];
         let x: (i32, i32) = if true { (1, 2) } else { (3, 4) };
         let x: _ = 1;
+        let x: u64 = 1;
+        const CONST_X: i8 = 1;
     }
 }
 
@@ -59,6 +61,14 @@ mod nested_local {
             // Should NOT lint this because this literal is bound to `_` of outer `Local`.
             2
         };
+
+        const CONST_X: i32 = {
+            // Should lint this because this literal is not bound to any types.
+            let y = 1_i32;
+
+            // Should NOT lint this because this literal is bound to `_` of outer `Local`.
+            1
+        };
     }
 }
 
diff --git a/tests/ui/default_numeric_fallback_i32.rs b/tests/ui/default_numeric_fallback_i32.rs
index 62d72f2feba..2df0e09787f 100644
--- a/tests/ui/default_numeric_fallback_i32.rs
+++ b/tests/ui/default_numeric_fallback_i32.rs
@@ -33,6 +33,8 @@ mod basic_expr {
         let x: [i32; 3] = [1, 2, 3];
         let x: (i32, i32) = if true { (1, 2) } else { (3, 4) };
         let x: _ = 1;
+        let x: u64 = 1;
+        const CONST_X: i8 = 1;
     }
 }
 
@@ -59,6 +61,14 @@ mod nested_local {
             // Should NOT lint this because this literal is bound to `_` of outer `Local`.
             2
         };
+
+        const CONST_X: i32 = {
+            // Should lint this because this literal is not bound to any types.
+            let y = 1;
+
+            // Should NOT lint this because this literal is bound to `_` of outer `Local`.
+            1
+        };
     }
 }
 
diff --git a/tests/ui/default_numeric_fallback_i32.stderr b/tests/ui/default_numeric_fallback_i32.stderr
index f7c5e724c40..6f219c3fc2b 100644
--- a/tests/ui/default_numeric_fallback_i32.stderr
+++ b/tests/ui/default_numeric_fallback_i32.stderr
@@ -73,79 +73,85 @@ LL |             _ => 2,
    |                  ^ help: consider adding suffix: `2_i32`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_i32.rs:43:21
+  --> $DIR/default_numeric_fallback_i32.rs:45:21
    |
 LL |             let y = 1;
    |                     ^ help: consider adding suffix: `1_i32`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_i32.rs:51:21
+  --> $DIR/default_numeric_fallback_i32.rs:53:21
    |
 LL |             let y = 1;
    |                     ^ help: consider adding suffix: `1_i32`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_i32.rs:57:21
+  --> $DIR/default_numeric_fallback_i32.rs:59:21
    |
 LL |             let y = 1;
    |                     ^ help: consider adding suffix: `1_i32`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_i32.rs:69:9
+  --> $DIR/default_numeric_fallback_i32.rs:67:21
+   |
+LL |             let y = 1;
+   |                     ^ help: consider adding suffix: `1_i32`
+
+error: default numeric fallback might occur
+  --> $DIR/default_numeric_fallback_i32.rs:79:9
    |
 LL |         1
    |         ^ help: consider adding suffix: `1_i32`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_i32.rs:75:27
+  --> $DIR/default_numeric_fallback_i32.rs:85:27
    |
 LL |         let f = || -> _ { 1 };
    |                           ^ help: consider adding suffix: `1_i32`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_i32.rs:79:29
+  --> $DIR/default_numeric_fallback_i32.rs:89:29
    |
 LL |         let f = || -> i32 { 1 };
    |                             ^ help: consider adding suffix: `1_i32`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_i32.rs:93:21
+  --> $DIR/default_numeric_fallback_i32.rs:103:21
    |
 LL |         generic_arg(1);
    |                     ^ help: consider adding suffix: `1_i32`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_i32.rs:96:32
+  --> $DIR/default_numeric_fallback_i32.rs:106:32
    |
 LL |         let x: _ = generic_arg(1);
    |                                ^ help: consider adding suffix: `1_i32`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_i32.rs:114:28
+  --> $DIR/default_numeric_fallback_i32.rs:124:28
    |
 LL |         GenericStruct { x: 1 };
    |                            ^ help: consider adding suffix: `1_i32`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_i32.rs:117:36
+  --> $DIR/default_numeric_fallback_i32.rs:127:36
    |
 LL |         let _ = GenericStruct { x: 1 };
    |                                    ^ help: consider adding suffix: `1_i32`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_i32.rs:135:24
+  --> $DIR/default_numeric_fallback_i32.rs:145:24
    |
 LL |         GenericEnum::X(1);
    |                        ^ help: consider adding suffix: `1_i32`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_i32.rs:155:23
+  --> $DIR/default_numeric_fallback_i32.rs:165:23
    |
 LL |         s.generic_arg(1);
    |                       ^ help: consider adding suffix: `1_i32`
 
 error: default numeric fallback might occur
-  --> $DIR/default_numeric_fallback_i32.rs:162:21
+  --> $DIR/default_numeric_fallback_i32.rs:172:21
    |
 LL |             let x = 22;
    |                     ^^ help: consider adding suffix: `22_i32`
@@ -155,5 +161,5 @@ LL |         internal_macro!();
    |
    = note: this error originates in the macro `internal_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: aborting due to 25 previous errors
+error: aborting due to 26 previous errors
 
diff --git a/tests/ui/derive.rs b/tests/ui/derive.rs
index b276c384c04..c629c0e5353 100644
--- a/tests/ui/derive.rs
+++ b/tests/ui/derive.rs
@@ -1,7 +1,6 @@
 #![allow(dead_code)]
 #![warn(clippy::expl_impl_clone_on_copy)]
 
-
 #[derive(Copy)]
 struct Qux;
 
diff --git a/tests/ui/derive.stderr b/tests/ui/derive.stderr
index e1fbb8dcd1e..d37f7fa7331 100644
--- a/tests/ui/derive.stderr
+++ b/tests/ui/derive.stderr
@@ -1,5 +1,5 @@
 error: you are implementing `Clone` explicitly on a `Copy` type
-  --> $DIR/derive.rs:8:1
+  --> $DIR/derive.rs:7:1
    |
 LL | / impl Clone for Qux {
 LL | |     fn clone(&self) -> Self {
@@ -9,7 +9,7 @@ LL | | }
    | |_^
    |
 note: consider deriving `Clone` or removing `Copy`
-  --> $DIR/derive.rs:8:1
+  --> $DIR/derive.rs:7:1
    |
 LL | / impl Clone for Qux {
 LL | |     fn clone(&self) -> Self {
@@ -20,7 +20,7 @@ LL | | }
    = note: `-D clippy::expl-impl-clone-on-copy` implied by `-D warnings`
 
 error: you are implementing `Clone` explicitly on a `Copy` type
-  --> $DIR/derive.rs:32:1
+  --> $DIR/derive.rs:31:1
    |
 LL | / impl<'a> Clone for Lt<'a> {
 LL | |     fn clone(&self) -> Self {
@@ -30,7 +30,7 @@ LL | | }
    | |_^
    |
 note: consider deriving `Clone` or removing `Copy`
-  --> $DIR/derive.rs:32:1
+  --> $DIR/derive.rs:31:1
    |
 LL | / impl<'a> Clone for Lt<'a> {
 LL | |     fn clone(&self) -> Self {
@@ -40,7 +40,7 @@ LL | | }
    | |_^
 
 error: you are implementing `Clone` explicitly on a `Copy` type
-  --> $DIR/derive.rs:43:1
+  --> $DIR/derive.rs:42:1
    |
 LL | / impl Clone for BigArray {
 LL | |     fn clone(&self) -> Self {
@@ -50,7 +50,7 @@ LL | | }
    | |_^
    |
 note: consider deriving `Clone` or removing `Copy`
-  --> $DIR/derive.rs:43:1
+  --> $DIR/derive.rs:42:1
    |
 LL | / impl Clone for BigArray {
 LL | |     fn clone(&self) -> Self {
@@ -60,7 +60,7 @@ LL | | }
    | |_^
 
 error: you are implementing `Clone` explicitly on a `Copy` type
-  --> $DIR/derive.rs:54:1
+  --> $DIR/derive.rs:53:1
    |
 LL | / impl Clone for FnPtr {
 LL | |     fn clone(&self) -> Self {
@@ -70,7 +70,7 @@ LL | | }
    | |_^
    |
 note: consider deriving `Clone` or removing `Copy`
-  --> $DIR/derive.rs:54:1
+  --> $DIR/derive.rs:53:1
    |
 LL | / impl Clone for FnPtr {
 LL | |     fn clone(&self) -> Self {
@@ -80,7 +80,7 @@ LL | | }
    | |_^
 
 error: you are implementing `Clone` explicitly on a `Copy` type
-  --> $DIR/derive.rs:74:1
+  --> $DIR/derive.rs:73:1
    |
 LL | / impl<T: Clone> Clone for Generic2<T> {
 LL | |     fn clone(&self) -> Self {
@@ -90,7 +90,7 @@ LL | | }
    | |_^
    |
 note: consider deriving `Clone` or removing `Copy`
-  --> $DIR/derive.rs:74:1
+  --> $DIR/derive.rs:73:1
    |
 LL | / impl<T: Clone> Clone for Generic2<T> {
 LL | |     fn clone(&self) -> Self {
diff --git a/tests/ui/expect_tool_lint_rfc_2383.rs b/tests/ui/expect_tool_lint_rfc_2383.rs
index 0415e33b3fa..018f875d60b 100644
--- a/tests/ui/expect_tool_lint_rfc_2383.rs
+++ b/tests/ui/expect_tool_lint_rfc_2383.rs
@@ -22,9 +22,9 @@ mod rustc_ok {
 
         #[expect(illegal_floating_point_literal_pattern)]
         match x {
-            5.0 => {}
-            6.0 => {}
-            _ => {}
+            5.0 => {},
+            6.0 => {},
+            _ => {},
         }
     }
 }
@@ -38,9 +38,9 @@ mod rustc_warn {
 
         #[expect(illegal_floating_point_literal_pattern)]
         match x {
-            5 => {}
-            6 => {}
-            _ => {}
+            5 => {},
+            6 => {},
+            _ => {},
         }
     }
 }
diff --git a/tests/ui/format_args.fixed b/tests/ui/format_args.fixed
index 24cf0847dd5..825e122be5a 100644
--- a/tests/ui/format_args.fixed
+++ b/tests/ui/format_args.fixed
@@ -3,6 +3,7 @@
 #![allow(unused)]
 #![allow(
     clippy::assertions_on_constants,
+    clippy::double_parens,
     clippy::eq_op,
     clippy::print_literal,
     clippy::uninlined_format_args
@@ -114,6 +115,8 @@ fn main() {
     println!("error: something failed at {}", my_other_macro!());
     // https://github.com/rust-lang/rust-clippy/issues/7903
     println!("{foo}{foo:?}", foo = "foo".to_string());
+    print!("{}", (Location::caller()));
+    print!("{}", ((Location::caller())));
 }
 
 fn issue8643(vendor_id: usize, product_id: usize, name: &str) {
diff --git a/tests/ui/format_args.rs b/tests/ui/format_args.rs
index 753babf0afd..a41e53389e5 100644
--- a/tests/ui/format_args.rs
+++ b/tests/ui/format_args.rs
@@ -3,6 +3,7 @@
 #![allow(unused)]
 #![allow(
     clippy::assertions_on_constants,
+    clippy::double_parens,
     clippy::eq_op,
     clippy::print_literal,
     clippy::uninlined_format_args
@@ -114,6 +115,8 @@ fn main() {
     println!("error: something failed at {}", my_other_macro!());
     // https://github.com/rust-lang/rust-clippy/issues/7903
     println!("{foo}{foo:?}", foo = "foo".to_string());
+    print!("{}", (Location::caller().to_string()));
+    print!("{}", ((Location::caller()).to_string()));
 }
 
 fn issue8643(vendor_id: usize, product_id: usize, name: &str) {
diff --git a/tests/ui/format_args.stderr b/tests/ui/format_args.stderr
index 68b0bb9e089..f1832b97019 100644
--- a/tests/ui/format_args.stderr
+++ b/tests/ui/format_args.stderr
@@ -1,5 +1,5 @@
 error: `to_string` applied to a type that implements `Display` in `format!` args
-  --> $DIR/format_args.rs:76:72
+  --> $DIR/format_args.rs:77:72
    |
 LL |     let _ = format!("error: something failed at {}", Location::caller().to_string());
    |                                                                        ^^^^^^^^^^^^ help: remove this
@@ -7,136 +7,148 @@ LL |     let _ = format!("error: something failed at {}", Location::caller().to_
    = note: `-D clippy::to-string-in-format-args` implied by `-D warnings`
 
 error: `to_string` applied to a type that implements `Display` in `write!` args
-  --> $DIR/format_args.rs:80:27
+  --> $DIR/format_args.rs:81:27
    |
 LL |         Location::caller().to_string()
    |                           ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `writeln!` args
-  --> $DIR/format_args.rs:85:27
+  --> $DIR/format_args.rs:86:27
    |
 LL |         Location::caller().to_string()
    |                           ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `print!` args
-  --> $DIR/format_args.rs:87:63
+  --> $DIR/format_args.rs:88:63
    |
 LL |     print!("error: something failed at {}", Location::caller().to_string());
    |                                                               ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `println!` args
-  --> $DIR/format_args.rs:88:65
+  --> $DIR/format_args.rs:89:65
    |
 LL |     println!("error: something failed at {}", Location::caller().to_string());
    |                                                                 ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `eprint!` args
-  --> $DIR/format_args.rs:89:64
+  --> $DIR/format_args.rs:90:64
    |
 LL |     eprint!("error: something failed at {}", Location::caller().to_string());
    |                                                                ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `eprintln!` args
-  --> $DIR/format_args.rs:90:66
+  --> $DIR/format_args.rs:91:66
    |
 LL |     eprintln!("error: something failed at {}", Location::caller().to_string());
    |                                                                  ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `format_args!` args
-  --> $DIR/format_args.rs:91:77
+  --> $DIR/format_args.rs:92:77
    |
 LL |     let _ = format_args!("error: something failed at {}", Location::caller().to_string());
    |                                                                             ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `assert!` args
-  --> $DIR/format_args.rs:92:70
+  --> $DIR/format_args.rs:93:70
    |
 LL |     assert!(true, "error: something failed at {}", Location::caller().to_string());
    |                                                                      ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `assert_eq!` args
-  --> $DIR/format_args.rs:93:73
+  --> $DIR/format_args.rs:94:73
    |
 LL |     assert_eq!(0, 0, "error: something failed at {}", Location::caller().to_string());
    |                                                                         ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `assert_ne!` args
-  --> $DIR/format_args.rs:94:73
+  --> $DIR/format_args.rs:95:73
    |
 LL |     assert_ne!(0, 0, "error: something failed at {}", Location::caller().to_string());
    |                                                                         ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `panic!` args
-  --> $DIR/format_args.rs:95:63
+  --> $DIR/format_args.rs:96:63
    |
 LL |     panic!("error: something failed at {}", Location::caller().to_string());
    |                                                               ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `println!` args
-  --> $DIR/format_args.rs:96:20
+  --> $DIR/format_args.rs:97:20
    |
 LL |     println!("{}", X(1).to_string());
    |                    ^^^^^^^^^^^^^^^^ help: use this: `*X(1)`
 
 error: `to_string` applied to a type that implements `Display` in `println!` args
-  --> $DIR/format_args.rs:97:20
+  --> $DIR/format_args.rs:98:20
    |
 LL |     println!("{}", Y(&X(1)).to_string());
    |                    ^^^^^^^^^^^^^^^^^^^^ help: use this: `***Y(&X(1))`
 
 error: `to_string` applied to a type that implements `Display` in `println!` args
-  --> $DIR/format_args.rs:98:24
+  --> $DIR/format_args.rs:99:24
    |
 LL |     println!("{}", Z(1).to_string());
    |                        ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `println!` args
-  --> $DIR/format_args.rs:99:20
+  --> $DIR/format_args.rs:100:20
    |
 LL |     println!("{}", x.to_string());
    |                    ^^^^^^^^^^^^^ help: use this: `**x`
 
 error: `to_string` applied to a type that implements `Display` in `println!` args
-  --> $DIR/format_args.rs:100:20
+  --> $DIR/format_args.rs:101:20
    |
 LL |     println!("{}", x_ref.to_string());
    |                    ^^^^^^^^^^^^^^^^^ help: use this: `***x_ref`
 
 error: `to_string` applied to a type that implements `Display` in `println!` args
-  --> $DIR/format_args.rs:102:39
+  --> $DIR/format_args.rs:103:39
    |
 LL |     println!("{foo}{bar}", foo = "foo".to_string(), bar = "bar");
    |                                       ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `println!` args
-  --> $DIR/format_args.rs:103:52
+  --> $DIR/format_args.rs:104:52
    |
 LL |     println!("{foo}{bar}", foo = "foo", bar = "bar".to_string());
    |                                                    ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `println!` args
-  --> $DIR/format_args.rs:104:39
+  --> $DIR/format_args.rs:105:39
    |
 LL |     println!("{foo}{bar}", bar = "bar".to_string(), foo = "foo");
    |                                       ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `println!` args
-  --> $DIR/format_args.rs:105:52
+  --> $DIR/format_args.rs:106:52
    |
 LL |     println!("{foo}{bar}", bar = "bar", foo = "foo".to_string());
    |                                                    ^^^^^^^^^^^^ help: remove this
 
+error: `to_string` applied to a type that implements `Display` in `print!` args
+  --> $DIR/format_args.rs:118:37
+   |
+LL |     print!("{}", (Location::caller().to_string()));
+   |                                     ^^^^^^^^^^^^ help: remove this
+
+error: `to_string` applied to a type that implements `Display` in `print!` args
+  --> $DIR/format_args.rs:119:39
+   |
+LL |     print!("{}", ((Location::caller()).to_string()));
+   |                                       ^^^^^^^^^^^^ help: remove this
+
 error: `to_string` applied to a type that implements `Display` in `format!` args
-  --> $DIR/format_args.rs:144:38
+  --> $DIR/format_args.rs:147:38
    |
 LL |         let x = format!("{} {}", a, b.to_string());
    |                                      ^^^^^^^^^^^^ help: remove this
 
 error: `to_string` applied to a type that implements `Display` in `println!` args
-  --> $DIR/format_args.rs:158:24
+  --> $DIR/format_args.rs:161:24
    |
 LL |         println!("{}", original[..10].to_string());
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use this: `&original[..10]`
 
-error: aborting due to 23 previous errors
+error: aborting due to 25 previous errors
 
diff --git a/tests/ui/from_over_into.fixed b/tests/ui/from_over_into.fixed
new file mode 100644
index 00000000000..e66dc43b047
--- /dev/null
+++ b/tests/ui/from_over_into.fixed
@@ -0,0 +1,62 @@
+// run-rustfix
+
+#![warn(clippy::from_over_into)]
+#![allow(unused)]
+
+// this should throw an error
+struct StringWrapper(String);
+
+impl From<String> for StringWrapper {
+    fn from(val: String) -> Self {
+        StringWrapper(val)
+    }
+}
+
+struct SelfType(String);
+
+impl From<String> for SelfType {
+    fn from(val: String) -> Self {
+        SelfType(String::new())
+    }
+}
+
+#[derive(Default)]
+struct X;
+
+impl X {
+    const FOO: &'static str = "a";
+}
+
+struct SelfKeywords;
+
+impl From<X> for SelfKeywords {
+    fn from(val: X) -> Self {
+        let _ = X::default();
+        let _ = X::FOO;
+        let _: X = val;
+
+        SelfKeywords
+    }
+}
+
+struct ExplicitPaths(bool);
+
+impl core::convert::From<crate::ExplicitPaths> for bool {
+    fn from(mut val: crate::ExplicitPaths) -> Self {
+        let in_closure = || val.0;
+
+        val.0 = false;
+        val.0
+    }
+}
+
+// this is fine
+struct A(String);
+
+impl From<String> for A {
+    fn from(s: String) -> A {
+        A(s)
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/from_over_into.rs b/tests/ui/from_over_into.rs
index 292d0924fb1..74c7be6af79 100644
--- a/tests/ui/from_over_into.rs
+++ b/tests/ui/from_over_into.rs
@@ -1,4 +1,7 @@
+// run-rustfix
+
 #![warn(clippy::from_over_into)]
+#![allow(unused)]
 
 // this should throw an error
 struct StringWrapper(String);
@@ -9,6 +12,44 @@ impl Into<StringWrapper> for String {
     }
 }
 
+struct SelfType(String);
+
+impl Into<SelfType> for String {
+    fn into(self) -> SelfType {
+        SelfType(Self::new())
+    }
+}
+
+#[derive(Default)]
+struct X;
+
+impl X {
+    const FOO: &'static str = "a";
+}
+
+struct SelfKeywords;
+
+impl Into<SelfKeywords> for X {
+    fn into(self) -> SelfKeywords {
+        let _ = Self::default();
+        let _ = Self::FOO;
+        let _: Self = self;
+
+        SelfKeywords
+    }
+}
+
+struct ExplicitPaths(bool);
+
+impl core::convert::Into<bool> for crate::ExplicitPaths {
+    fn into(mut self) -> bool {
+        let in_closure = || self.0;
+
+        self.0 = false;
+        self.0
+    }
+}
+
 // this is fine
 struct A(String);
 
diff --git a/tests/ui/from_over_into.stderr b/tests/ui/from_over_into.stderr
index 469adadd219..6cf83e25807 100644
--- a/tests/ui/from_over_into.stderr
+++ b/tests/ui/from_over_into.stderr
@@ -1,11 +1,62 @@
 error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
-  --> $DIR/from_over_into.rs:6:1
+  --> $DIR/from_over_into.rs:9:1
    |
 LL | impl Into<StringWrapper> for String {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = help: consider to implement `From<std::string::String>` instead
    = note: `-D clippy::from-over-into` implied by `-D warnings`
+help: replace the `Into` implentation with `From<std::string::String>`
+   |
+LL ~ impl From<String> for StringWrapper {
+LL ~     fn from(val: String) -> Self {
+LL ~         StringWrapper(val)
+   |
+
+error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
+  --> $DIR/from_over_into.rs:17:1
+   |
+LL | impl Into<SelfType> for String {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: replace the `Into` implentation with `From<std::string::String>`
+   |
+LL ~ impl From<String> for SelfType {
+LL ~     fn from(val: String) -> Self {
+LL ~         SelfType(String::new())
+   |
+
+error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
+  --> $DIR/from_over_into.rs:32:1
+   |
+LL | impl Into<SelfKeywords> for X {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: replace the `Into` implentation with `From<X>`
+   |
+LL ~ impl From<X> for SelfKeywords {
+LL ~     fn from(val: X) -> Self {
+LL ~         let _ = X::default();
+LL ~         let _ = X::FOO;
+LL ~         let _: X = val;
+   |
+
+error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
+  --> $DIR/from_over_into.rs:44:1
+   |
+LL | impl core::convert::Into<bool> for crate::ExplicitPaths {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
+           https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
+help: replace the `Into` implentation with `From<ExplicitPaths>`
+   |
+LL ~ impl core::convert::From<crate::ExplicitPaths> for bool {
+LL ~     fn from(mut val: crate::ExplicitPaths) -> Self {
+LL ~         let in_closure = || val.0;
+LL | 
+LL ~         val.0 = false;
+LL ~         val.0
+   |
 
-error: aborting due to previous error
+error: aborting due to 4 previous errors
 
diff --git a/tests/ui/from_over_into_unfixable.rs b/tests/ui/from_over_into_unfixable.rs
new file mode 100644
index 00000000000..3b280b7488a
--- /dev/null
+++ b/tests/ui/from_over_into_unfixable.rs
@@ -0,0 +1,35 @@
+#![warn(clippy::from_over_into)]
+
+struct InMacro(String);
+
+macro_rules! in_macro {
+    ($e:ident) => {
+        $e
+    };
+}
+
+impl Into<InMacro> for String {
+    fn into(self) -> InMacro {
+        InMacro(in_macro!(self))
+    }
+}
+
+struct WeirdUpperSelf;
+
+impl Into<WeirdUpperSelf> for &'static [u8] {
+    fn into(self) -> WeirdUpperSelf {
+        let _ = Self::default();
+        WeirdUpperSelf
+    }
+}
+
+struct ContainsVal;
+
+impl Into<u8> for ContainsVal {
+    fn into(self) -> u8 {
+        let val = 1;
+        val + 1
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/from_over_into_unfixable.stderr b/tests/ui/from_over_into_unfixable.stderr
new file mode 100644
index 00000000000..6f6ce351921
--- /dev/null
+++ b/tests/ui/from_over_into_unfixable.stderr
@@ -0,0 +1,29 @@
+error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
+  --> $DIR/from_over_into_unfixable.rs:11:1
+   |
+LL | impl Into<InMacro> for String {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: replace the `Into` implentation with `From<std::string::String>`
+   = note: `-D clippy::from-over-into` implied by `-D warnings`
+
+error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
+  --> $DIR/from_over_into_unfixable.rs:19:1
+   |
+LL | impl Into<WeirdUpperSelf> for &'static [u8] {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: replace the `Into` implentation with `From<&'static [u8]>`
+
+error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
+  --> $DIR/from_over_into_unfixable.rs:28:1
+   |
+LL | impl Into<u8> for ContainsVal {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
+           https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
+   = help: replace the `Into` implentation with `From<ContainsVal>`
+
+error: aborting due to 3 previous errors
+
diff --git a/tests/ui/implicit_saturating_sub.fixed b/tests/ui/implicit_saturating_sub.fixed
index e6f57e9267e..93df81b1a7f 100644
--- a/tests/ui/implicit_saturating_sub.fixed
+++ b/tests/ui/implicit_saturating_sub.fixed
@@ -2,6 +2,21 @@
 #![allow(unused_assignments, unused_mut, clippy::assign_op_pattern)]
 #![warn(clippy::implicit_saturating_sub)]
 
+use std::cmp::PartialEq;
+use std::ops::SubAssign;
+// Mock type
+struct Mock;
+
+impl PartialEq<u32> for Mock {
+    fn eq(&self, _: &u32) -> bool {
+        true
+    }
+}
+
+impl SubAssign<u32> for Mock {
+    fn sub_assign(&mut self, _: u32) {}
+}
+
 fn main() {
     // Tests for unsigned integers
 
@@ -165,4 +180,39 @@ fn main() {
     } else {
         println!("side effect");
     }
+
+    // Extended tests
+    let mut m = Mock;
+    let mut u_32 = 3000;
+    let a = 200;
+    let mut _b = 8;
+
+    if m != 0 {
+        m -= 1;
+    }
+
+    if a > 0 {
+        _b -= 1;
+    }
+
+    if 0 > a {
+        _b -= 1;
+    }
+
+    if u_32 > 0 {
+        u_32 -= 1;
+    } else {
+        println!("don't lint this");
+    }
+
+    if u_32 > 0 {
+        println!("don't lint this");
+        u_32 -= 1;
+    }
+
+    if u_32 > 42 {
+        println!("brace yourself!");
+    } else if u_32 > 0 {
+        u_32 -= 1;
+    }
 }
diff --git a/tests/ui/implicit_saturating_sub.rs b/tests/ui/implicit_saturating_sub.rs
index 8bb28d149c6..8340bc8264d 100644
--- a/tests/ui/implicit_saturating_sub.rs
+++ b/tests/ui/implicit_saturating_sub.rs
@@ -2,6 +2,21 @@
 #![allow(unused_assignments, unused_mut, clippy::assign_op_pattern)]
 #![warn(clippy::implicit_saturating_sub)]
 
+use std::cmp::PartialEq;
+use std::ops::SubAssign;
+// Mock type
+struct Mock;
+
+impl PartialEq<u32> for Mock {
+    fn eq(&self, _: &u32) -> bool {
+        true
+    }
+}
+
+impl SubAssign<u32> for Mock {
+    fn sub_assign(&mut self, _: u32) {}
+}
+
 fn main() {
     // Tests for unsigned integers
 
@@ -211,4 +226,39 @@ fn main() {
     } else {
         println!("side effect");
     }
+
+    // Extended tests
+    let mut m = Mock;
+    let mut u_32 = 3000;
+    let a = 200;
+    let mut _b = 8;
+
+    if m != 0 {
+        m -= 1;
+    }
+
+    if a > 0 {
+        _b -= 1;
+    }
+
+    if 0 > a {
+        _b -= 1;
+    }
+
+    if u_32 > 0 {
+        u_32 -= 1;
+    } else {
+        println!("don't lint this");
+    }
+
+    if u_32 > 0 {
+        println!("don't lint this");
+        u_32 -= 1;
+    }
+
+    if u_32 > 42 {
+        println!("brace yourself!");
+    } else if u_32 > 0 {
+        u_32 -= 1;
+    }
 }
diff --git a/tests/ui/implicit_saturating_sub.stderr b/tests/ui/implicit_saturating_sub.stderr
index 5bb9a606422..5e589d931e4 100644
--- a/tests/ui/implicit_saturating_sub.stderr
+++ b/tests/ui/implicit_saturating_sub.stderr
@@ -1,5 +1,5 @@
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:13:5
+  --> $DIR/implicit_saturating_sub.rs:28:5
    |
 LL | /     if u_8 > 0 {
 LL | |         u_8 = u_8 - 1;
@@ -9,7 +9,7 @@ LL | |     }
    = note: `-D clippy::implicit-saturating-sub` implied by `-D warnings`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:20:13
+  --> $DIR/implicit_saturating_sub.rs:35:13
    |
 LL | /             if u_8 > 0 {
 LL | |                 u_8 -= 1;
@@ -17,7 +17,7 @@ LL | |             }
    | |_____________^ help: try: `u_8 = u_8.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:34:5
+  --> $DIR/implicit_saturating_sub.rs:49:5
    |
 LL | /     if u_16 > 0 {
 LL | |         u_16 -= 1;
@@ -25,7 +25,7 @@ LL | |     }
    | |_____^ help: try: `u_16 = u_16.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:44:5
+  --> $DIR/implicit_saturating_sub.rs:59:5
    |
 LL | /     if u_32 != 0 {
 LL | |         u_32 -= 1;
@@ -33,7 +33,7 @@ LL | |     }
    | |_____^ help: try: `u_32 = u_32.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:65:5
+  --> $DIR/implicit_saturating_sub.rs:80:5
    |
 LL | /     if u_64 > 0 {
 LL | |         u_64 -= 1;
@@ -41,7 +41,7 @@ LL | |     }
    | |_____^ help: try: `u_64 = u_64.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:70:5
+  --> $DIR/implicit_saturating_sub.rs:85:5
    |
 LL | /     if 0 < u_64 {
 LL | |         u_64 -= 1;
@@ -49,7 +49,7 @@ LL | |     }
    | |_____^ help: try: `u_64 = u_64.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:75:5
+  --> $DIR/implicit_saturating_sub.rs:90:5
    |
 LL | /     if 0 != u_64 {
 LL | |         u_64 -= 1;
@@ -57,7 +57,7 @@ LL | |     }
    | |_____^ help: try: `u_64 = u_64.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:96:5
+  --> $DIR/implicit_saturating_sub.rs:111:5
    |
 LL | /     if u_usize > 0 {
 LL | |         u_usize -= 1;
@@ -65,7 +65,7 @@ LL | |     }
    | |_____^ help: try: `u_usize = u_usize.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:108:5
+  --> $DIR/implicit_saturating_sub.rs:123:5
    |
 LL | /     if i_8 > i8::MIN {
 LL | |         i_8 -= 1;
@@ -73,7 +73,7 @@ LL | |     }
    | |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:113:5
+  --> $DIR/implicit_saturating_sub.rs:128:5
    |
 LL | /     if i_8 > i8::MIN {
 LL | |         i_8 -= 1;
@@ -81,7 +81,7 @@ LL | |     }
    | |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:118:5
+  --> $DIR/implicit_saturating_sub.rs:133:5
    |
 LL | /     if i_8 != i8::MIN {
 LL | |         i_8 -= 1;
@@ -89,7 +89,7 @@ LL | |     }
    | |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:123:5
+  --> $DIR/implicit_saturating_sub.rs:138:5
    |
 LL | /     if i_8 != i8::MIN {
 LL | |         i_8 -= 1;
@@ -97,7 +97,7 @@ LL | |     }
    | |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:133:5
+  --> $DIR/implicit_saturating_sub.rs:148:5
    |
 LL | /     if i_16 > i16::MIN {
 LL | |         i_16 -= 1;
@@ -105,7 +105,7 @@ LL | |     }
    | |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:138:5
+  --> $DIR/implicit_saturating_sub.rs:153:5
    |
 LL | /     if i_16 > i16::MIN {
 LL | |         i_16 -= 1;
@@ -113,7 +113,7 @@ LL | |     }
    | |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:143:5
+  --> $DIR/implicit_saturating_sub.rs:158:5
    |
 LL | /     if i_16 != i16::MIN {
 LL | |         i_16 -= 1;
@@ -121,7 +121,7 @@ LL | |     }
    | |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:148:5
+  --> $DIR/implicit_saturating_sub.rs:163:5
    |
 LL | /     if i_16 != i16::MIN {
 LL | |         i_16 -= 1;
@@ -129,7 +129,7 @@ LL | |     }
    | |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:158:5
+  --> $DIR/implicit_saturating_sub.rs:173:5
    |
 LL | /     if i_32 > i32::MIN {
 LL | |         i_32 -= 1;
@@ -137,7 +137,7 @@ LL | |     }
    | |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:163:5
+  --> $DIR/implicit_saturating_sub.rs:178:5
    |
 LL | /     if i_32 > i32::MIN {
 LL | |         i_32 -= 1;
@@ -145,7 +145,7 @@ LL | |     }
    | |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:168:5
+  --> $DIR/implicit_saturating_sub.rs:183:5
    |
 LL | /     if i_32 != i32::MIN {
 LL | |         i_32 -= 1;
@@ -153,7 +153,7 @@ LL | |     }
    | |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:173:5
+  --> $DIR/implicit_saturating_sub.rs:188:5
    |
 LL | /     if i_32 != i32::MIN {
 LL | |         i_32 -= 1;
@@ -161,7 +161,7 @@ LL | |     }
    | |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:183:5
+  --> $DIR/implicit_saturating_sub.rs:198:5
    |
 LL | /     if i64::MIN < i_64 {
 LL | |         i_64 -= 1;
@@ -169,7 +169,7 @@ LL | |     }
    | |_____^ help: try: `i_64 = i_64.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:188:5
+  --> $DIR/implicit_saturating_sub.rs:203:5
    |
 LL | /     if i64::MIN != i_64 {
 LL | |         i_64 -= 1;
@@ -177,7 +177,7 @@ LL | |     }
    | |_____^ help: try: `i_64 = i_64.saturating_sub(1);`
 
 error: implicitly performing saturating subtraction
-  --> $DIR/implicit_saturating_sub.rs:193:5
+  --> $DIR/implicit_saturating_sub.rs:208:5
    |
 LL | /     if i64::MIN < i_64 {
 LL | |         i_64 -= 1;
diff --git a/tests/ui/literals.rs b/tests/ui/literals.rs
index 0cadd5a3da1..1a646e49ce3 100644
--- a/tests/ui/literals.rs
+++ b/tests/ui/literals.rs
@@ -40,3 +40,10 @@ fn main() {
     let ok26 = 0x6_A0_BF;
     let ok27 = 0b1_0010_0101;
 }
+
+fn issue9651() {
+    // lint but octal form is not possible here
+    let _ = 08;
+    let _ = 09;
+    let _ = 089;
+}
diff --git a/tests/ui/literals.stderr b/tests/ui/literals.stderr
index 365b2407473..603d47bacca 100644
--- a/tests/ui/literals.stderr
+++ b/tests/ui/literals.stderr
@@ -135,5 +135,38 @@ error: digits of hex or binary literal not grouped by four
 LL |     let fail25 = 0b01_100_101;
    |                  ^^^^^^^^^^^^ help: consider: `0b0110_0101`
 
-error: aborting due to 18 previous errors
+error: this is a decimal constant
+  --> $DIR/literals.rs:46:13
+   |
+LL |     let _ = 08;
+   |             ^^
+   |
+help: if you mean to use a decimal constant, remove the `0` to avoid confusion
+   |
+LL |     let _ = 8;
+   |             ~
+
+error: this is a decimal constant
+  --> $DIR/literals.rs:47:13
+   |
+LL |     let _ = 09;
+   |             ^^
+   |
+help: if you mean to use a decimal constant, remove the `0` to avoid confusion
+   |
+LL |     let _ = 9;
+   |             ~
+
+error: this is a decimal constant
+  --> $DIR/literals.rs:48:13
+   |
+LL |     let _ = 089;
+   |             ^^^
+   |
+help: if you mean to use a decimal constant, remove the `0` to avoid confusion
+   |
+LL |     let _ = 89;
+   |             ~~
+
+error: aborting due to 21 previous errors
 
diff --git a/tests/ui/manual_assert.edition2018.fixed b/tests/ui/manual_assert.edition2018.fixed
index 26e3b8f63e7..c9a819ba535 100644
--- a/tests/ui/manual_assert.edition2018.fixed
+++ b/tests/ui/manual_assert.edition2018.fixed
@@ -1,6 +1,6 @@
 // revisions: edition2018 edition2021
-// [edition2018] edition:2018
-// [edition2021] edition:2021
+//[edition2018] edition:2018
+//[edition2021] edition:2021
 // run-rustfix
 
 #![warn(clippy::manual_assert)]
@@ -29,7 +29,9 @@ fn main() {
         panic!("qaqaq{:?}", a);
     }
     assert!(a.is_empty(), "qaqaq{:?}", a);
-    assert!(a.is_empty(), "qwqwq");
+    if !a.is_empty() {
+        panic!("qwqwq");
+    }
     if a.len() == 3 {
         println!("qwq");
         println!("qwq");
@@ -44,21 +46,32 @@ fn main() {
         println!("qwq");
     }
     let b = vec![1, 2, 3];
-    assert!(!b.is_empty(), "panic1");
-    assert!(!(b.is_empty() && a.is_empty()), "panic2");
-    assert!(!(a.is_empty() && !b.is_empty()), "panic3");
-    assert!(!(b.is_empty() || a.is_empty()), "panic4");
-    assert!(!(a.is_empty() || !b.is_empty()), "panic5");
+    if b.is_empty() {
+        panic!("panic1");
+    }
+    if b.is_empty() && a.is_empty() {
+        panic!("panic2");
+    }
+    if a.is_empty() && !b.is_empty() {
+        panic!("panic3");
+    }
+    if b.is_empty() || a.is_empty() {
+        panic!("panic4");
+    }
+    if a.is_empty() || !b.is_empty() {
+        panic!("panic5");
+    }
     assert!(!a.is_empty(), "with expansion {}", one!());
 }
 
 fn issue7730(a: u8) {
     // Suggestion should preserve comment
-    // comment
-/* this is a
+    if a > 2 {
+        // comment
+        /* this is a
         multiline
         comment */
-/// Doc comment
-// comment after `panic!`
-assert!(!(a > 2), "panic with comment");
+        /// Doc comment
+        panic!("panic with comment") // comment after `panic!`
+    }
 }
diff --git a/tests/ui/manual_assert.edition2018.stderr b/tests/ui/manual_assert.edition2018.stderr
index 7718588fdf6..c4e6bcd92fc 100644
--- a/tests/ui/manual_assert.edition2018.stderr
+++ b/tests/ui/manual_assert.edition2018.stderr
@@ -13,84 +13,6 @@ LL |     assert!(a.is_empty(), "qaqaq{:?}", a);
    |
 
 error: only a `panic!` in `if`-then statement
-  --> $DIR/manual_assert.rs:34:5
-   |
-LL | /     if !a.is_empty() {
-LL | |         panic!("qwqwq");
-LL | |     }
-   | |_____^
-   |
-help: try instead
-   |
-LL |     assert!(a.is_empty(), "qwqwq");
-   |
-
-error: only a `panic!` in `if`-then statement
-  --> $DIR/manual_assert.rs:51:5
-   |
-LL | /     if b.is_empty() {
-LL | |         panic!("panic1");
-LL | |     }
-   | |_____^
-   |
-help: try instead
-   |
-LL |     assert!(!b.is_empty(), "panic1");
-   |
-
-error: only a `panic!` in `if`-then statement
-  --> $DIR/manual_assert.rs:54:5
-   |
-LL | /     if b.is_empty() && a.is_empty() {
-LL | |         panic!("panic2");
-LL | |     }
-   | |_____^
-   |
-help: try instead
-   |
-LL |     assert!(!(b.is_empty() && a.is_empty()), "panic2");
-   |
-
-error: only a `panic!` in `if`-then statement
-  --> $DIR/manual_assert.rs:57:5
-   |
-LL | /     if a.is_empty() && !b.is_empty() {
-LL | |         panic!("panic3");
-LL | |     }
-   | |_____^
-   |
-help: try instead
-   |
-LL |     assert!(!(a.is_empty() && !b.is_empty()), "panic3");
-   |
-
-error: only a `panic!` in `if`-then statement
-  --> $DIR/manual_assert.rs:60:5
-   |
-LL | /     if b.is_empty() || a.is_empty() {
-LL | |         panic!("panic4");
-LL | |     }
-   | |_____^
-   |
-help: try instead
-   |
-LL |     assert!(!(b.is_empty() || a.is_empty()), "panic4");
-   |
-
-error: only a `panic!` in `if`-then statement
-  --> $DIR/manual_assert.rs:63:5
-   |
-LL | /     if a.is_empty() || !b.is_empty() {
-LL | |         panic!("panic5");
-LL | |     }
-   | |_____^
-   |
-help: try instead
-   |
-LL |     assert!(!(a.is_empty() || !b.is_empty()), "panic5");
-   |
-
-error: only a `panic!` in `if`-then statement
   --> $DIR/manual_assert.rs:66:5
    |
 LL | /     if a.is_empty() {
@@ -103,22 +25,5 @@ help: try instead
 LL |     assert!(!a.is_empty(), "with expansion {}", one!());
    |
 
-error: only a `panic!` in `if`-then statement
-  --> $DIR/manual_assert.rs:73:5
-   |
-LL | /     if a > 2 {
-LL | |         // comment
-LL | |         /* this is a
-LL | |         multiline
-...  |
-LL | |         panic!("panic with comment") // comment after `panic!`
-LL | |     }
-   | |_____^
-   |
-help: try instead
-   |
-LL |     assert!(!(a > 2), "panic with comment");
-   |
-
-error: aborting due to 9 previous errors
+error: aborting due to 2 previous errors
 
diff --git a/tests/ui/manual_assert.edition2021.fixed b/tests/ui/manual_assert.edition2021.fixed
index 26e3b8f63e7..2f62de51cad 100644
--- a/tests/ui/manual_assert.edition2021.fixed
+++ b/tests/ui/manual_assert.edition2021.fixed
@@ -1,6 +1,6 @@
 // revisions: edition2018 edition2021
-// [edition2018] edition:2018
-// [edition2021] edition:2021
+//[edition2018] edition:2018
+//[edition2021] edition:2021
 // run-rustfix
 
 #![warn(clippy::manual_assert)]
diff --git a/tests/ui/manual_assert.rs b/tests/ui/manual_assert.rs
index 8c37753071d..6a4cc2468d4 100644
--- a/tests/ui/manual_assert.rs
+++ b/tests/ui/manual_assert.rs
@@ -1,6 +1,6 @@
 // revisions: edition2018 edition2021
-// [edition2018] edition:2018
-// [edition2021] edition:2021
+//[edition2018] edition:2018
+//[edition2021] edition:2021
 // run-rustfix
 
 #![warn(clippy::manual_assert)]
diff --git a/tests/ui/manual_filter.fixed b/tests/ui/manual_filter.fixed
new file mode 100644
index 00000000000..3553291b87d
--- /dev/null
+++ b/tests/ui/manual_filter.fixed
@@ -0,0 +1,119 @@
+// run-rustfix
+
+#![warn(clippy::manual_filter)]
+#![allow(unused_variables, dead_code)]
+
+fn main() {
+    Some(0).filter(|&x| x <= 0);
+
+    Some(1).filter(|&x| x <= 0);
+
+    Some(2).filter(|&x| x <= 0);
+
+    Some(3).filter(|&x| x > 0);
+
+    let y = Some(4);
+    y.filter(|&x| x <= 0);
+
+    Some(5).filter(|&x| x > 0);
+
+    Some(6).as_ref().filter(|&x| x > &0);
+
+    let external_cond = true;
+    Some(String::new()).filter(|x| external_cond);
+
+    Some(7).filter(|&x| external_cond);
+
+    Some(8).filter(|&x| x != 0);
+
+    Some(9).filter(|&x| x > 10 && x < 100);
+
+    const fn f1() {
+        // Don't lint, `.filter` is not const
+        match Some(10) {
+            Some(x) => {
+                if x > 10 && x < 100 {
+                    Some(x)
+                } else {
+                    None
+                }
+            },
+            None => None,
+        };
+    }
+
+    #[allow(clippy::blocks_in_if_conditions)]
+    Some(11).filter(|&x| {
+                println!("foo");
+                x > 10 && x < 100
+            });
+
+    match Some(12) {
+        // Don't Lint, statement is lost by `.filter`
+        Some(x) => {
+            if x > 10 && x < 100 {
+                println!("foo");
+                Some(x)
+            } else {
+                None
+            }
+        },
+        None => None,
+    };
+
+    match Some(13) {
+        // Don't Lint, because of `None => Some(1)`
+        Some(x) => {
+            if x > 10 && x < 100 {
+                println!("foo");
+                Some(x)
+            } else {
+                None
+            }
+        },
+        None => Some(1),
+    };
+
+    unsafe fn f(x: u32) -> bool {
+        true
+    }
+    let _ = Some(14).filter(|&x| unsafe { f(x) });
+    let _ = Some(15).filter(|&x| unsafe { f(x) });
+
+    #[allow(clippy::redundant_pattern_matching)]
+    if let Some(_) = Some(16) {
+        Some(16)
+    } else { Some(16).filter(|&x| x % 2 == 0) };
+
+    match Some((17, 17)) {
+        // Not linted for now could be
+        Some((x, y)) => {
+            if y != x {
+                Some((x, y))
+            } else {
+                None
+            }
+        },
+        None => None,
+    };
+
+    struct NamedTuple {
+        pub x: u8,
+        pub y: (i32, u32),
+    }
+
+    match Some(NamedTuple {
+        // Not linted for now could be
+        x: 17,
+        y: (18, 19),
+    }) {
+        Some(NamedTuple { x, y }) => {
+            if y.1 != x as u32 {
+                Some(NamedTuple { x, y })
+            } else {
+                None
+            }
+        },
+        None => None,
+    };
+}
diff --git a/tests/ui/manual_filter.rs b/tests/ui/manual_filter.rs
new file mode 100644
index 00000000000..aa9f90f752b
--- /dev/null
+++ b/tests/ui/manual_filter.rs
@@ -0,0 +1,243 @@
+// run-rustfix
+
+#![warn(clippy::manual_filter)]
+#![allow(unused_variables, dead_code)]
+
+fn main() {
+    match Some(0) {
+        None => None,
+        Some(x) => {
+            if x > 0 {
+                None
+            } else {
+                Some(x)
+            }
+        },
+    };
+
+    match Some(1) {
+        Some(x) => {
+            if x > 0 {
+                None
+            } else {
+                Some(x)
+            }
+        },
+        None => None,
+    };
+
+    match Some(2) {
+        Some(x) => {
+            if x > 0 {
+                None
+            } else {
+                Some(x)
+            }
+        },
+        _ => None,
+    };
+
+    match Some(3) {
+        Some(x) => {
+            if x > 0 {
+                Some(x)
+            } else {
+                None
+            }
+        },
+        None => None,
+    };
+
+    let y = Some(4);
+    match y {
+        // Some(4)
+        None => None,
+        Some(x) => {
+            if x > 0 {
+                None
+            } else {
+                Some(x)
+            }
+        },
+    };
+
+    match Some(5) {
+        Some(x) => {
+            if x > 0 {
+                Some(x)
+            } else {
+                None
+            }
+        },
+        _ => None,
+    };
+
+    match Some(6) {
+        Some(ref x) => {
+            if x > &0 {
+                Some(x)
+            } else {
+                None
+            }
+        },
+        _ => None,
+    };
+
+    let external_cond = true;
+    match Some(String::new()) {
+        Some(x) => {
+            if external_cond {
+                Some(x)
+            } else {
+                None
+            }
+        },
+        _ => None,
+    };
+
+    if let Some(x) = Some(7) {
+        if external_cond { Some(x) } else { None }
+    } else {
+        None
+    };
+
+    match &Some(8) {
+        &Some(x) => {
+            if x != 0 {
+                Some(x)
+            } else {
+                None
+            }
+        },
+        _ => None,
+    };
+
+    match Some(9) {
+        Some(x) => {
+            if x > 10 && x < 100 {
+                Some(x)
+            } else {
+                None
+            }
+        },
+        None => None,
+    };
+
+    const fn f1() {
+        // Don't lint, `.filter` is not const
+        match Some(10) {
+            Some(x) => {
+                if x > 10 && x < 100 {
+                    Some(x)
+                } else {
+                    None
+                }
+            },
+            None => None,
+        };
+    }
+
+    #[allow(clippy::blocks_in_if_conditions)]
+    match Some(11) {
+        // Lint, statement is preserved by `.filter`
+        Some(x) => {
+            if {
+                println!("foo");
+                x > 10 && x < 100
+            } {
+                Some(x)
+            } else {
+                None
+            }
+        },
+        None => None,
+    };
+
+    match Some(12) {
+        // Don't Lint, statement is lost by `.filter`
+        Some(x) => {
+            if x > 10 && x < 100 {
+                println!("foo");
+                Some(x)
+            } else {
+                None
+            }
+        },
+        None => None,
+    };
+
+    match Some(13) {
+        // Don't Lint, because of `None => Some(1)`
+        Some(x) => {
+            if x > 10 && x < 100 {
+                println!("foo");
+                Some(x)
+            } else {
+                None
+            }
+        },
+        None => Some(1),
+    };
+
+    unsafe fn f(x: u32) -> bool {
+        true
+    }
+    let _ = match Some(14) {
+        Some(x) => {
+            if unsafe { f(x) } {
+                Some(x)
+            } else {
+                None
+            }
+        },
+        None => None,
+    };
+    let _ = match Some(15) {
+        Some(x) => unsafe {
+            if f(x) { Some(x) } else { None }
+        },
+        None => None,
+    };
+
+    #[allow(clippy::redundant_pattern_matching)]
+    if let Some(_) = Some(16) {
+        Some(16)
+    } else if let Some(x) = Some(16) {
+        // Lint starting from here
+        if x % 2 == 0 { Some(x) } else { None }
+    } else {
+        None
+    };
+
+    match Some((17, 17)) {
+        // Not linted for now could be
+        Some((x, y)) => {
+            if y != x {
+                Some((x, y))
+            } else {
+                None
+            }
+        },
+        None => None,
+    };
+
+    struct NamedTuple {
+        pub x: u8,
+        pub y: (i32, u32),
+    }
+
+    match Some(NamedTuple {
+        // Not linted for now could be
+        x: 17,
+        y: (18, 19),
+    }) {
+        Some(NamedTuple { x, y }) => {
+            if y.1 != x as u32 {
+                Some(NamedTuple { x, y })
+            } else {
+                None
+            }
+        },
+        None => None,
+    };
+}
diff --git a/tests/ui/manual_filter.stderr b/tests/ui/manual_filter.stderr
new file mode 100644
index 00000000000..53dea922930
--- /dev/null
+++ b/tests/ui/manual_filter.stderr
@@ -0,0 +1,191 @@
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:7:5
+   |
+LL | /     match Some(0) {
+LL | |         None => None,
+LL | |         Some(x) => {
+LL | |             if x > 0 {
+...  |
+LL | |         },
+LL | |     };
+   | |_____^ help: try this: `Some(0).filter(|&x| x <= 0)`
+   |
+   = note: `-D clippy::manual-filter` implied by `-D warnings`
+
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:18:5
+   |
+LL | /     match Some(1) {
+LL | |         Some(x) => {
+LL | |             if x > 0 {
+LL | |                 None
+...  |
+LL | |         None => None,
+LL | |     };
+   | |_____^ help: try this: `Some(1).filter(|&x| x <= 0)`
+
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:29:5
+   |
+LL | /     match Some(2) {
+LL | |         Some(x) => {
+LL | |             if x > 0 {
+LL | |                 None
+...  |
+LL | |         _ => None,
+LL | |     };
+   | |_____^ help: try this: `Some(2).filter(|&x| x <= 0)`
+
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:40:5
+   |
+LL | /     match Some(3) {
+LL | |         Some(x) => {
+LL | |             if x > 0 {
+LL | |                 Some(x)
+...  |
+LL | |         None => None,
+LL | |     };
+   | |_____^ help: try this: `Some(3).filter(|&x| x > 0)`
+
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:52:5
+   |
+LL | /     match y {
+LL | |         // Some(4)
+LL | |         None => None,
+LL | |         Some(x) => {
+...  |
+LL | |         },
+LL | |     };
+   | |_____^ help: try this: `y.filter(|&x| x <= 0)`
+
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:64:5
+   |
+LL | /     match Some(5) {
+LL | |         Some(x) => {
+LL | |             if x > 0 {
+LL | |                 Some(x)
+...  |
+LL | |         _ => None,
+LL | |     };
+   | |_____^ help: try this: `Some(5).filter(|&x| x > 0)`
+
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:75:5
+   |
+LL | /     match Some(6) {
+LL | |         Some(ref x) => {
+LL | |             if x > &0 {
+LL | |                 Some(x)
+...  |
+LL | |         _ => None,
+LL | |     };
+   | |_____^ help: try this: `Some(6).as_ref().filter(|&x| x > &0)`
+
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:87:5
+   |
+LL | /     match Some(String::new()) {
+LL | |         Some(x) => {
+LL | |             if external_cond {
+LL | |                 Some(x)
+...  |
+LL | |         _ => None,
+LL | |     };
+   | |_____^ help: try this: `Some(String::new()).filter(|x| external_cond)`
+
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:98:5
+   |
+LL | /     if let Some(x) = Some(7) {
+LL | |         if external_cond { Some(x) } else { None }
+LL | |     } else {
+LL | |         None
+LL | |     };
+   | |_____^ help: try this: `Some(7).filter(|&x| external_cond)`
+
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:104:5
+   |
+LL | /     match &Some(8) {
+LL | |         &Some(x) => {
+LL | |             if x != 0 {
+LL | |                 Some(x)
+...  |
+LL | |         _ => None,
+LL | |     };
+   | |_____^ help: try this: `Some(8).filter(|&x| x != 0)`
+
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:115:5
+   |
+LL | /     match Some(9) {
+LL | |         Some(x) => {
+LL | |             if x > 10 && x < 100 {
+LL | |                 Some(x)
+...  |
+LL | |         None => None,
+LL | |     };
+   | |_____^ help: try this: `Some(9).filter(|&x| x > 10 && x < 100)`
+
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:141:5
+   |
+LL | /     match Some(11) {
+LL | |         // Lint, statement is preserved by `.filter`
+LL | |         Some(x) => {
+LL | |             if {
+...  |
+LL | |         None => None,
+LL | |     };
+   | |_____^
+   |
+help: try this
+   |
+LL ~     Some(11).filter(|&x| {
+LL +                 println!("foo");
+LL +                 x > 10 && x < 100
+LL ~             });
+   |
+
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:185:13
+   |
+LL |       let _ = match Some(14) {
+   |  _____________^
+LL | |         Some(x) => {
+LL | |             if unsafe { f(x) } {
+LL | |                 Some(x)
+...  |
+LL | |         None => None,
+LL | |     };
+   | |_____^ help: try this: `Some(14).filter(|&x| unsafe { f(x) })`
+
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:195:13
+   |
+LL |       let _ = match Some(15) {
+   |  _____________^
+LL | |         Some(x) => unsafe {
+LL | |             if f(x) { Some(x) } else { None }
+LL | |         },
+LL | |         None => None,
+LL | |     };
+   | |_____^ help: try this: `Some(15).filter(|&x| unsafe { f(x) })`
+
+error: manual implementation of `Option::filter`
+  --> $DIR/manual_filter.rs:205:12
+   |
+LL |       } else if let Some(x) = Some(16) {
+   |  ____________^
+LL | |         // Lint starting from here
+LL | |         if x % 2 == 0 { Some(x) } else { None }
+LL | |     } else {
+LL | |         None
+LL | |     };
+   | |_____^ help: try this: `{ Some(16).filter(|&x| x % 2 == 0) }`
+
+error: aborting due to 15 previous errors
+
diff --git a/tests/ui/match_overlapping_arm.rs b/tests/ui/match_overlapping_arm.rs
index 22b04b208f8..b4097fa9604 100644
--- a/tests/ui/match_overlapping_arm.rs
+++ b/tests/ui/match_overlapping_arm.rs
@@ -1,5 +1,4 @@
 #![feature(exclusive_range_pattern)]
-
 #![warn(clippy::match_overlapping_arm)]
 #![allow(clippy::redundant_pattern_matching)]
 #![allow(clippy::if_same_then_else, clippy::equatable_if_let)]
diff --git a/tests/ui/match_overlapping_arm.stderr b/tests/ui/match_overlapping_arm.stderr
index a72becbeb66..b98d4799e42 100644
--- a/tests/ui/match_overlapping_arm.stderr
+++ b/tests/ui/match_overlapping_arm.stderr
@@ -1,96 +1,96 @@
 error: some ranges overlap
-  --> $DIR/match_overlapping_arm.rs:13:9
+  --> $DIR/match_overlapping_arm.rs:12:9
    |
 LL |         0..=10 => println!("0..=10"),
    |         ^^^^^^
    |
 note: overlaps with this
-  --> $DIR/match_overlapping_arm.rs:14:9
+  --> $DIR/match_overlapping_arm.rs:13:9
    |
 LL |         0..=11 => println!("0..=11"),
    |         ^^^^^^
    = note: `-D clippy::match-overlapping-arm` implied by `-D warnings`
 
 error: some ranges overlap
-  --> $DIR/match_overlapping_arm.rs:19:9
+  --> $DIR/match_overlapping_arm.rs:18:9
    |
 LL |         0..=5 => println!("0..=5"),
    |         ^^^^^
    |
 note: overlaps with this
-  --> $DIR/match_overlapping_arm.rs:21:9
+  --> $DIR/match_overlapping_arm.rs:20:9
    |
 LL |         FOO..=11 => println!("FOO..=11"),
    |         ^^^^^^^^
 
 error: some ranges overlap
-  --> $DIR/match_overlapping_arm.rs:56:9
+  --> $DIR/match_overlapping_arm.rs:55:9
    |
 LL |         0..11 => println!("0..11"),
    |         ^^^^^
    |
 note: overlaps with this
-  --> $DIR/match_overlapping_arm.rs:57:9
+  --> $DIR/match_overlapping_arm.rs:56:9
    |
 LL |         0..=11 => println!("0..=11"),
    |         ^^^^^^
 
 error: some ranges overlap
-  --> $DIR/match_overlapping_arm.rs:81:9
+  --> $DIR/match_overlapping_arm.rs:80:9
    |
 LL |         0..=10 => println!("0..=10"),
    |         ^^^^^^
    |
 note: overlaps with this
-  --> $DIR/match_overlapping_arm.rs:80:9
+  --> $DIR/match_overlapping_arm.rs:79:9
    |
 LL |         5..14 => println!("5..14"),
    |         ^^^^^
 
 error: some ranges overlap
-  --> $DIR/match_overlapping_arm.rs:86:9
+  --> $DIR/match_overlapping_arm.rs:85:9
    |
 LL |         0..7 => println!("0..7"),
    |         ^^^^
    |
 note: overlaps with this
-  --> $DIR/match_overlapping_arm.rs:87:9
+  --> $DIR/match_overlapping_arm.rs:86:9
    |
 LL |         0..=10 => println!("0..=10"),
    |         ^^^^^^
 
 error: some ranges overlap
-  --> $DIR/match_overlapping_arm.rs:98:9
+  --> $DIR/match_overlapping_arm.rs:97:9
    |
 LL |         ..=23 => println!("..=23"),
    |         ^^^^^
    |
 note: overlaps with this
-  --> $DIR/match_overlapping_arm.rs:99:9
+  --> $DIR/match_overlapping_arm.rs:98:9
    |
 LL |         ..26 => println!("..26"),
    |         ^^^^
 
 error: some ranges overlap
-  --> $DIR/match_overlapping_arm.rs:107:9
+  --> $DIR/match_overlapping_arm.rs:106:9
    |
 LL |         21..=30 => (),
    |         ^^^^^^^
    |
 note: overlaps with this
-  --> $DIR/match_overlapping_arm.rs:108:9
+  --> $DIR/match_overlapping_arm.rs:107:9
    |
 LL |         21..=40 => (),
    |         ^^^^^^^
 
 error: some ranges overlap
-  --> $DIR/match_overlapping_arm.rs:121:9
+  --> $DIR/match_overlapping_arm.rs:120:9
    |
 LL |         0..=0x0000_0000_0000_00ff => (),
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: overlaps with this
-  --> $DIR/match_overlapping_arm.rs:122:9
+  --> $DIR/match_overlapping_arm.rs:121:9
    |
 LL |         0..=0x0000_0000_0000_ffff => (),
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/match_single_binding.fixed b/tests/ui/match_single_binding.fixed
index 951f552eb32..a6e315e4773 100644
--- a/tests/ui/match_single_binding.fixed
+++ b/tests/ui/match_single_binding.fixed
@@ -124,3 +124,12 @@ fn issue_8723() {
 
     let _ = val;
 }
+
+#[allow(dead_code)]
+fn issue_9575() {
+    fn side_effects() {}
+    let _ = || {
+        side_effects();
+        println!("Needs curlies");
+    };
+}
diff --git a/tests/ui/match_single_binding.rs b/tests/ui/match_single_binding.rs
index 19c0fee8fd6..cecbd703e56 100644
--- a/tests/ui/match_single_binding.rs
+++ b/tests/ui/match_single_binding.rs
@@ -140,3 +140,11 @@ fn issue_8723() {
 
     let _ = val;
 }
+
+#[allow(dead_code)]
+fn issue_9575() {
+    fn side_effects() {}
+    let _ = || match side_effects() {
+        _ => println!("Needs curlies"),
+    };
+}
diff --git a/tests/ui/match_single_binding.stderr b/tests/ui/match_single_binding.stderr
index 5d4e7314b21..2b9ec7ee702 100644
--- a/tests/ui/match_single_binding.stderr
+++ b/tests/ui/match_single_binding.stderr
@@ -196,5 +196,22 @@ LL +         suf
 LL ~     };
    |
 
-error: aborting due to 13 previous errors
+error: this match could be replaced by its scrutinee and body
+  --> $DIR/match_single_binding.rs:147:16
+   |
+LL |       let _ = || match side_effects() {
+   |  ________________^
+LL | |         _ => println!("Needs curlies"),
+LL | |     };
+   | |_____^
+   |
+help: consider using the scrutinee and body instead
+   |
+LL ~     let _ = || {
+LL +         side_effects();
+LL +         println!("Needs curlies");
+LL ~     };
+   |
+
+error: aborting due to 14 previous errors
 
diff --git a/tests/ui/match_wild_err_arm.edition2021.stderr b/tests/ui/match_wild_err_arm.edition2021.stderr
deleted file mode 100644
index 525533bf07b..00000000000
--- a/tests/ui/match_wild_err_arm.edition2021.stderr
+++ /dev/null
@@ -1,35 +0,0 @@
-error: `Err(_)` matches all errors
-  --> $DIR/match_wild_err_arm.rs:14:9
-   |
-LL |         Err(_) => panic!("err"),
-   |         ^^^^^^
-   |
-   = note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
-   = note: `-D clippy::match-wild-err-arm` implied by `-D warnings`
-
-error: `Err(_)` matches all errors
-  --> $DIR/match_wild_err_arm.rs:20:9
-   |
-LL |         Err(_) => panic!(),
-   |         ^^^^^^
-   |
-   = note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
-
-error: `Err(_)` matches all errors
-  --> $DIR/match_wild_err_arm.rs:26:9
-   |
-LL |         Err(_) => {
-   |         ^^^^^^
-   |
-   = note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
-
-error: `Err(_e)` matches all errors
-  --> $DIR/match_wild_err_arm.rs:34:9
-   |
-LL |         Err(_e) => panic!(),
-   |         ^^^^^^^
-   |
-   = note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
-
-error: aborting due to 4 previous errors
-
diff --git a/tests/ui/match_wild_err_arm.rs b/tests/ui/match_wild_err_arm.rs
index 0a86144b95d..823be65efe0 100644
--- a/tests/ui/match_wild_err_arm.rs
+++ b/tests/ui/match_wild_err_arm.rs
@@ -1,6 +1,3 @@
-// revisions: edition2018 edition2021
-// [edition2018] edition:2018
-// [edition2021] edition:2021
 #![feature(exclusive_range_pattern)]
 #![allow(clippy::match_same_arms)]
 #![warn(clippy::match_wild_err_arm)]
diff --git a/tests/ui/match_wild_err_arm.edition2018.stderr b/tests/ui/match_wild_err_arm.stderr
index 525533bf07b..b016d682698 100644
--- a/tests/ui/match_wild_err_arm.edition2018.stderr
+++ b/tests/ui/match_wild_err_arm.stderr
@@ -1,5 +1,5 @@
 error: `Err(_)` matches all errors
-  --> $DIR/match_wild_err_arm.rs:14:9
+  --> $DIR/match_wild_err_arm.rs:11:9
    |
 LL |         Err(_) => panic!("err"),
    |         ^^^^^^
@@ -8,7 +8,7 @@ LL |         Err(_) => panic!("err"),
    = note: `-D clippy::match-wild-err-arm` implied by `-D warnings`
 
 error: `Err(_)` matches all errors
-  --> $DIR/match_wild_err_arm.rs:20:9
+  --> $DIR/match_wild_err_arm.rs:17:9
    |
 LL |         Err(_) => panic!(),
    |         ^^^^^^
@@ -16,7 +16,7 @@ LL |         Err(_) => panic!(),
    = note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
 
 error: `Err(_)` matches all errors
-  --> $DIR/match_wild_err_arm.rs:26:9
+  --> $DIR/match_wild_err_arm.rs:23:9
    |
 LL |         Err(_) => {
    |         ^^^^^^
@@ -24,7 +24,7 @@ LL |         Err(_) => {
    = note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
 
 error: `Err(_e)` matches all errors
-  --> $DIR/match_wild_err_arm.rs:34:9
+  --> $DIR/match_wild_err_arm.rs:31:9
    |
 LL |         Err(_e) => panic!(),
    |         ^^^^^^^
diff --git a/tests/ui/needless_borrow.fixed b/tests/ui/needless_borrow.fixed
index aa2687159ef..340e89d2db1 100644
--- a/tests/ui/needless_borrow.fixed
+++ b/tests/ui/needless_borrow.fixed
@@ -3,7 +3,11 @@
 
 #[warn(clippy::all, clippy::needless_borrow)]
 #[allow(unused_variables)]
-#[allow(clippy::uninlined_format_args, clippy::unnecessary_mut_passed)]
+#[allow(
+    clippy::uninlined_format_args,
+    clippy::unnecessary_mut_passed,
+    clippy::unnecessary_to_owned
+)]
 fn main() {
     let a = 5;
     let ref_a = &a;
@@ -134,6 +138,7 @@ fn main() {
     multiple_constraints([[""]]);
     multiple_constraints_normalizes_to_same(X, X);
     let _ = Some("").unwrap_or("");
+    let _ = std::fs::write("x", "".to_string());
 
     only_sized(&""); // Don't lint. `Sized` is only bound
     let _ = std::any::Any::type_id(&""); // Don't lint. `Any` is only bound
@@ -276,8 +281,9 @@ mod copyable_iterator {
     fn dont_warn(mut x: Iter) {
         takes_iter(&mut x);
     }
+    #[allow(unused_mut)]
     fn warn(mut x: &mut Iter) {
-        takes_iter(&mut x)
+        takes_iter(x)
     }
 }
 
@@ -327,3 +333,55 @@ fn issue9383() {
         ManuallyDrop::drop(&mut ocean.coral);
     }
 }
+
+#[allow(dead_code)]
+fn closure_test() {
+    let env = "env".to_owned();
+    let arg = "arg".to_owned();
+    let f = |arg| {
+        let loc = "loc".to_owned();
+        let _ = std::fs::write("x", &env); // Don't lint. In environment
+        let _ = std::fs::write("x", arg);
+        let _ = std::fs::write("x", loc);
+    };
+    let _ = std::fs::write("x", &env); // Don't lint. Borrowed by `f`
+    f(arg);
+}
+
+#[allow(dead_code)]
+mod significant_drop {
+    #[derive(Debug)]
+    struct X;
+
+    #[derive(Debug)]
+    struct Y;
+
+    impl Drop for Y {
+        fn drop(&mut self) {}
+    }
+
+    fn foo(x: X, y: Y) {
+        debug(x);
+        debug(&y); // Don't lint. Has significant drop
+    }
+
+    fn debug(_: impl std::fmt::Debug) {}
+}
+
+#[allow(dead_code)]
+mod used_exactly_once {
+    fn foo(x: String) {
+        use_x(x);
+    }
+    fn use_x(_: impl AsRef<str>) {}
+}
+
+#[allow(dead_code)]
+mod used_more_than_once {
+    fn foo(x: String) {
+        use_x(&x);
+        use_x_again(&x);
+    }
+    fn use_x(_: impl AsRef<str>) {}
+    fn use_x_again(_: impl AsRef<str>) {}
+}
diff --git a/tests/ui/needless_borrow.rs b/tests/ui/needless_borrow.rs
index d41251e8f6a..c93711ac8e2 100644
--- a/tests/ui/needless_borrow.rs
+++ b/tests/ui/needless_borrow.rs
@@ -3,7 +3,11 @@
 
 #[warn(clippy::all, clippy::needless_borrow)]
 #[allow(unused_variables)]
-#[allow(clippy::uninlined_format_args, clippy::unnecessary_mut_passed)]
+#[allow(
+    clippy::uninlined_format_args,
+    clippy::unnecessary_mut_passed,
+    clippy::unnecessary_to_owned
+)]
 fn main() {
     let a = 5;
     let ref_a = &a;
@@ -134,6 +138,7 @@ fn main() {
     multiple_constraints(&[[""]]);
     multiple_constraints_normalizes_to_same(&X, X);
     let _ = Some("").unwrap_or(&"");
+    let _ = std::fs::write("x", &"".to_string());
 
     only_sized(&""); // Don't lint. `Sized` is only bound
     let _ = std::any::Any::type_id(&""); // Don't lint. `Any` is only bound
@@ -276,6 +281,7 @@ mod copyable_iterator {
     fn dont_warn(mut x: Iter) {
         takes_iter(&mut x);
     }
+    #[allow(unused_mut)]
     fn warn(mut x: &mut Iter) {
         takes_iter(&mut x)
     }
@@ -327,3 +333,55 @@ fn issue9383() {
         ManuallyDrop::drop(&mut ocean.coral);
     }
 }
+
+#[allow(dead_code)]
+fn closure_test() {
+    let env = "env".to_owned();
+    let arg = "arg".to_owned();
+    let f = |arg| {
+        let loc = "loc".to_owned();
+        let _ = std::fs::write("x", &env); // Don't lint. In environment
+        let _ = std::fs::write("x", &arg);
+        let _ = std::fs::write("x", &loc);
+    };
+    let _ = std::fs::write("x", &env); // Don't lint. Borrowed by `f`
+    f(arg);
+}
+
+#[allow(dead_code)]
+mod significant_drop {
+    #[derive(Debug)]
+    struct X;
+
+    #[derive(Debug)]
+    struct Y;
+
+    impl Drop for Y {
+        fn drop(&mut self) {}
+    }
+
+    fn foo(x: X, y: Y) {
+        debug(&x);
+        debug(&y); // Don't lint. Has significant drop
+    }
+
+    fn debug(_: impl std::fmt::Debug) {}
+}
+
+#[allow(dead_code)]
+mod used_exactly_once {
+    fn foo(x: String) {
+        use_x(&x);
+    }
+    fn use_x(_: impl AsRef<str>) {}
+}
+
+#[allow(dead_code)]
+mod used_more_than_once {
+    fn foo(x: String) {
+        use_x(&x);
+        use_x_again(&x);
+    }
+    fn use_x(_: impl AsRef<str>) {}
+    fn use_x_again(_: impl AsRef<str>) {}
+}
diff --git a/tests/ui/needless_borrow.stderr b/tests/ui/needless_borrow.stderr
index 5af68706d4b..8b593268bec 100644
--- a/tests/ui/needless_borrow.stderr
+++ b/tests/ui/needless_borrow.stderr
@@ -1,5 +1,5 @@
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:11:15
+  --> $DIR/needless_borrow.rs:15:15
    |
 LL |     let _ = x(&&a); // warn
    |               ^^^ help: change this to: `&a`
@@ -7,172 +7,208 @@ LL |     let _ = x(&&a); // warn
    = note: `-D clippy::needless-borrow` implied by `-D warnings`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:15:13
+  --> $DIR/needless_borrow.rs:19:13
    |
 LL |     mut_ref(&mut &mut b); // warn
    |             ^^^^^^^^^^^ help: change this to: `&mut b`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:27:13
+  --> $DIR/needless_borrow.rs:31:13
    |
 LL |             &&a
    |             ^^^ help: change this to: `&a`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:29:15
+  --> $DIR/needless_borrow.rs:33:15
    |
 LL |         46 => &&a,
    |               ^^^ help: change this to: `&a`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:35:27
+  --> $DIR/needless_borrow.rs:39:27
    |
 LL |                     break &ref_a;
    |                           ^^^^^^ help: change this to: `ref_a`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:42:15
+  --> $DIR/needless_borrow.rs:46:15
    |
 LL |     let _ = x(&&&a);
    |               ^^^^ help: change this to: `&a`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:43:15
+  --> $DIR/needless_borrow.rs:47:15
    |
 LL |     let _ = x(&mut &&a);
    |               ^^^^^^^^ help: change this to: `&a`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:44:15
+  --> $DIR/needless_borrow.rs:48:15
    |
 LL |     let _ = x(&&&mut b);
    |               ^^^^^^^^ help: change this to: `&mut b`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:45:15
+  --> $DIR/needless_borrow.rs:49:15
    |
 LL |     let _ = x(&&ref_a);
    |               ^^^^^^^ help: change this to: `ref_a`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:48:11
+  --> $DIR/needless_borrow.rs:52:11
    |
 LL |         x(&b);
    |           ^^ help: change this to: `b`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:55:13
+  --> $DIR/needless_borrow.rs:59:13
    |
 LL |     mut_ref(&mut x);
    |             ^^^^^^ help: change this to: `x`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:56:13
+  --> $DIR/needless_borrow.rs:60:13
    |
 LL |     mut_ref(&mut &mut x);
    |             ^^^^^^^^^^^ help: change this to: `x`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:57:23
+  --> $DIR/needless_borrow.rs:61:23
    |
 LL |     let y: &mut i32 = &mut x;
    |                       ^^^^^^ help: change this to: `x`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:58:23
+  --> $DIR/needless_borrow.rs:62:23
    |
 LL |     let y: &mut i32 = &mut &mut x;
    |                       ^^^^^^^^^^^ help: change this to: `x`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:67:14
+  --> $DIR/needless_borrow.rs:71:14
    |
 LL |         0 => &mut x,
    |              ^^^^^^ help: change this to: `x`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:73:14
+  --> $DIR/needless_borrow.rs:77:14
    |
 LL |         0 => &mut x,
    |              ^^^^^^ help: change this to: `x`
 
 error: this expression borrows a value the compiler would automatically borrow
-  --> $DIR/needless_borrow.rs:85:13
+  --> $DIR/needless_borrow.rs:89:13
    |
 LL |     let _ = (&x).0;
    |             ^^^^ help: change this to: `x`
 
 error: this expression borrows a value the compiler would automatically borrow
-  --> $DIR/needless_borrow.rs:87:22
+  --> $DIR/needless_borrow.rs:91:22
    |
 LL |     let _ = unsafe { (&*x).0 };
    |                      ^^^^^ help: change this to: `(*x)`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:97:5
+  --> $DIR/needless_borrow.rs:101:5
    |
 LL |     (&&()).foo();
    |     ^^^^^^ help: change this to: `(&())`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:106:5
+  --> $DIR/needless_borrow.rs:110:5
    |
 LL |     (&&5).foo();
    |     ^^^^^ help: change this to: `(&5)`
 
 error: the borrowed expression implements the required traits
-  --> $DIR/needless_borrow.rs:131:51
+  --> $DIR/needless_borrow.rs:135:51
    |
 LL |     let _ = std::process::Command::new("ls").args(&["-a", "-l"]).status().unwrap();
    |                                                   ^^^^^^^^^^^^^ help: change this to: `["-a", "-l"]`
 
 error: the borrowed expression implements the required traits
-  --> $DIR/needless_borrow.rs:132:44
+  --> $DIR/needless_borrow.rs:136:44
    |
 LL |     let _ = std::path::Path::new(".").join(&&".");
    |                                            ^^^^^ help: change this to: `"."`
 
 error: the borrowed expression implements the required traits
-  --> $DIR/needless_borrow.rs:133:23
+  --> $DIR/needless_borrow.rs:137:23
    |
 LL |     deref_target_is_x(&X);
    |                       ^^ help: change this to: `X`
 
 error: the borrowed expression implements the required traits
-  --> $DIR/needless_borrow.rs:134:26
+  --> $DIR/needless_borrow.rs:138:26
    |
 LL |     multiple_constraints(&[[""]]);
    |                          ^^^^^^^ help: change this to: `[[""]]`
 
 error: the borrowed expression implements the required traits
-  --> $DIR/needless_borrow.rs:135:45
+  --> $DIR/needless_borrow.rs:139:45
    |
 LL |     multiple_constraints_normalizes_to_same(&X, X);
    |                                             ^^ help: change this to: `X`
 
 error: this expression creates a reference which is immediately dereferenced by the compiler
-  --> $DIR/needless_borrow.rs:136:32
+  --> $DIR/needless_borrow.rs:140:32
    |
 LL |     let _ = Some("").unwrap_or(&"");
    |                                ^^^ help: change this to: `""`
 
+error: the borrowed expression implements the required traits
+  --> $DIR/needless_borrow.rs:141:33
+   |
+LL |     let _ = std::fs::write("x", &"".to_string());
+   |                                 ^^^^^^^^^^^^^^^ help: change this to: `"".to_string()`
+
 error: this expression borrows a value the compiler would automatically borrow
-  --> $DIR/needless_borrow.rs:187:13
+  --> $DIR/needless_borrow.rs:192:13
    |
 LL |             (&self.f)()
    |             ^^^^^^^^^ help: change this to: `(self.f)`
 
 error: this expression borrows a value the compiler would automatically borrow
-  --> $DIR/needless_borrow.rs:196:13
+  --> $DIR/needless_borrow.rs:201:13
    |
 LL |             (&mut self.f)()
    |             ^^^^^^^^^^^^^ help: change this to: `(self.f)`
 
 error: the borrowed expression implements the required traits
-  --> $DIR/needless_borrow.rs:298:55
+  --> $DIR/needless_borrow.rs:286:20
+   |
+LL |         takes_iter(&mut x)
+   |                    ^^^^^^ help: change this to: `x`
+
+error: the borrowed expression implements the required traits
+  --> $DIR/needless_borrow.rs:304:55
    |
 LL |         let _ = std::process::Command::new("ls").args(&["-a", "-l"]).status().unwrap();
    |                                                       ^^^^^^^^^^^^^ help: change this to: `["-a", "-l"]`
 
-error: aborting due to 29 previous errors
+error: the borrowed expression implements the required traits
+  --> $DIR/needless_borrow.rs:344:37
+   |
+LL |         let _ = std::fs::write("x", &arg);
+   |                                     ^^^^ help: change this to: `arg`
+
+error: the borrowed expression implements the required traits
+  --> $DIR/needless_borrow.rs:345:37
+   |
+LL |         let _ = std::fs::write("x", &loc);
+   |                                     ^^^^ help: change this to: `loc`
+
+error: the borrowed expression implements the required traits
+  --> $DIR/needless_borrow.rs:364:15
+   |
+LL |         debug(&x);
+   |               ^^ help: change this to: `x`
+
+error: the borrowed expression implements the required traits
+  --> $DIR/needless_borrow.rs:374:15
+   |
+LL |         use_x(&x);
+   |               ^^ help: change this to: `x`
+
+error: aborting due to 35 previous errors
 
diff --git a/tests/ui/or_fun_call.fixed b/tests/ui/or_fun_call.fixed
index 896430780ea..23b1aa8bebd 100644
--- a/tests/ui/or_fun_call.fixed
+++ b/tests/ui/or_fun_call.fixed
@@ -225,4 +225,15 @@ mod issue8239 {
     }
 }
 
+mod issue9608 {
+    fn sig_drop() {
+        enum X {
+            X(std::fs::File),
+            Y(u32),
+        }
+
+        let _ = None.unwrap_or(X::Y(0));
+    }
+}
+
 fn main() {}
diff --git a/tests/ui/or_fun_call.rs b/tests/ui/or_fun_call.rs
index 2473163d4fd..039998f22dd 100644
--- a/tests/ui/or_fun_call.rs
+++ b/tests/ui/or_fun_call.rs
@@ -225,4 +225,15 @@ mod issue8239 {
     }
 }
 
+mod issue9608 {
+    fn sig_drop() {
+        enum X {
+            X(std::fs::File),
+            Y(u32),
+        }
+
+        let _ = None.unwrap_or(X::Y(0));
+    }
+}
+
 fn main() {}
diff --git a/tests/ui/partial_pub_fields.rs b/tests/ui/partial_pub_fields.rs
new file mode 100644
index 00000000000..668545da844
--- /dev/null
+++ b/tests/ui/partial_pub_fields.rs
@@ -0,0 +1,40 @@
+#![allow(unused)]
+#![warn(clippy::partial_pub_fields)]
+
+fn main() {
+    use std::collections::HashMap;
+
+    #[derive(Default)]
+    pub struct FileSet {
+        files: HashMap<String, u32>,
+        pub paths: HashMap<u32, String>,
+    }
+
+    pub struct Color {
+        pub r: u8,
+        pub g: u8,
+        b: u8,
+    }
+
+    pub struct Point(i32, pub i32);
+
+    pub struct Visibility {
+        r#pub: bool,
+        pub pos: u32,
+    }
+
+    // Don't lint on empty structs;
+    pub struct Empty1;
+    pub struct Empty2();
+    pub struct Empty3 {};
+
+    // Don't lint on structs with one field.
+    pub struct Single1(i32);
+    pub struct Single2(pub i32);
+    pub struct Single3 {
+        v1: i32,
+    }
+    pub struct Single4 {
+        pub v1: i32,
+    }
+}
diff --git a/tests/ui/partial_pub_fields.stderr b/tests/ui/partial_pub_fields.stderr
new file mode 100644
index 00000000000..84cfc1a9194
--- /dev/null
+++ b/tests/ui/partial_pub_fields.stderr
@@ -0,0 +1,35 @@
+error: mixed usage of pub and non-pub fields
+  --> $DIR/partial_pub_fields.rs:10:9
+   |
+LL |         pub paths: HashMap<u32, String>,
+   |         ^^^
+   |
+   = help: consider using private field here
+   = note: `-D clippy::partial-pub-fields` implied by `-D warnings`
+
+error: mixed usage of pub and non-pub fields
+  --> $DIR/partial_pub_fields.rs:16:9
+   |
+LL |         b: u8,
+   |         ^
+   |
+   = help: consider using public field here
+
+error: mixed usage of pub and non-pub fields
+  --> $DIR/partial_pub_fields.rs:19:27
+   |
+LL |     pub struct Point(i32, pub i32);
+   |                           ^^^
+   |
+   = help: consider using private field here
+
+error: mixed usage of pub and non-pub fields
+  --> $DIR/partial_pub_fields.rs:23:9
+   |
+LL |         pub pos: u32,
+   |         ^^^
+   |
+   = help: consider using private field here
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/ptr_arg.rs b/tests/ui/ptr_arg.rs
index fd15001e540..5f54101ca15 100644
--- a/tests/ui/ptr_arg.rs
+++ b/tests/ui/ptr_arg.rs
@@ -3,7 +3,7 @@
 #![warn(clippy::ptr_arg)]
 
 use std::borrow::Cow;
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
 
 fn do_vec(x: &Vec<i64>) {
     //Nothing here
@@ -207,3 +207,31 @@ fn cow_conditional_to_mut(a: &mut Cow<str>) {
         a.to_mut().push_str("foo");
     }
 }
+
+// Issue #9542
+fn dyn_trait_ok(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) {
+    trait T {}
+    impl<U> T for Vec<U> {}
+    impl T for String {}
+    impl T for PathBuf {}
+    fn takes_dyn(_: &mut dyn T) {}
+
+    takes_dyn(a);
+    takes_dyn(b);
+    takes_dyn(c);
+}
+
+fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) {
+    trait T {}
+    impl<U> T for Vec<U> {}
+    impl<U> T for [U] {}
+    impl T for String {}
+    impl T for str {}
+    impl T for PathBuf {}
+    impl T for Path {}
+    fn takes_dyn(_: &mut dyn T) {}
+
+    takes_dyn(a);
+    takes_dyn(b);
+    takes_dyn(c);
+}
diff --git a/tests/ui/ptr_arg.stderr b/tests/ui/ptr_arg.stderr
index d64b5f454a5..6b4de98ce88 100644
--- a/tests/ui/ptr_arg.stderr
+++ b/tests/ui/ptr_arg.stderr
@@ -162,5 +162,23 @@ error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a sl
 LL | fn mut_vec_slice_methods(v: &mut Vec<u32>) {
    |                             ^^^^^^^^^^^^^ help: change this to: `&mut [u32]`
 
-error: aborting due to 17 previous errors
+error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
+  --> $DIR/ptr_arg.rs:224:17
+   |
+LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) {
+   |                 ^^^^^^^^^^^^^ help: change this to: `&mut [u32]`
+
+error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do
+  --> $DIR/ptr_arg.rs:224:35
+   |
+LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) {
+   |                                   ^^^^^^^^^^^ help: change this to: `&mut str`
+
+error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do
+  --> $DIR/ptr_arg.rs:224:51
+   |
+LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) {
+   |                                                   ^^^^^^^^^^^^ help: change this to: `&mut Path`
+
+error: aborting due to 20 previous errors
 
diff --git a/tests/ui/temporary_assignment.rs b/tests/ui/temporary_assignment.rs
index b4a931043b0..ac4c1bc6597 100644
--- a/tests/ui/temporary_assignment.rs
+++ b/tests/ui/temporary_assignment.rs
@@ -1,5 +1,4 @@
 #![warn(clippy::temporary_assignment)]
-#![allow(const_item_mutation)]
 
 use std::ops::{Deref, DerefMut};
 
diff --git a/tests/ui/temporary_assignment.stderr b/tests/ui/temporary_assignment.stderr
index 4cc32c79f05..7d79901a28d 100644
--- a/tests/ui/temporary_assignment.stderr
+++ b/tests/ui/temporary_assignment.stderr
@@ -1,5 +1,5 @@
 error: assignment to temporary
-  --> $DIR/temporary_assignment.rs:48:5
+  --> $DIR/temporary_assignment.rs:47:5
    |
 LL |     Struct { field: 0 }.field = 1;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -7,7 +7,7 @@ LL |     Struct { field: 0 }.field = 1;
    = note: `-D clippy::temporary-assignment` implied by `-D warnings`
 
 error: assignment to temporary
-  --> $DIR/temporary_assignment.rs:49:5
+  --> $DIR/temporary_assignment.rs:48:5
    |
 LL | /     MultiStruct {
 LL | |         structure: Struct { field: 0 },
@@ -17,13 +17,13 @@ LL | |     .field = 1;
    | |______________^
 
 error: assignment to temporary
-  --> $DIR/temporary_assignment.rs:54:5
+  --> $DIR/temporary_assignment.rs:53:5
    |
 LL |     ArrayStruct { array: [0] }.array[0] = 1;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: assignment to temporary
-  --> $DIR/temporary_assignment.rs:55:5
+  --> $DIR/temporary_assignment.rs:54:5
    |
 LL |     (0, 0).0 = 1;
    |     ^^^^^^^^^^^^
diff --git a/tests/ui/uninlined_format_args.fixed b/tests/ui/uninlined_format_args.fixed
index 3ca7a401902..10627447975 100644
--- a/tests/ui/uninlined_format_args.fixed
+++ b/tests/ui/uninlined_format_args.fixed
@@ -150,6 +150,19 @@ fn tester(fn_arg: i32) {
 
     println!(with_span!("{0} {1}" "{1} {0}"), local_i32, local_f64);
     println!("{}", with_span!(span val));
+
+    if local_i32 > 0 {
+        panic!("p1 {local_i32}");
+    }
+    if local_i32 > 0 {
+        panic!("p2 {local_i32}");
+    }
+    if local_i32 > 0 {
+        panic!("p3 {local_i32}");
+    }
+    if local_i32 > 0 {
+        panic!("p4 {local_i32}");
+    }
 }
 
 fn main() {
diff --git a/tests/ui/uninlined_format_args.rs b/tests/ui/uninlined_format_args.rs
index 924191f4324..8e495ebd083 100644
--- a/tests/ui/uninlined_format_args.rs
+++ b/tests/ui/uninlined_format_args.rs
@@ -150,6 +150,19 @@ fn tester(fn_arg: i32) {
 
     println!(with_span!("{0} {1}" "{1} {0}"), local_i32, local_f64);
     println!("{}", with_span!(span val));
+
+    if local_i32 > 0 {
+        panic!("p1 {}", local_i32);
+    }
+    if local_i32 > 0 {
+        panic!("p2 {0}", local_i32);
+    }
+    if local_i32 > 0 {
+        panic!("p3 {local_i32}", local_i32 = local_i32);
+    }
+    if local_i32 > 0 {
+        panic!("p4 {local_i32}");
+    }
 }
 
 fn main() {
diff --git a/tests/ui/uninlined_format_args.stderr b/tests/ui/uninlined_format_args.stderr
index d1a77492634..2ce3b7fa960 100644
--- a/tests/ui/uninlined_format_args.stderr
+++ b/tests/ui/uninlined_format_args.stderr
@@ -828,7 +828,43 @@ LL +     println!("{val}");
    |
 
 error: variables can be used directly in the `format!` string
-  --> $DIR/uninlined_format_args.rs:168:5
+  --> $DIR/uninlined_format_args.rs:155:9
+   |
+LL |         panic!("p1 {}", local_i32);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: change this to
+   |
+LL -         panic!("p1 {}", local_i32);
+LL +         panic!("p1 {local_i32}");
+   |
+
+error: variables can be used directly in the `format!` string
+  --> $DIR/uninlined_format_args.rs:158:9
+   |
+LL |         panic!("p2 {0}", local_i32);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: change this to
+   |
+LL -         panic!("p2 {0}", local_i32);
+LL +         panic!("p2 {local_i32}");
+   |
+
+error: variables can be used directly in the `format!` string
+  --> $DIR/uninlined_format_args.rs:161:9
+   |
+LL |         panic!("p3 {local_i32}", local_i32 = local_i32);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: change this to
+   |
+LL -         panic!("p3 {local_i32}", local_i32 = local_i32);
+LL +         panic!("p3 {local_i32}");
+   |
+
+error: variables can be used directly in the `format!` string
+  --> $DIR/uninlined_format_args.rs:181:5
    |
 LL |     println!("expand='{}'", local_i32);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -839,5 +875,5 @@ LL -     println!("expand='{}'", local_i32);
 LL +     println!("expand='{local_i32}'");
    |
 
-error: aborting due to 70 previous errors
+error: aborting due to 73 previous errors
 
diff --git a/tests/ui/uninlined_format_args_panic.edition2018.fixed b/tests/ui/uninlined_format_args_panic.edition2018.fixed
new file mode 100644
index 00000000000..96cc0877960
--- /dev/null
+++ b/tests/ui/uninlined_format_args_panic.edition2018.fixed
@@ -0,0 +1,29 @@
+// revisions: edition2018 edition2021
+//[edition2018] edition:2018
+//[edition2021] edition:2021
+// run-rustfix
+
+#![warn(clippy::uninlined_format_args)]
+
+fn main() {
+    let var = 1;
+
+    println!("val='{var}'");
+
+    if var > 0 {
+        panic!("p1 {}", var);
+    }
+    if var > 0 {
+        panic!("p2 {0}", var);
+    }
+    if var > 0 {
+        panic!("p3 {var}", var = var);
+    }
+
+    #[allow(non_fmt_panics)]
+    {
+        if var > 0 {
+            panic!("p4 {var}");
+        }
+    }
+}
diff --git a/tests/ui/uninlined_format_args_panic.edition2018.stderr b/tests/ui/uninlined_format_args_panic.edition2018.stderr
new file mode 100644
index 00000000000..2c806125922
--- /dev/null
+++ b/tests/ui/uninlined_format_args_panic.edition2018.stderr
@@ -0,0 +1,15 @@
+error: variables can be used directly in the `format!` string
+  --> $DIR/uninlined_format_args_panic.rs:11:5
+   |
+LL |     println!("val='{}'", var);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `-D clippy::uninlined-format-args` implied by `-D warnings`
+help: change this to
+   |
+LL -     println!("val='{}'", var);
+LL +     println!("val='{var}'");
+   |
+
+error: aborting due to previous error
+
diff --git a/tests/ui/uninlined_format_args_panic.edition2021.fixed b/tests/ui/uninlined_format_args_panic.edition2021.fixed
new file mode 100644
index 00000000000..faf8ca4d3a7
--- /dev/null
+++ b/tests/ui/uninlined_format_args_panic.edition2021.fixed
@@ -0,0 +1,29 @@
+// revisions: edition2018 edition2021
+//[edition2018] edition:2018
+//[edition2021] edition:2021
+// run-rustfix
+
+#![warn(clippy::uninlined_format_args)]
+
+fn main() {
+    let var = 1;
+
+    println!("val='{var}'");
+
+    if var > 0 {
+        panic!("p1 {var}");
+    }
+    if var > 0 {
+        panic!("p2 {var}");
+    }
+    if var > 0 {
+        panic!("p3 {var}");
+    }
+
+    #[allow(non_fmt_panics)]
+    {
+        if var > 0 {
+            panic!("p4 {var}");
+        }
+    }
+}
diff --git a/tests/ui/uninlined_format_args_panic.edition2021.stderr b/tests/ui/uninlined_format_args_panic.edition2021.stderr
new file mode 100644
index 00000000000..0f09c45f413
--- /dev/null
+++ b/tests/ui/uninlined_format_args_panic.edition2021.stderr
@@ -0,0 +1,51 @@
+error: variables can be used directly in the `format!` string
+  --> $DIR/uninlined_format_args_panic.rs:11:5
+   |
+LL |     println!("val='{}'", var);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `-D clippy::uninlined-format-args` implied by `-D warnings`
+help: change this to
+   |
+LL -     println!("val='{}'", var);
+LL +     println!("val='{var}'");
+   |
+
+error: variables can be used directly in the `format!` string
+  --> $DIR/uninlined_format_args_panic.rs:14:9
+   |
+LL |         panic!("p1 {}", var);
+   |         ^^^^^^^^^^^^^^^^^^^^
+   |
+help: change this to
+   |
+LL -         panic!("p1 {}", var);
+LL +         panic!("p1 {var}");
+   |
+
+error: variables can be used directly in the `format!` string
+  --> $DIR/uninlined_format_args_panic.rs:17:9
+   |
+LL |         panic!("p2 {0}", var);
+   |         ^^^^^^^^^^^^^^^^^^^^^
+   |
+help: change this to
+   |
+LL -         panic!("p2 {0}", var);
+LL +         panic!("p2 {var}");
+   |
+
+error: variables can be used directly in the `format!` string
+  --> $DIR/uninlined_format_args_panic.rs:20:9
+   |
+LL |         panic!("p3 {var}", var = var);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: change this to
+   |
+LL -         panic!("p3 {var}", var = var);
+LL +         panic!("p3 {var}");
+   |
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/uninlined_format_args_panic.rs b/tests/ui/uninlined_format_args_panic.rs
new file mode 100644
index 00000000000..6421c5bbed2
--- /dev/null
+++ b/tests/ui/uninlined_format_args_panic.rs
@@ -0,0 +1,29 @@
+// revisions: edition2018 edition2021
+//[edition2018] edition:2018
+//[edition2021] edition:2021
+// run-rustfix
+
+#![warn(clippy::uninlined_format_args)]
+
+fn main() {
+    let var = 1;
+
+    println!("val='{}'", var);
+
+    if var > 0 {
+        panic!("p1 {}", var);
+    }
+    if var > 0 {
+        panic!("p2 {0}", var);
+    }
+    if var > 0 {
+        panic!("p3 {var}", var = var);
+    }
+
+    #[allow(non_fmt_panics)]
+    {
+        if var > 0 {
+            panic!("p4 {var}");
+        }
+    }
+}
diff --git a/tests/ui/unnecessary_cast.fixed b/tests/ui/unnecessary_cast.fixed
index 94dc9642726..ec8c6abfab9 100644
--- a/tests/ui/unnecessary_cast.fixed
+++ b/tests/ui/unnecessary_cast.fixed
@@ -111,4 +111,8 @@ mod fixable {
 
         let _num = foo();
     }
+
+    fn issue_9603() {
+        let _: f32 = -0x400 as f32;
+    }
 }
diff --git a/tests/ui/unnecessary_cast.rs b/tests/ui/unnecessary_cast.rs
index e5150256f69..5213cdc269b 100644
--- a/tests/ui/unnecessary_cast.rs
+++ b/tests/ui/unnecessary_cast.rs
@@ -111,4 +111,8 @@ mod fixable {
 
         let _num = foo() as f32;
     }
+
+    fn issue_9603() {
+        let _: f32 = -0x400 as f32;
+    }
 }
diff --git a/tests/ui/unnecessary_to_owned.fixed b/tests/ui/unnecessary_to_owned.fixed
index f97583aa22f..fe09aad06bc 100644
--- a/tests/ui/unnecessary_to_owned.fixed
+++ b/tests/ui/unnecessary_to_owned.fixed
@@ -1,6 +1,6 @@
 // run-rustfix
 
-#![allow(clippy::ptr_arg)]
+#![allow(clippy::needless_borrow, clippy::ptr_arg)]
 #![warn(clippy::unnecessary_to_owned)]
 #![feature(custom_inner_attributes)]
 
diff --git a/tests/ui/unnecessary_to_owned.rs b/tests/ui/unnecessary_to_owned.rs
index aa5394a5657..3de6d0903c0 100644
--- a/tests/ui/unnecessary_to_owned.rs
+++ b/tests/ui/unnecessary_to_owned.rs
@@ -1,6 +1,6 @@
 // run-rustfix
 
-#![allow(clippy::ptr_arg)]
+#![allow(clippy::needless_borrow, clippy::ptr_arg)]
 #![warn(clippy::unnecessary_to_owned)]
 #![feature(custom_inner_attributes)]
 
diff --git a/tests/ui/unused_format_specs.fixed b/tests/ui/unused_format_specs.fixed
new file mode 100644
index 00000000000..2930722b42d
--- /dev/null
+++ b/tests/ui/unused_format_specs.fixed
@@ -0,0 +1,18 @@
+// run-rustfix
+
+#![warn(clippy::unused_format_specs)]
+#![allow(unused)]
+
+fn main() {
+    let f = 1.0f64;
+    println!("{}", 1.0);
+    println!("{f} {f:?}");
+
+    println!("{}", 1);
+}
+
+fn should_not_lint() {
+    let f = 1.0f64;
+    println!("{:.1}", 1.0);
+    println!("{f:.w$} {f:.*?}", 3, w = 2);
+}
diff --git a/tests/ui/unused_format_specs.rs b/tests/ui/unused_format_specs.rs
new file mode 100644
index 00000000000..ee192a000d4
--- /dev/null
+++ b/tests/ui/unused_format_specs.rs
@@ -0,0 +1,18 @@
+// run-rustfix
+
+#![warn(clippy::unused_format_specs)]
+#![allow(unused)]
+
+fn main() {
+    let f = 1.0f64;
+    println!("{:.}", 1.0);
+    println!("{f:.} {f:.?}");
+
+    println!("{:.}", 1);
+}
+
+fn should_not_lint() {
+    let f = 1.0f64;
+    println!("{:.1}", 1.0);
+    println!("{f:.w$} {f:.*?}", 3, w = 2);
+}
diff --git a/tests/ui/unused_format_specs.stderr b/tests/ui/unused_format_specs.stderr
new file mode 100644
index 00000000000..7231c17e74c
--- /dev/null
+++ b/tests/ui/unused_format_specs.stderr
@@ -0,0 +1,54 @@
+error: empty precision specifier has no effect
+  --> $DIR/unused_format_specs.rs:8:17
+   |
+LL |     println!("{:.}", 1.0);
+   |                 ^
+   |
+   = note: a precision specifier is not required to format floats
+   = note: `-D clippy::unused-format-specs` implied by `-D warnings`
+help: remove the `.`
+   |
+LL -     println!("{:.}", 1.0);
+LL +     println!("{}", 1.0);
+   |
+
+error: empty precision specifier has no effect
+  --> $DIR/unused_format_specs.rs:9:18
+   |
+LL |     println!("{f:.} {f:.?}");
+   |                  ^
+   |
+   = note: a precision specifier is not required to format floats
+help: remove the `.`
+   |
+LL -     println!("{f:.} {f:.?}");
+LL +     println!("{f} {f:.?}");
+   |
+
+error: empty precision specifier has no effect
+  --> $DIR/unused_format_specs.rs:9:24
+   |
+LL |     println!("{f:.} {f:.?}");
+   |                        ^
+   |
+   = note: a precision specifier is not required to format floats
+help: remove the `.`
+   |
+LL -     println!("{f:.} {f:.?}");
+LL +     println!("{f:.} {f:?}");
+   |
+
+error: empty precision specifier has no effect
+  --> $DIR/unused_format_specs.rs:11:17
+   |
+LL |     println!("{:.}", 1);
+   |                 ^
+   |
+help: remove the `.`
+   |
+LL -     println!("{:.}", 1);
+LL +     println!("{}", 1);
+   |
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/ui/unused_format_specs_unfixable.rs b/tests/ui/unused_format_specs_unfixable.rs
new file mode 100644
index 00000000000..78601a3483d
--- /dev/null
+++ b/tests/ui/unused_format_specs_unfixable.rs
@@ -0,0 +1,30 @@
+#![warn(clippy::unused_format_specs)]
+#![allow(unused)]
+
+macro_rules! format_args_from_macro {
+    () => {
+        format_args!("from macro")
+    };
+}
+
+fn main() {
+    // prints `.`, not `     .`
+    println!("{:5}.", format_args!(""));
+    //prints `abcde`, not `abc`
+    println!("{:.3}", format_args!("abcde"));
+
+    println!("{:5}.", format_args_from_macro!());
+
+    let args = format_args!("");
+    println!("{args:5}");
+}
+
+fn should_not_lint() {
+    println!("{}", format_args!(""));
+    // Technically the same as `{}`, but the `format_args` docs specifically mention that you can use
+    // debug formatting so allow it
+    println!("{:?}", format_args!(""));
+
+    let args = format_args!("");
+    println!("{args}");
+}
diff --git a/tests/ui/unused_format_specs_unfixable.stderr b/tests/ui/unused_format_specs_unfixable.stderr
new file mode 100644
index 00000000000..9f1890282e6
--- /dev/null
+++ b/tests/ui/unused_format_specs_unfixable.stderr
@@ -0,0 +1,69 @@
+error: format specifiers have no effect on `format_args!()`
+  --> $DIR/unused_format_specs_unfixable.rs:12:15
+   |
+LL |     println!("{:5}.", format_args!(""));
+   |               ^^^^
+   |
+   = note: `-D clippy::unused-format-specs` implied by `-D warnings`
+help: for the width to apply consider using `format!()`
+   |
+LL |     println!("{:5}.", format!(""));
+   |                       ~~~~~~
+help: if the current behavior is intentional, remove the format specifiers
+   |
+LL -     println!("{:5}.", format_args!(""));
+LL +     println!("{}.", format_args!(""));
+   |
+
+error: format specifiers have no effect on `format_args!()`
+  --> $DIR/unused_format_specs_unfixable.rs:14:15
+   |
+LL |     println!("{:.3}", format_args!("abcde"));
+   |               ^^^^^
+   |
+help: for the precision to apply consider using `format!()`
+   |
+LL |     println!("{:.3}", format!("abcde"));
+   |                       ~~~~~~
+help: if the current behavior is intentional, remove the format specifiers
+   |
+LL -     println!("{:.3}", format_args!("abcde"));
+LL +     println!("{}", format_args!("abcde"));
+   |
+
+error: format specifiers have no effect on `format_args!()`
+  --> $DIR/unused_format_specs_unfixable.rs:16:15
+   |
+LL |     println!("{:5}.", format_args_from_macro!());
+   |               ^^^^
+   |
+help: for the width to apply consider using `format!()`
+  --> $DIR/unused_format_specs_unfixable.rs:16:17
+   |
+LL |     println!("{:5}.", format_args_from_macro!());
+   |                 ^
+help: if the current behavior is intentional, remove the format specifiers
+   |
+LL -     println!("{:5}.", format_args_from_macro!());
+LL +     println!("{}.", format_args_from_macro!());
+   |
+
+error: format specifiers have no effect on `format_args!()`
+  --> $DIR/unused_format_specs_unfixable.rs:19:15
+   |
+LL |     println!("{args:5}");
+   |               ^^^^^^^^
+   |
+help: for the width to apply consider using `format!()`
+  --> $DIR/unused_format_specs_unfixable.rs:19:21
+   |
+LL |     println!("{args:5}");
+   |                     ^
+help: if the current behavior is intentional, remove the format specifiers
+   |
+LL -     println!("{args:5}");
+LL +     println!("{args}");
+   |
+
+error: aborting due to 4 previous errors
+
diff --git a/tests/versioncheck.rs b/tests/versioncheck.rs
index 9e07769a8e4..a6d8d0307ce 100644
--- a/tests/versioncheck.rs
+++ b/tests/versioncheck.rs
@@ -48,7 +48,7 @@ fn check_that_clippy_has_the_same_major_version_as_rustc() {
     // `RUSTC_REAL` if Clippy is build in the Rust repo with `./x.py`.
     let rustc = std::env::var("RUSTC_REAL").unwrap_or_else(|_| "rustc".to_string());
     let rustc_version = String::from_utf8(
-        std::process::Command::new(&rustc)
+        std::process::Command::new(rustc)
             .arg("--version")
             .output()
             .expect("failed to run `rustc --version`")