Skip to content

Commit

Permalink
Improve B015 message (#8295)
Browse files Browse the repository at this point in the history
  • Loading branch information
harupy authored Oct 28, 2023
1 parent 81a2e74 commit aa90a42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ impl Violation for UselessComparison {
#[derive_message_formats]
fn message(&self) -> String {
format!(
"Pointless comparison. This comparison does nothing but waste CPU instructions. \
Either prepend `assert` or remove it."
"Pointless comparison. Did you mean to assign a value? \
Otherwise, prepend `assert` or remove it."
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs
---
B015.py:3:1: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
B015.py:3:1: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it.
|
1 | assert 1 == 1
2 |
Expand All @@ -11,23 +11,23 @@ B015.py:3:1: B015 Pointless comparison. This comparison does nothing but waste C
5 | assert 1 in (1, 2)
|

B015.py:7:1: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
B015.py:7:1: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it.
|
5 | assert 1 in (1, 2)
6 |
7 | 1 in (1, 2)
| ^^^^^^^^^^^ B015
|

B015.py:17:5: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
B015.py:17:5: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it.
|
15 | assert 1 in (1, 2)
16 |
17 | 1 in (1, 2)
| ^^^^^^^^^^^ B015
|

B015.py:24:5: B015 Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend `assert` or remove it.
B015.py:24:5: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend `assert` or remove it.
|
23 | class TestClass:
24 | 1 == 1
Expand Down

0 comments on commit aa90a42

Please sign in to comment.