Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bool_assert_comparison improve the suggestion to include the expression #7598

Closed
xFrednet opened this issue Aug 25, 2021 · 2 comments · Fixed by #10218
Closed

bool_assert_comparison improve the suggestion to include the expression #7598

xFrednet opened this issue Aug 25, 2021 · 2 comments · Fixed by #10218
Assignees
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy L-style Lint: Belongs in the style lint group

Comments

@xFrednet
Copy link
Member

xFrednet commented Aug 25, 2021

The lint message for the bool_assert_comparison lint currently look like this:

warning: used `assert_eq!` with a literal bool
 --> src/main.rs:5:5
  |
5 |     assert_eq!(some_bool_expression, false);
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`

I think the suggestion can be improved to include the actual expression that should be put in the assert! instead of just having the placeholder ...

The text for the suggestion can be retrieved with functions from clippy_utils::source.

@xFrednet xFrednet added good-first-issue These issues are a good way to get started with Clippy C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-style Lint: Belongs in the style lint group labels Aug 25, 2021
@phansch
Copy link
Member

phansch commented Aug 26, 2021

@rustbot claim

@phansch phansch removed their assignment Aug 31, 2021
@ABouttefeux
Copy link
Contributor

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy L-style Lint: Belongs in the style lint group
Projects
None yet
3 participants