Improve B015 message (#8295)

This commit is contained in:
Harutaka Kawamura 2023-10-28 20:18:02 +09:00 committed by GitHub
parent 81a2e74fe2
commit aa90a425e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -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."
) )
} }
} }

View file

@ -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