Skip to content

question_mark doesn't recognize match with None => None arm #16751

@cakebaker

Description

@cakebaker

Summary

Hi,

I noticed in our code base that a match with a None => None arm doesn't lead to a warning from the question_mark lint.

Lint Name

question_mark

Reproducer

I tried this code:

fn main() {
    let _x = example(Some(12));
}

fn example(v: Option<usize>) -> Option<usize> {
    match v {
        Some(n) => {
            println!("{n}");
            Some(42)
        }
        None => None,
    }
}

I expected to see this happen: A warning from the lint when running cargo clippy -- -W clippy::question_mark

Instead, this happened: There was no warning.

Version

rustc 1.94.0 (4a4ef493e 2026-03-02)
binary: rustc
commit-hash: 4a4ef493e3a1488c6e321570238084b38948f6db
commit-date: 2026-03-02
host: x86_64-unknown-linux-gnu
release: 1.94.0
LLVM version: 21.1.8

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn't

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions