diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 005b734c16fe..717451903243 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -1183,7 +1183,6 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf LintId::of(&misc_early::UNNEEDED_FIELD_PATTERN), LintId::of(&misc_early::UNNEEDED_WILDCARD_PATTERN), LintId::of(&misc_early::ZERO_PREFIXED_LITERAL), - LintId::of(&mul_add::MANUAL_MUL_ADD), LintId::of(&mut_reference::UNNECESSARY_MUT_PASSED), LintId::of(&mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL), LintId::of(&mutex_atomic::MUTEX_ATOMIC), @@ -1527,7 +1526,6 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf LintId::of(&methods::OR_FUN_CALL), LintId::of(&methods::SINGLE_CHAR_PATTERN), LintId::of(&misc::CMP_OWNED), - LintId::of(&mul_add::MANUAL_MUL_ADD), LintId::of(&mutex_atomic::MUTEX_ATOMIC), LintId::of(&redundant_clone::REDUNDANT_CLONE), LintId::of(&slow_vector_initialization::SLOW_VECTOR_INITIALIZATION), @@ -1546,6 +1544,7 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf LintId::of(&attrs::EMPTY_LINE_AFTER_OUTER_ATTR), LintId::of(&fallible_impl_from::FALLIBLE_IMPL_FROM), LintId::of(&missing_const_for_fn::MISSING_CONST_FOR_FN), + LintId::of(&mul_add::MANUAL_MUL_ADD), LintId::of(&mutex_atomic::MUTEX_INTEGER), LintId::of(&needless_borrow::NEEDLESS_BORROW), LintId::of(&path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE), diff --git a/clippy_lints/src/mul_add.rs b/clippy_lints/src/mul_add.rs index 02e403eee180..5263bfbd357a 100644 --- a/clippy_lints/src/mul_add.rs +++ b/clippy_lints/src/mul_add.rs @@ -15,7 +15,9 @@ declare_clippy_lint! { /// `c`. Depending on the target architecture, `mul_add()` may be more /// performant. /// - /// **Known problems:** None. + /// **Known problems:** This lint can emit semantic incorrect suggestions. + /// For example, for `a * b * c + d` the suggestion `a * b.mul_add(c, d)` + /// is emitted, which is equivalent to `a * (b * c + d)`. (#4735) /// /// **Example:** /// @@ -35,7 +37,7 @@ declare_clippy_lint! { /// let foo = a.mul_add(b, c); /// ``` pub MANUAL_MUL_ADD, - perf, + nursery, "Using `a.mul_add(b, c)` for floating points has higher numerical precision than `a * b + c`" } diff --git a/src/lintlist/mod.rs b/src/lintlist/mod.rs index 48ca368f5a93..a053cf8bef0c 100644 --- a/src/lintlist/mod.rs +++ b/src/lintlist/mod.rs @@ -961,7 +961,7 @@ pub const ALL_LINTS: [Lint; 332] = [ }, Lint { name: "manual_mul_add", - group: "perf", + group: "nursery", desc: "Using `a.mul_add(b, c)` for floating points has higher numerical precision than `a * b + c`", deprecation: None, module: "mul_add",