mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 21:05:08 +00:00
Improve B015 message (#8295)
This commit is contained in:
parent
81a2e74fe2
commit
aa90a425e0
2 changed files with 6 additions and 6 deletions
|
@ -32,8 +32,8 @@ impl Violation for UselessComparison {
|
||||||
#[derive_message_formats]
|
#[derive_message_formats]
|
||||||
fn message(&self) -> String {
|
fn message(&self) -> String {
|
||||||
format!(
|
format!(
|
||||||
"Pointless comparison. This comparison does nothing but waste CPU instructions. \
|
"Pointless comparison. Did you mean to assign a value? \
|
||||||
Either prepend `assert` or remove it."
|
Otherwise, prepend `assert` or remove it."
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs
|
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
|
1 | assert 1 == 1
|
||||||
2 |
|
2 |
|
||||||
|
@ -11,7 +11,7 @@ B015.py:3:1: B015 Pointless comparison. This comparison does nothing but waste C
|
||||||
5 | assert 1 in (1, 2)
|
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)
|
5 | assert 1 in (1, 2)
|
||||||
6 |
|
6 |
|
||||||
|
@ -19,7 +19,7 @@ B015.py:7:1: B015 Pointless comparison. This comparison does nothing but waste C
|
||||||
| ^^^^^^^^^^^ B015
|
| ^^^^^^^^^^^ 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)
|
15 | assert 1 in (1, 2)
|
||||||
16 |
|
16 |
|
||||||
|
@ -27,7 +27,7 @@ B015.py:17:5: B015 Pointless comparison. This comparison does nothing but waste
|
||||||
| ^^^^^^^^^^^ B015
|
| ^^^^^^^^^^^ 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:
|
23 | class TestClass:
|
||||||
24 | 1 == 1
|
24 | 1 == 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue