Skip to content

Manual assert_eq! (enhance if_then_panic) #7716

Open
@camsteffen

Description

@camsteffen

We just added if_then_panic, but then I realized there's a possible enhancement for assert_eq!/assert_ne!:

// before
if a != b {
    panic!("hi");
}
// after
assert_eq!(a, b, "hi");

I think a rename to manual_assert would be best. But we could also keep the current name (it still kinda makes sense) or create a new lint for this case.

Metadata

Metadata

Assignees

Labels

C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesgood 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