Skip to content

panic_in_result_fn shouldn't fire on todo!()/unimplemented!()/unreachable!() #11025

Closed
@tgross35

Description

@tgross35

Summary

panic_in_result_fn fires on panic!, unimplemented!, todo!, and unreachable!. panic,unimplemented, and unreachable all make since since they represent "final" code. Linting on todo! doesn't really make sense in this group however, since it usually represents a work in progress - firing on todo!() code is just noisy.

Lint Name

panic_in_result_fn

Reproducer

I tried this code:

#![warn(clippy::panic_in_result_fn)]
fn foo() -> Result<(), ()> { todo!() }

I saw this happen:

[<output>](warning: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`)
...

I expected to see this happen:

No lint

Version

rustc 1.72.0-nightly (871b59520 2023-05-31)

Additional Labels

No response

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't havegood first issueThese issues are a good way to get started with Clippy

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions