about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui-internal/auxiliary/paths.rs2
-rw-r--r--tests/ui-internal/match_type_on_diag_item.rs39
-rw-r--r--tests/ui-internal/match_type_on_diag_item.stderr27
-rw-r--r--tests/ui-internal/unnecessary_def_path.fixed62
-rw-r--r--tests/ui-internal/unnecessary_def_path.rs62
-rw-r--r--tests/ui-internal/unnecessary_def_path.stderr101
-rw-r--r--tests/ui/arithmetic_side_effects.rs53
-rw-r--r--tests/ui/arithmetic_side_effects.stderr224
-rw-r--r--tests/ui/floating_point_mul_add.fixed2
-rw-r--r--tests/ui/floating_point_mul_add.rs2
-rw-r--r--tests/ui/floating_point_mul_add.stderr30
-rw-r--r--tests/ui/floating_point_powi.fixed2
-rw-r--r--tests/ui/floating_point_powi.rs2
-rw-r--r--tests/ui/floating_point_powi.stderr20
-rw-r--r--tests/ui/implicit_saturating_add.fixed106
-rw-r--r--tests/ui/implicit_saturating_add.rs154
-rw-r--r--tests/ui/implicit_saturating_add.stderr197
-rw-r--r--tests/ui/manual_assert.fixed45
-rw-r--r--tests/ui/option_take_on_temporary.fixed15
-rw-r--r--tests/ui/upper_case_acronyms.rs9
-rw-r--r--tests/ui/upper_case_acronyms.stderr14
21 files changed, 996 insertions, 172 deletions
diff --git a/tests/ui-internal/auxiliary/paths.rs b/tests/ui-internal/auxiliary/paths.rs
new file mode 100644
index 00000000000..52fcaec4df3
--- /dev/null
+++ b/tests/ui-internal/auxiliary/paths.rs
@@ -0,0 +1,2 @@
+pub static OPTION: [&str; 3] = ["core", "option", "Option"];
+pub const RESULT: &[&str] = &["core", "result", "Result"];
diff --git a/tests/ui-internal/match_type_on_diag_item.rs b/tests/ui-internal/match_type_on_diag_item.rs
deleted file mode 100644
index 4b41ff15e80..00000000000
--- a/tests/ui-internal/match_type_on_diag_item.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-#![deny(clippy::internal)]
-#![allow(clippy::missing_clippy_version_attribute)]
-#![feature(rustc_private)]
-
-extern crate clippy_utils;
-extern crate rustc_hir;
-extern crate rustc_lint;
-extern crate rustc_middle;
-
-#[macro_use]
-extern crate rustc_session;
-use clippy_utils::{paths, ty::match_type};
-use rustc_hir::Expr;
-use rustc_lint::{LateContext, LateLintPass};
-use rustc_middle::ty::Ty;
-
-declare_lint! {
-    pub TEST_LINT,
-    Warn,
-    ""
-}
-
-declare_lint_pass!(Pass => [TEST_LINT]);
-
-static OPTION: [&str; 3] = ["core", "option", "Option"];
-
-impl<'tcx> LateLintPass<'tcx> for Pass {
-    fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr) {
-        let ty = cx.typeck_results().expr_ty(expr);
-
-        let _ = match_type(cx, ty, &OPTION);
-        let _ = match_type(cx, ty, &["core", "result", "Result"]);
-
-        let rc_path = &["alloc", "rc", "Rc"];
-        let _ = clippy_utils::ty::match_type(cx, ty, rc_path);
-    }
-}
-
-fn main() {}
diff --git a/tests/ui-internal/match_type_on_diag_item.stderr b/tests/ui-internal/match_type_on_diag_item.stderr
deleted file mode 100644
index e3cb6b6c22e..00000000000
--- a/tests/ui-internal/match_type_on_diag_item.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error: usage of `clippy_utils::ty::match_type()` on a type diagnostic item
-  --> $DIR/match_type_on_diag_item.rs:31:17
-   |
-LL |         let _ = match_type(cx, ty, &OPTION);
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `clippy_utils::ty::is_type_diagnostic_item(cx, ty, sym::Option)`
-   |
-note: the lint level is defined here
-  --> $DIR/match_type_on_diag_item.rs:1:9
-   |
-LL | #![deny(clippy::internal)]
-   |         ^^^^^^^^^^^^^^^^
-   = note: `#[deny(clippy::match_type_on_diagnostic_item)]` implied by `#[deny(clippy::internal)]`
-
-error: usage of `clippy_utils::ty::match_type()` on a type diagnostic item
-  --> $DIR/match_type_on_diag_item.rs:32:17
-   |
-LL |         let _ = match_type(cx, ty, &["core", "result", "Result"]);
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `clippy_utils::ty::is_type_diagnostic_item(cx, ty, sym::Result)`
-
-error: usage of `clippy_utils::ty::match_type()` on a type diagnostic item
-  --> $DIR/match_type_on_diag_item.rs:35:17
-   |
-LL |         let _ = clippy_utils::ty::match_type(cx, ty, rc_path);
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `clippy_utils::ty::is_type_diagnostic_item(cx, ty, sym::Rc)`
-
-error: aborting due to 3 previous errors
-
diff --git a/tests/ui-internal/unnecessary_def_path.fixed b/tests/ui-internal/unnecessary_def_path.fixed
new file mode 100644
index 00000000000..4c050332f2c
--- /dev/null
+++ b/tests/ui-internal/unnecessary_def_path.fixed
@@ -0,0 +1,62 @@
+// run-rustfix
+// aux-build:paths.rs
+#![deny(clippy::internal)]
+#![feature(rustc_private)]
+
+extern crate clippy_utils;
+extern crate paths;
+extern crate rustc_hir;
+extern crate rustc_lint;
+extern crate rustc_middle;
+extern crate rustc_span;
+
+#[allow(unused)]
+use clippy_utils::ty::{is_type_diagnostic_item, is_type_lang_item, match_type};
+#[allow(unused)]
+use clippy_utils::{
+    is_expr_path_def_path, is_path_diagnostic_item, is_res_diagnostic_ctor, is_res_lang_ctor, is_trait_method,
+    match_def_path, match_trait_method, path_res,
+};
+
+#[allow(unused)]
+use rustc_hir::LangItem;
+#[allow(unused)]
+use rustc_span::sym;
+
+use rustc_hir::def_id::DefId;
+use rustc_hir::Expr;
+use rustc_lint::LateContext;
+use rustc_middle::ty::Ty;
+
+#[allow(unused)]
+static OPTION: [&str; 3] = ["core", "option", "Option"];
+#[allow(unused)]
+const RESULT: &[&str] = &["core", "result", "Result"];
+
+fn _f<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, did: DefId, expr: &Expr<'_>) {
+    let _ = is_type_diagnostic_item(cx, ty, sym::Option);
+    let _ = is_type_diagnostic_item(cx, ty, sym::Result);
+    let _ = is_type_diagnostic_item(cx, ty, sym::Result);
+
+    #[allow(unused)]
+    let rc_path = &["alloc", "rc", "Rc"];
+    let _ = is_type_diagnostic_item(cx, ty, sym::Rc);
+
+    let _ = is_type_diagnostic_item(cx, ty, sym::Option);
+    let _ = is_type_diagnostic_item(cx, ty, sym::Result);
+
+    let _ = is_type_lang_item(cx, ty, LangItem::OwnedBox);
+    let _ = is_type_diagnostic_item(cx, ty, sym::maybe_uninit_uninit);
+
+    let _ = cx.tcx.lang_items().require(LangItem::OwnedBox).ok() == Some(did);
+    let _ = cx.tcx.is_diagnostic_item(sym::Option, did);
+    let _ = cx.tcx.lang_items().require(LangItem::OptionSome).ok() == Some(did);
+
+    let _ = is_trait_method(cx, expr, sym::AsRef);
+
+    let _ = is_path_diagnostic_item(cx, expr, sym::Option);
+    let _ = path_res(cx, expr).opt_def_id().map_or(false, |id| cx.tcx.lang_items().require(LangItem::IteratorNext).ok() == Some(id));
+    let _ = is_res_lang_ctor(cx, path_res(cx, expr), LangItem::OptionSome);
+}
+
+fn main() {}
diff --git a/tests/ui-internal/unnecessary_def_path.rs b/tests/ui-internal/unnecessary_def_path.rs
new file mode 100644
index 00000000000..6506f1f164a
--- /dev/null
+++ b/tests/ui-internal/unnecessary_def_path.rs
@@ -0,0 +1,62 @@
+// run-rustfix
+// aux-build:paths.rs
+#![deny(clippy::internal)]
+#![feature(rustc_private)]
+
+extern crate clippy_utils;
+extern crate paths;
+extern crate rustc_hir;
+extern crate rustc_lint;
+extern crate rustc_middle;
+extern crate rustc_span;
+
+#[allow(unused)]
+use clippy_utils::ty::{is_type_diagnostic_item, is_type_lang_item, match_type};
+#[allow(unused)]
+use clippy_utils::{
+    is_expr_path_def_path, is_path_diagnostic_item, is_res_diagnostic_ctor, is_res_lang_ctor, is_trait_method,
+    match_def_path, match_trait_method, path_res,
+};
+
+#[allow(unused)]
+use rustc_hir::LangItem;
+#[allow(unused)]
+use rustc_span::sym;
+
+use rustc_hir::def_id::DefId;
+use rustc_hir::Expr;
+use rustc_lint::LateContext;
+use rustc_middle::ty::Ty;
+
+#[allow(unused)]
+static OPTION: [&str; 3] = ["core", "option", "Option"];
+#[allow(unused)]
+const RESULT: &[&str] = &["core", "result", "Result"];
+
+fn _f<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, did: DefId, expr: &Expr<'_>) {
+    let _ = match_type(cx, ty, &OPTION);
+    let _ = match_type(cx, ty, RESULT);
+    let _ = match_type(cx, ty, &["core", "result", "Result"]);
+
+    #[allow(unused)]
+    let rc_path = &["alloc", "rc", "Rc"];
+    let _ = clippy_utils::ty::match_type(cx, ty, rc_path);
+
+    let _ = match_type(cx, ty, &paths::OPTION);
+    let _ = match_type(cx, ty, paths::RESULT);
+
+    let _ = match_type(cx, ty, &["alloc", "boxed", "Box"]);
+    let _ = match_type(cx, ty, &["core", "mem", "maybe_uninit", "MaybeUninit", "uninit"]);
+
+    let _ = match_def_path(cx, did, &["alloc", "boxed", "Box"]);
+    let _ = match_def_path(cx, did, &["core", "option", "Option"]);
+    let _ = match_def_path(cx, did, &["core", "option", "Option", "Some"]);
+
+    let _ = match_trait_method(cx, expr, &["core", "convert", "AsRef"]);
+
+    let _ = is_expr_path_def_path(cx, expr, &["core", "option", "Option"]);
+    let _ = is_expr_path_def_path(cx, expr, &["core", "iter", "traits", "Iterator", "next"]);
+    let _ = is_expr_path_def_path(cx, expr, &["core", "option", "Option", "Some"]);
+}
+
+fn main() {}
diff --git a/tests/ui-internal/unnecessary_def_path.stderr b/tests/ui-internal/unnecessary_def_path.stderr
new file mode 100644
index 00000000000..a99a8f71fa6
--- /dev/null
+++ b/tests/ui-internal/unnecessary_def_path.stderr
@@ -0,0 +1,101 @@
+error: use of a def path to a diagnostic item
+  --> $DIR/unnecessary_def_path.rs:37:13
+   |
+LL |     let _ = match_type(cx, ty, &OPTION);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Option)`
+   |
+note: the lint level is defined here
+  --> $DIR/unnecessary_def_path.rs:3:9
+   |
+LL | #![deny(clippy::internal)]
+   |         ^^^^^^^^^^^^^^^^
+   = note: `#[deny(clippy::unnecessary_def_path)]` implied by `#[deny(clippy::internal)]`
+
+error: use of a def path to a diagnostic item
+  --> $DIR/unnecessary_def_path.rs:38:13
+   |
+LL |     let _ = match_type(cx, ty, RESULT);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Result)`
+
+error: use of a def path to a diagnostic item
+  --> $DIR/unnecessary_def_path.rs:39:13
+   |
+LL |     let _ = match_type(cx, ty, &["core", "result", "Result"]);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Result)`
+
+error: use of a def path to a diagnostic item
+  --> $DIR/unnecessary_def_path.rs:43:13
+   |
+LL |     let _ = clippy_utils::ty::match_type(cx, ty, rc_path);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Rc)`
+
+error: use of a def path to a diagnostic item
+  --> $DIR/unnecessary_def_path.rs:45:13
+   |
+LL |     let _ = match_type(cx, ty, &paths::OPTION);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Option)`
+
+error: use of a def path to a diagnostic item
+  --> $DIR/unnecessary_def_path.rs:46:13
+   |
+LL |     let _ = match_type(cx, ty, paths::RESULT);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Result)`
+
+error: use of a def path to a `LangItem`
+  --> $DIR/unnecessary_def_path.rs:48:13
+   |
+LL |     let _ = match_type(cx, ty, &["alloc", "boxed", "Box"]);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_lang_item(cx, ty, LangItem::OwnedBox)`
+
+error: use of a def path to a diagnostic item
+  --> $DIR/unnecessary_def_path.rs:49:13
+   |
+LL |     let _ = match_type(cx, ty, &["core", "mem", "maybe_uninit", "MaybeUninit", "uninit"]);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::maybe_uninit_uninit)`
+
+error: use of a def path to a `LangItem`
+  --> $DIR/unnecessary_def_path.rs:51:13
+   |
+LL |     let _ = match_def_path(cx, did, &["alloc", "boxed", "Box"]);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cx.tcx.lang_items().require(LangItem::OwnedBox).ok() == Some(did)`
+
+error: use of a def path to a diagnostic item
+  --> $DIR/unnecessary_def_path.rs:52:13
+   |
+LL |     let _ = match_def_path(cx, did, &["core", "option", "Option"]);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cx.tcx.is_diagnostic_item(sym::Option, did)`
+
+error: use of a def path to a `LangItem`
+  --> $DIR/unnecessary_def_path.rs:53:13
+   |
+LL |     let _ = match_def_path(cx, did, &["core", "option", "Option", "Some"]);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cx.tcx.lang_items().require(LangItem::OptionSome).ok() == Some(did)`
+   |
+   = help: if this `DefId` came from a constructor expression or pattern then the parent `DefId` should be used instead
+
+error: use of a def path to a diagnostic item
+  --> $DIR/unnecessary_def_path.rs:55:13
+   |
+LL |     let _ = match_trait_method(cx, expr, &["core", "convert", "AsRef"]);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_trait_method(cx, expr, sym::AsRef)`
+
+error: use of a def path to a diagnostic item
+  --> $DIR/unnecessary_def_path.rs:57:13
+   |
+LL |     let _ = is_expr_path_def_path(cx, expr, &["core", "option", "Option"]);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_path_diagnostic_item(cx, expr, sym::Option)`
+
+error: use of a def path to a `LangItem`
+  --> $DIR/unnecessary_def_path.rs:58:13
+   |
+LL |     let _ = is_expr_path_def_path(cx, expr, &["core", "iter", "traits", "Iterator", "next"]);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `path_res(cx, expr).opt_def_id().map_or(false, |id| cx.tcx.lang_items().require(LangItem::IteratorNext).ok() == Some(id))`
+
+error: use of a def path to a `LangItem`
+  --> $DIR/unnecessary_def_path.rs:59:13
+   |
+LL |     let _ = is_expr_path_def_path(cx, expr, &["core", "option", "Option", "Some"]);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_res_lang_ctor(cx, path_res(cx, expr), LangItem::OptionSome)`
+
+error: aborting due to 15 previous errors
+
diff --git a/tests/ui/arithmetic_side_effects.rs b/tests/ui/arithmetic_side_effects.rs
index 6741e148547..c9c0f8be653 100644
--- a/tests/ui/arithmetic_side_effects.rs
+++ b/tests/ui/arithmetic_side_effects.rs
@@ -12,6 +12,31 @@
 
 use core::num::{Saturating, Wrapping};
 
+pub struct Custom;
+
+macro_rules! impl_arith {
+    ( $( $_trait:ident, $ty:ty, $method:ident; )* ) => {
+        $(
+            impl core::ops::$_trait<$ty> for Custom {
+                type Output = Self;
+                fn $method(self, _: $ty) -> Self::Output { Self }
+            }
+        )*
+    }
+}
+
+impl_arith!(
+    Add, i32, add;
+    Div, i32, div;
+    Mul, i32, mul;
+    Sub, i32, sub;
+
+    Add, f64, add;
+    Div, f64, div;
+    Mul, f64, mul;
+    Sub, f64, sub;
+);
+
 pub fn association_with_structures_should_not_trigger_the_lint() {
     enum Foo {
         Bar = -2,
@@ -130,7 +155,7 @@ pub fn non_overflowing_ops_or_ops_already_handled_by_the_compiler_should_not_tri
     _n = -(-1);
 }
 
-pub fn overflowing_runtime_ops() {
+pub fn runtime_ops() {
     let mut _n = i32::MAX;
 
     // Assign
@@ -163,6 +188,32 @@ pub fn overflowing_runtime_ops() {
     _n = 2 * _n;
     _n = &2 * _n;
 
+    // Custom
+    let _ = Custom + 0;
+    let _ = Custom + 1;
+    let _ = Custom + 2;
+    let _ = Custom + 0.0;
+    let _ = Custom + 1.0;
+    let _ = Custom + 2.0;
+    let _ = Custom - 0;
+    let _ = Custom - 1;
+    let _ = Custom - 2;
+    let _ = Custom - 0.0;
+    let _ = Custom - 1.0;
+    let _ = Custom - 2.0;
+    let _ = Custom / 0;
+    let _ = Custom / 1;
+    let _ = Custom / 2;
+    let _ = Custom / 0.0;
+    let _ = Custom / 1.0;
+    let _ = Custom / 2.0;
+    let _ = Custom * 0;
+    let _ = Custom * 1;
+    let _ = Custom * 2;
+    let _ = Custom * 0.0;
+    let _ = Custom * 1.0;
+    let _ = Custom * 2.0;
+
     // Unary
     _n = -_n;
     _n = -&_n;
diff --git a/tests/ui/arithmetic_side_effects.stderr b/tests/ui/arithmetic_side_effects.stderr
index 4dce13b624b..8cabd05c2f9 100644
--- a/tests/ui/arithmetic_side_effects.stderr
+++ b/tests/ui/arithmetic_side_effects.stderr
@@ -1,172 +1,334 @@
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:137:5
+  --> $DIR/arithmetic_side_effects.rs:78:13
    |
-LL |     _n += 1;
-   |     ^^^^^^^
+LL |     let _ = String::new() + "";
+   |             ^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::arithmetic-side-effects` implied by `-D warnings`
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:138:5
+  --> $DIR/arithmetic_side_effects.rs:86:27
+   |
+LL |     let inferred_string = string + "";
+   |                           ^^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:90:13
+   |
+LL |     let _ = inferred_string + "";
+   |             ^^^^^^^^^^^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:162:5
+   |
+LL |     _n += 1;
+   |     ^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:163:5
    |
 LL |     _n += &1;
    |     ^^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:139:5
+  --> $DIR/arithmetic_side_effects.rs:164:5
    |
 LL |     _n -= 1;
    |     ^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:140:5
+  --> $DIR/arithmetic_side_effects.rs:165:5
    |
 LL |     _n -= &1;
    |     ^^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:141:5
+  --> $DIR/arithmetic_side_effects.rs:166:5
    |
 LL |     _n /= 0;
    |     ^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:142:5
+  --> $DIR/arithmetic_side_effects.rs:167:5
    |
 LL |     _n /= &0;
    |     ^^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:143:5
+  --> $DIR/arithmetic_side_effects.rs:168:5
    |
 LL |     _n %= 0;
    |     ^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:144:5
+  --> $DIR/arithmetic_side_effects.rs:169:5
    |
 LL |     _n %= &0;
    |     ^^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:145:5
+  --> $DIR/arithmetic_side_effects.rs:170:5
    |
 LL |     _n *= 2;
    |     ^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:146:5
+  --> $DIR/arithmetic_side_effects.rs:171:5
    |
 LL |     _n *= &2;
    |     ^^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:149:10
+  --> $DIR/arithmetic_side_effects.rs:174:10
    |
 LL |     _n = _n + 1;
    |          ^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:150:10
+  --> $DIR/arithmetic_side_effects.rs:175:10
    |
 LL |     _n = _n + &1;
    |          ^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:151:10
+  --> $DIR/arithmetic_side_effects.rs:176:10
    |
 LL |     _n = 1 + _n;
    |          ^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:152:10
+  --> $DIR/arithmetic_side_effects.rs:177:10
    |
 LL |     _n = &1 + _n;
    |          ^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:153:10
+  --> $DIR/arithmetic_side_effects.rs:178:10
    |
 LL |     _n = _n - 1;
    |          ^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:154:10
+  --> $DIR/arithmetic_side_effects.rs:179:10
    |
 LL |     _n = _n - &1;
    |          ^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:155:10
+  --> $DIR/arithmetic_side_effects.rs:180:10
    |
 LL |     _n = 1 - _n;
    |          ^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:156:10
+  --> $DIR/arithmetic_side_effects.rs:181:10
    |
 LL |     _n = &1 - _n;
    |          ^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:157:10
+  --> $DIR/arithmetic_side_effects.rs:182:10
    |
 LL |     _n = _n / 0;
    |          ^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:158:10
+  --> $DIR/arithmetic_side_effects.rs:183:10
    |
 LL |     _n = _n / &0;
    |          ^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:159:10
+  --> $DIR/arithmetic_side_effects.rs:184:10
    |
 LL |     _n = _n % 0;
    |          ^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:160:10
+  --> $DIR/arithmetic_side_effects.rs:185:10
    |
 LL |     _n = _n % &0;
    |          ^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:161:10
+  --> $DIR/arithmetic_side_effects.rs:186:10
    |
 LL |     _n = _n * 2;
    |          ^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:162:10
+  --> $DIR/arithmetic_side_effects.rs:187:10
    |
 LL |     _n = _n * &2;
    |          ^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:163:10
+  --> $DIR/arithmetic_side_effects.rs:188:10
    |
 LL |     _n = 2 * _n;
    |          ^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:164:10
+  --> $DIR/arithmetic_side_effects.rs:189:10
    |
 LL |     _n = &2 * _n;
    |          ^^^^^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:167:10
+  --> $DIR/arithmetic_side_effects.rs:192:13
+   |
+LL |     let _ = Custom + 0;
+   |             ^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:193:13
+   |
+LL |     let _ = Custom + 1;
+   |             ^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:194:13
+   |
+LL |     let _ = Custom + 2;
+   |             ^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:195:13
+   |
+LL |     let _ = Custom + 0.0;
+   |             ^^^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:196:13
+   |
+LL |     let _ = Custom + 1.0;
+   |             ^^^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:197:13
+   |
+LL |     let _ = Custom + 2.0;
+   |             ^^^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:198:13
+   |
+LL |     let _ = Custom - 0;
+   |             ^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:199:13
+   |
+LL |     let _ = Custom - 1;
+   |             ^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:200:13
+   |
+LL |     let _ = Custom - 2;
+   |             ^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:201:13
+   |
+LL |     let _ = Custom - 0.0;
+   |             ^^^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:202:13
+   |
+LL |     let _ = Custom - 1.0;
+   |             ^^^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:203:13
+   |
+LL |     let _ = Custom - 2.0;
+   |             ^^^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:204:13
+   |
+LL |     let _ = Custom / 0;
+   |             ^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:205:13
+   |
+LL |     let _ = Custom / 1;
+   |             ^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:206:13
+   |
+LL |     let _ = Custom / 2;
+   |             ^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:207:13
+   |
+LL |     let _ = Custom / 0.0;
+   |             ^^^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:208:13
+   |
+LL |     let _ = Custom / 1.0;
+   |             ^^^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:209:13
+   |
+LL |     let _ = Custom / 2.0;
+   |             ^^^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:210:13
+   |
+LL |     let _ = Custom * 0;
+   |             ^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:211:13
+   |
+LL |     let _ = Custom * 1;
+   |             ^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:212:13
+   |
+LL |     let _ = Custom * 2;
+   |             ^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:213:13
+   |
+LL |     let _ = Custom * 0.0;
+   |             ^^^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:214:13
+   |
+LL |     let _ = Custom * 1.0;
+   |             ^^^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:215:13
+   |
+LL |     let _ = Custom * 2.0;
+   |             ^^^^^^^^^^^^
+
+error: arithmetic operation that can potentially result in unexpected side-effects
+  --> $DIR/arithmetic_side_effects.rs:218:10
    |
 LL |     _n = -_n;
    |          ^^^
 
 error: arithmetic operation that can potentially result in unexpected side-effects
-  --> $DIR/arithmetic_side_effects.rs:168:10
+  --> $DIR/arithmetic_side_effects.rs:219:10
    |
 LL |     _n = -&_n;
    |          ^^^^
 
-error: aborting due to 28 previous errors
+error: aborting due to 55 previous errors
 
diff --git a/tests/ui/floating_point_mul_add.fixed b/tests/ui/floating_point_mul_add.fixed
index 169ec02f82b..d3e536ba350 100644
--- a/tests/ui/floating_point_mul_add.fixed
+++ b/tests/ui/floating_point_mul_add.fixed
@@ -19,7 +19,9 @@ fn main() {
     let d: f64 = 0.0001;
 
     let _ = a.mul_add(b, c);
+    let _ = a.mul_add(b, -c);
     let _ = a.mul_add(b, c);
+    let _ = a.mul_add(-b, c);
     let _ = 2.0f64.mul_add(4.0, a);
     let _ = 2.0f64.mul_add(4., a);
 
diff --git a/tests/ui/floating_point_mul_add.rs b/tests/ui/floating_point_mul_add.rs
index 5338d4fc2b7..5d4a9e35cfc 100644
--- a/tests/ui/floating_point_mul_add.rs
+++ b/tests/ui/floating_point_mul_add.rs
@@ -19,7 +19,9 @@ fn main() {
     let d: f64 = 0.0001;
 
     let _ = a * b + c;
+    let _ = a * b - c;
     let _ = c + a * b;
+    let _ = c - a * b;
     let _ = a + 2.0 * 4.0;
     let _ = a + 2. * 4.;
 
diff --git a/tests/ui/floating_point_mul_add.stderr b/tests/ui/floating_point_mul_add.stderr
index e637bbf90ca..a79ae94e8d4 100644
--- a/tests/ui/floating_point_mul_add.stderr
+++ b/tests/ui/floating_point_mul_add.stderr
@@ -9,56 +9,68 @@ LL |     let _ = a * b + c;
 error: multiply and add expressions can be calculated more efficiently and accurately
   --> $DIR/floating_point_mul_add.rs:22:13
    |
+LL |     let _ = a * b - c;
+   |             ^^^^^^^^^ help: consider using: `a.mul_add(b, -c)`
+
+error: multiply and add expressions can be calculated more efficiently and accurately
+  --> $DIR/floating_point_mul_add.rs:23:13
+   |
 LL |     let _ = c + a * b;
    |             ^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
 
 error: multiply and add expressions can be calculated more efficiently and accurately
-  --> $DIR/floating_point_mul_add.rs:23:13
+  --> $DIR/floating_point_mul_add.rs:24:13
+   |
+LL |     let _ = c - a * b;
+   |             ^^^^^^^^^ help: consider using: `a.mul_add(-b, c)`
+
+error: multiply and add expressions can be calculated more efficiently and accurately
+  --> $DIR/floating_point_mul_add.rs:25:13
    |
 LL |     let _ = a + 2.0 * 4.0;
    |             ^^^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(4.0, a)`
 
 error: multiply and add expressions can be calculated more efficiently and accurately
-  --> $DIR/floating_point_mul_add.rs:24:13
+  --> $DIR/floating_point_mul_add.rs:26:13
    |
 LL |     let _ = a + 2. * 4.;
    |             ^^^^^^^^^^^ help: consider using: `2.0f64.mul_add(4., a)`
 
 error: multiply and add expressions can be calculated more efficiently and accurately
-  --> $DIR/floating_point_mul_add.rs:26:13
+  --> $DIR/floating_point_mul_add.rs:28:13
    |
 LL |     let _ = (a * b) + c;
    |             ^^^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
 
 error: multiply and add expressions can be calculated more efficiently and accurately
-  --> $DIR/floating_point_mul_add.rs:27:13
+  --> $DIR/floating_point_mul_add.rs:29:13
    |
 LL |     let _ = c + (a * b);
    |             ^^^^^^^^^^^ help: consider using: `a.mul_add(b, c)`
 
 error: multiply and add expressions can be calculated more efficiently and accurately
-  --> $DIR/floating_point_mul_add.rs:28:13
+  --> $DIR/floating_point_mul_add.rs:30:13
    |
 LL |     let _ = a * b * c + d;
    |             ^^^^^^^^^^^^^ help: consider using: `(a * b).mul_add(c, d)`
 
 error: multiply and add expressions can be calculated more efficiently and accurately
-  --> $DIR/floating_point_mul_add.rs:30:13
+  --> $DIR/floating_point_mul_add.rs:32:13
    |
 LL |     let _ = a.mul_add(b, c) * a.mul_add(b, c) + a.mul_add(b, c) + c;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `a.mul_add(b, c).mul_add(a.mul_add(b, c), a.mul_add(b, c))`
 
 error: multiply and add expressions can be calculated more efficiently and accurately
-  --> $DIR/floating_point_mul_add.rs:31:13
+  --> $DIR/floating_point_mul_add.rs:33:13
    |
 LL |     let _ = 1234.567_f64 * 45.67834_f64 + 0.0004_f64;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1234.567_f64.mul_add(45.67834_f64, 0.0004_f64)`
 
 error: multiply and add expressions can be calculated more efficiently and accurately
-  --> $DIR/floating_point_mul_add.rs:33:13
+  --> $DIR/floating_point_mul_add.rs:35:13
    |
 LL |     let _ = (a * a + b).sqrt();
    |             ^^^^^^^^^^^ help: consider using: `a.mul_add(a, b)`
 
-error: aborting due to 10 previous errors
+error: aborting due to 12 previous errors
 
diff --git a/tests/ui/floating_point_powi.fixed b/tests/ui/floating_point_powi.fixed
index 68c81316930..884d05fed71 100644
--- a/tests/ui/floating_point_powi.fixed
+++ b/tests/ui/floating_point_powi.fixed
@@ -8,7 +8,9 @@ fn main() {
 
     let y = 4f32;
     let _ = x.mul_add(x, y);
+    let _ = x.mul_add(x, -y);
     let _ = y.mul_add(y, x);
+    let _ = y.mul_add(-y, x);
     let _ = (y as f32).mul_add(y as f32, x);
     let _ = x.mul_add(x, y).sqrt();
     let _ = y.mul_add(y, x).sqrt();
diff --git a/tests/ui/floating_point_powi.rs b/tests/ui/floating_point_powi.rs
index 96101a487ee..e6a1c895371 100644
--- a/tests/ui/floating_point_powi.rs
+++ b/tests/ui/floating_point_powi.rs
@@ -8,7 +8,9 @@ fn main() {
 
     let y = 4f32;
     let _ = x.powi(2) + y;
+    let _ = x.powi(2) - y;
     let _ = x + y.powi(2);
+    let _ = x - y.powi(2);
     let _ = x + (y as f32).powi(2);
     let _ = (x.powi(2) + y).sqrt();
     let _ = (x + y.powi(2)).sqrt();
diff --git a/tests/ui/floating_point_powi.stderr b/tests/ui/floating_point_powi.stderr
index a651954a5f8..5df0de1fef2 100644
--- a/tests/ui/floating_point_powi.stderr
+++ b/tests/ui/floating_point_powi.stderr
@@ -9,26 +9,38 @@ LL |     let _ = x.powi(2) + y;
 error: multiply and add expressions can be calculated more efficiently and accurately
   --> $DIR/floating_point_powi.rs:11:13
    |
+LL |     let _ = x.powi(2) - y;
+   |             ^^^^^^^^^^^^^ help: consider using: `x.mul_add(x, -y)`
+
+error: multiply and add expressions can be calculated more efficiently and accurately
+  --> $DIR/floating_point_powi.rs:12:13
+   |
 LL |     let _ = x + y.powi(2);
    |             ^^^^^^^^^^^^^ help: consider using: `y.mul_add(y, x)`
 
 error: multiply and add expressions can be calculated more efficiently and accurately
-  --> $DIR/floating_point_powi.rs:12:13
+  --> $DIR/floating_point_powi.rs:13:13
+   |
+LL |     let _ = x - y.powi(2);
+   |             ^^^^^^^^^^^^^ help: consider using: `y.mul_add(-y, x)`
+
+error: multiply and add expressions can be calculated more efficiently and accurately
+  --> $DIR/floating_point_powi.rs:14:13
    |
 LL |     let _ = x + (y as f32).powi(2);
    |             ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(y as f32).mul_add(y as f32, x)`
 
 error: multiply and add expressions can be calculated more efficiently and accurately
-  --> $DIR/floating_point_powi.rs:13:13
+  --> $DIR/floating_point_powi.rs:15:13
    |
 LL |     let _ = (x.powi(2) + y).sqrt();
    |             ^^^^^^^^^^^^^^^ help: consider using: `x.mul_add(x, y)`
 
 error: multiply and add expressions can be calculated more efficiently and accurately
-  --> $DIR/floating_point_powi.rs:14:13
+  --> $DIR/floating_point_powi.rs:16:13
    |
 LL |     let _ = (x + y.powi(2)).sqrt();
    |             ^^^^^^^^^^^^^^^ help: consider using: `y.mul_add(y, x)`
 
-error: aborting due to 5 previous errors
+error: aborting due to 7 previous errors
 
diff --git a/tests/ui/implicit_saturating_add.fixed b/tests/ui/implicit_saturating_add.fixed
new file mode 100644
index 00000000000..7d363d59a6f
--- /dev/null
+++ b/tests/ui/implicit_saturating_add.fixed
@@ -0,0 +1,106 @@
+// run-rustfix
+
+#![allow(unused)]
+#![warn(clippy::implicit_saturating_add)]
+
+fn main() {
+    let mut u_8: u8 = 255;
+    let mut u_16: u16 = 500;
+    let mut u_32: u32 = 7000;
+    let mut u_64: u64 = 7000;
+    let mut i_8: i8 = 30;
+    let mut i_16: i16 = 500;
+    let mut i_32: i32 = 7000;
+    let mut i_64: i64 = 7000;
+
+    if i_8 < 42 {
+        i_8 += 1;
+    }
+    if i_8 != 42 {
+        i_8 += 1;
+    }
+
+    u_8 = u_8.saturating_add(1);
+
+    u_8 = u_8.saturating_add(1);
+
+    if u_8 < 15 {
+        u_8 += 1;
+    }
+
+    u_16 = u_16.saturating_add(1);
+
+    u_16 = u_16.saturating_add(1);
+
+    u_16 = u_16.saturating_add(1);
+
+    u_32 = u_32.saturating_add(1);
+
+    u_32 = u_32.saturating_add(1);
+
+    u_32 = u_32.saturating_add(1);
+
+    u_64 = u_64.saturating_add(1);
+
+    u_64 = u_64.saturating_add(1);
+
+    u_64 = u_64.saturating_add(1);
+
+    i_8 = i_8.saturating_add(1);
+
+    i_8 = i_8.saturating_add(1);
+
+    i_8 = i_8.saturating_add(1);
+
+    i_16 = i_16.saturating_add(1);
+
+    i_16 = i_16.saturating_add(1);
+
+    i_16 = i_16.saturating_add(1);
+
+    i_32 = i_32.saturating_add(1);
+
+    i_32 = i_32.saturating_add(1);
+
+    i_32 = i_32.saturating_add(1);
+
+    i_64 = i_64.saturating_add(1);
+
+    i_64 = i_64.saturating_add(1);
+
+    i_64 = i_64.saturating_add(1);
+
+    if i_64 < 42 {
+        i_64 += 1;
+    }
+
+    if 42 > i_64 {
+        i_64 += 1;
+    }
+
+    let a = 12;
+    let mut b = 8;
+
+    if a < u8::MAX {
+        b += 1;
+    }
+
+    if u8::MAX > a {
+        b += 1;
+    }
+
+    if u_32 < u32::MAX {
+        u_32 += 1;
+    } else {
+        println!("don't lint this");
+    }
+
+    if u_32 < u32::MAX {
+        println!("don't lint this");
+        u_32 += 1;
+    }
+
+    if u_32 < 42 {
+        println!("brace yourself!");
+    } else {u_32 = u_32.saturating_add(1); }
+}
diff --git a/tests/ui/implicit_saturating_add.rs b/tests/ui/implicit_saturating_add.rs
new file mode 100644
index 00000000000..31a5916277f
--- /dev/null
+++ b/tests/ui/implicit_saturating_add.rs
@@ -0,0 +1,154 @@
+// run-rustfix
+
+#![allow(unused)]
+#![warn(clippy::implicit_saturating_add)]
+
+fn main() {
+    let mut u_8: u8 = 255;
+    let mut u_16: u16 = 500;
+    let mut u_32: u32 = 7000;
+    let mut u_64: u64 = 7000;
+    let mut i_8: i8 = 30;
+    let mut i_16: i16 = 500;
+    let mut i_32: i32 = 7000;
+    let mut i_64: i64 = 7000;
+
+    if i_8 < 42 {
+        i_8 += 1;
+    }
+    if i_8 != 42 {
+        i_8 += 1;
+    }
+
+    if u_8 != u8::MAX {
+        u_8 += 1;
+    }
+
+    if u_8 < u8::MAX {
+        u_8 += 1;
+    }
+
+    if u_8 < 15 {
+        u_8 += 1;
+    }
+
+    if u_16 != u16::MAX {
+        u_16 += 1;
+    }
+
+    if u_16 < u16::MAX {
+        u_16 += 1;
+    }
+
+    if u16::MAX > u_16 {
+        u_16 += 1;
+    }
+
+    if u_32 != u32::MAX {
+        u_32 += 1;
+    }
+
+    if u_32 < u32::MAX {
+        u_32 += 1;
+    }
+
+    if u32::MAX > u_32 {
+        u_32 += 1;
+    }
+
+    if u_64 != u64::MAX {
+        u_64 += 1;
+    }
+
+    if u_64 < u64::MAX {
+        u_64 += 1;
+    }
+
+    if u64::MAX > u_64 {
+        u_64 += 1;
+    }
+
+    if i_8 != i8::MAX {
+        i_8 += 1;
+    }
+
+    if i_8 < i8::MAX {
+        i_8 += 1;
+    }
+
+    if i8::MAX > i_8 {
+        i_8 += 1;
+    }
+
+    if i_16 != i16::MAX {
+        i_16 += 1;
+    }
+
+    if i_16 < i16::MAX {
+        i_16 += 1;
+    }
+
+    if i16::MAX > i_16 {
+        i_16 += 1;
+    }
+
+    if i_32 != i32::MAX {
+        i_32 += 1;
+    }
+
+    if i_32 < i32::MAX {
+        i_32 += 1;
+    }
+
+    if i32::MAX > i_32 {
+        i_32 += 1;
+    }
+
+    if i_64 != i64::MAX {
+        i_64 += 1;
+    }
+
+    if i_64 < i64::MAX {
+        i_64 += 1;
+    }
+
+    if i64::MAX > i_64 {
+        i_64 += 1;
+    }
+
+    if i_64 < 42 {
+        i_64 += 1;
+    }
+
+    if 42 > i_64 {
+        i_64 += 1;
+    }
+
+    let a = 12;
+    let mut b = 8;
+
+    if a < u8::MAX {
+        b += 1;
+    }
+
+    if u8::MAX > a {
+        b += 1;
+    }
+
+    if u_32 < u32::MAX {
+        u_32 += 1;
+    } else {
+        println!("don't lint this");
+    }
+
+    if u_32 < u32::MAX {
+        println!("don't lint this");
+        u_32 += 1;
+    }
+
+    if u_32 < 42 {
+        println!("brace yourself!");
+    } else if u_32 < u32::MAX {
+        u_32 += 1;
+    }
+}
diff --git a/tests/ui/implicit_saturating_add.stderr b/tests/ui/implicit_saturating_add.stderr
new file mode 100644
index 00000000000..42ae1b48885
--- /dev/null
+++ b/tests/ui/implicit_saturating_add.stderr
@@ -0,0 +1,197 @@
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:23:5
+   |
+LL | /     if u_8 != u8::MAX {
+LL | |         u_8 += 1;
+LL | |     }
+   | |_____^ help: use instead: `u_8 = u_8.saturating_add(1);`
+   |
+   = note: `-D clippy::implicit-saturating-add` implied by `-D warnings`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:27:5
+   |
+LL | /     if u_8 < u8::MAX {
+LL | |         u_8 += 1;
+LL | |     }
+   | |_____^ help: use instead: `u_8 = u_8.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:35:5
+   |
+LL | /     if u_16 != u16::MAX {
+LL | |         u_16 += 1;
+LL | |     }
+   | |_____^ help: use instead: `u_16 = u_16.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:39:5
+   |
+LL | /     if u_16 < u16::MAX {
+LL | |         u_16 += 1;
+LL | |     }
+   | |_____^ help: use instead: `u_16 = u_16.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:43:5
+   |
+LL | /     if u16::MAX > u_16 {
+LL | |         u_16 += 1;
+LL | |     }
+   | |_____^ help: use instead: `u_16 = u_16.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:47:5
+   |
+LL | /     if u_32 != u32::MAX {
+LL | |         u_32 += 1;
+LL | |     }
+   | |_____^ help: use instead: `u_32 = u_32.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:51:5
+   |
+LL | /     if u_32 < u32::MAX {
+LL | |         u_32 += 1;
+LL | |     }
+   | |_____^ help: use instead: `u_32 = u_32.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:55:5
+   |
+LL | /     if u32::MAX > u_32 {
+LL | |         u_32 += 1;
+LL | |     }
+   | |_____^ help: use instead: `u_32 = u_32.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:59:5
+   |
+LL | /     if u_64 != u64::MAX {
+LL | |         u_64 += 1;
+LL | |     }
+   | |_____^ help: use instead: `u_64 = u_64.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:63:5
+   |
+LL | /     if u_64 < u64::MAX {
+LL | |         u_64 += 1;
+LL | |     }
+   | |_____^ help: use instead: `u_64 = u_64.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:67:5
+   |
+LL | /     if u64::MAX > u_64 {
+LL | |         u_64 += 1;
+LL | |     }
+   | |_____^ help: use instead: `u_64 = u_64.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:71:5
+   |
+LL | /     if i_8 != i8::MAX {
+LL | |         i_8 += 1;
+LL | |     }
+   | |_____^ help: use instead: `i_8 = i_8.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:75:5
+   |
+LL | /     if i_8 < i8::MAX {
+LL | |         i_8 += 1;
+LL | |     }
+   | |_____^ help: use instead: `i_8 = i_8.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:79:5
+   |
+LL | /     if i8::MAX > i_8 {
+LL | |         i_8 += 1;
+LL | |     }
+   | |_____^ help: use instead: `i_8 = i_8.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:83:5
+   |
+LL | /     if i_16 != i16::MAX {
+LL | |         i_16 += 1;
+LL | |     }
+   | |_____^ help: use instead: `i_16 = i_16.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:87:5
+   |
+LL | /     if i_16 < i16::MAX {
+LL | |         i_16 += 1;
+LL | |     }
+   | |_____^ help: use instead: `i_16 = i_16.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:91:5
+   |
+LL | /     if i16::MAX > i_16 {
+LL | |         i_16 += 1;
+LL | |     }
+   | |_____^ help: use instead: `i_16 = i_16.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:95:5
+   |
+LL | /     if i_32 != i32::MAX {
+LL | |         i_32 += 1;
+LL | |     }
+   | |_____^ help: use instead: `i_32 = i_32.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:99:5
+   |
+LL | /     if i_32 < i32::MAX {
+LL | |         i_32 += 1;
+LL | |     }
+   | |_____^ help: use instead: `i_32 = i_32.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:103:5
+   |
+LL | /     if i32::MAX > i_32 {
+LL | |         i_32 += 1;
+LL | |     }
+   | |_____^ help: use instead: `i_32 = i_32.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:107:5
+   |
+LL | /     if i_64 != i64::MAX {
+LL | |         i_64 += 1;
+LL | |     }
+   | |_____^ help: use instead: `i_64 = i_64.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:111:5
+   |
+LL | /     if i_64 < i64::MAX {
+LL | |         i_64 += 1;
+LL | |     }
+   | |_____^ help: use instead: `i_64 = i_64.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:115:5
+   |
+LL | /     if i64::MAX > i_64 {
+LL | |         i_64 += 1;
+LL | |     }
+   | |_____^ help: use instead: `i_64 = i_64.saturating_add(1);`
+
+error: manual saturating add detected
+  --> $DIR/implicit_saturating_add.rs:151:12
+   |
+LL |       } else if u_32 < u32::MAX {
+   |  ____________^
+LL | |         u_32 += 1;
+LL | |     }
+   | |_____^ help: use instead: `{u_32 = u_32.saturating_add(1); }`
+
+error: aborting due to 24 previous errors
+
diff --git a/tests/ui/manual_assert.fixed b/tests/ui/manual_assert.fixed
deleted file mode 100644
index a2393674fe6..00000000000
--- a/tests/ui/manual_assert.fixed
+++ /dev/null
@@ -1,45 +0,0 @@
-// revisions: edition2018 edition2021
-// [edition2018] edition:2018
-// [edition2021] edition:2021
-// run-rustfix
-
-#![warn(clippy::manual_assert)]
-#![allow(clippy::nonminimal_bool)]
-
-fn main() {
-    let a = vec![1, 2, 3];
-    let c = Some(2);
-    if !a.is_empty()
-        && a.len() == 3
-        && c.is_some()
-        && !a.is_empty()
-        && a.len() == 3
-        && !a.is_empty()
-        && a.len() == 3
-        && !a.is_empty()
-        && a.len() == 3
-    {
-        panic!("qaqaq{:?}", a);
-    }
-    assert!(a.is_empty(), "qaqaq{:?}", a);
-    assert!(a.is_empty(), "qwqwq");
-    if a.len() == 3 {
-        println!("qwq");
-        println!("qwq");
-        println!("qwq");
-    }
-    if let Some(b) = c {
-        panic!("orz {}", b);
-    }
-    if a.len() == 3 {
-        panic!("qaqaq");
-    } else {
-        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");
-}
diff --git a/tests/ui/option_take_on_temporary.fixed b/tests/ui/option_take_on_temporary.fixed
deleted file mode 100644
index 29691e81666..00000000000
--- a/tests/ui/option_take_on_temporary.fixed
+++ /dev/null
@@ -1,15 +0,0 @@
-// run-rustfix
-
-fn main() {
-    println!("Testing non erroneous option_take_on_temporary");
-    let mut option = Some(1);
-    let _ = Box::new(move || option.take().unwrap());
-
-    println!("Testing non erroneous option_take_on_temporary");
-    let x = Some(3);
-    x.as_ref();
-
-    println!("Testing erroneous option_take_on_temporary");
-    let x = Some(3);
-    x.as_ref();
-}
diff --git a/tests/ui/upper_case_acronyms.rs b/tests/ui/upper_case_acronyms.rs
index 48bb9e54b12..9b7c2f28e1c 100644
--- a/tests/ui/upper_case_acronyms.rs
+++ b/tests/ui/upper_case_acronyms.rs
@@ -38,4 +38,13 @@ enum ParseErrorPrivate<T> {
     Parse(T, String),
 }
 
+// do lint here
+struct JSON;
+
+// do lint here
+enum YAML {
+    Num(u32),
+    Str(String),
+}
+
 fn main() {}
diff --git a/tests/ui/upper_case_acronyms.stderr b/tests/ui/upper_case_acronyms.stderr
index 250b196a99e..74082ec16dd 100644
--- a/tests/ui/upper_case_acronyms.stderr
+++ b/tests/ui/upper_case_acronyms.stderr
@@ -54,5 +54,17 @@ error: name `WASD` contains a capitalized acronym
 LL |     WASD(u8),
    |     ^^^^ help: consider making the acronym lowercase, except the initial letter: `Wasd`
 
-error: aborting due to 9 previous errors
+error: name `JSON` contains a capitalized acronym
+  --> $DIR/upper_case_acronyms.rs:42:8
+   |
+LL | struct JSON;
+   |        ^^^^ help: consider making the acronym lowercase, except the initial letter: `Json`
+
+error: name `YAML` contains a capitalized acronym
+  --> $DIR/upper_case_acronyms.rs:45:6
+   |
+LL | enum YAML {
+   |      ^^^^ help: consider making the acronym lowercase, except the initial letter: `Yaml`
+
+error: aborting due to 11 previous errors