Skip to content

missing lint from manual_is_multiple_of #18110

Open

Description

@FelixMaetzler

Summary

use the code snippet down below to reproduce it.
I shrank it to a minimal reproducable version.
It seems that it has something to do with the tuple assignment.

Lint Name

manual_is_multiple_of

Reproducer

I tried this code:

pub fn foo() -> bool {
    let (a, b) = (3_u32, 5);
    a % b == 0 // not getting linted
}

I expected to see this happen:
getting a lint that it can be replaced with:

pub fn foo() -> bool {
    let (a, b) = (3_u32, 5);
    a.is_multiple_of(b)
}

Instead, this happened:
Nothing happend. The lint is not getting fired.

But if i do:

pub fn foo() -> bool {
    let a = 3_u32;
    let b = 5;
    a % b == 0 // is getting linted
}

it is getting linted as it should.

Version

rustc 1.100.0 (0ef1bc386 2026-11-09)
binary: rustc
commit-hash: 0ef1bc386059596dada8fb65b50425aab2ea637a
commit-date: 2026-11-09
host: x86_64-pc-windows-msvc
release: 1.100.0
LLVM version: 23.1.5

Activity

  1. added
    C-bug
    I-false-negative
    on Nov 20, 2026
  2. Gri-ffin commented on Nov 21, 2026

    @Gri-ffin
    Member

    @rustbot claim

  3. Gri-ffin commented on Nov 21, 2026

    @Gri-ffin
    Member

    @rustbot unclaim

  4. llRandom commented on Nov 23, 2026

    @llRandom

    @rustbot claim

  5. llRandom commented on Nov 24, 2026

    @llRandom

    I have a fix that handles tuple literals:

    let (a, b) = (3_u32, 5);
    let (c, (d, e)) = (3_u32, (4_u32, 5));
    let (f, .., g) = (1, 2, 3_u32);

    Other nested bindings are still uncertain, as before. Should any of these be covered too, or left for later?

    let (a, b) = make_pair();
    let (a, b) = &(1_u32, 2_u32);
    let (a, b): (u32, _) = (x, 2);
    let Some(a) = opt_u32 else { return };
    let S { v } = s;
    let [a, b] = arr_u32;
    |(a, b): (u32, u32)| a % b == 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-bugI-false-negative

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions