Skip to content

Add lints to encourage use of specialized assert macrosΒ #13252

@Reisz

Description

@Reisz

What it does

Detect assert!(a == b) and assert!(a != b) and suggest using assert_eq! or assert_ne! respectively.

Should probably apply to debug_assert! as well.

Advantage

  • The specialized asserts provide more info in their error messages

Drawbacks

No response

Example

assert!(fib(6) == 8);

Could be written as:

assert_eq!(fib(6), 8);

Metadata

Metadata

Assignees

Labels

A-lintArea: New lints

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions