Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ pub(crate) fn duplicate_value(checker: &Checker, set: &ast::ExprSet) {
},
value.range(),
);
diagnostic.secondary_annotation("Previous occurrence here", existing);
diagnostic.try_set_fix(|| {
edits::remove_member(&set.elts, index, checker.locator().contents()).map(
|edit| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs
---
B033 [*] Sets should not contain duplicate item `"value1"`
--> B033.py:4:35
--> B033.py:4:18
|
2 | # Errors.
3 | ###
4 | incorrect_set = {"value1", 23, 5, "value1"}
| ^^^^^^^^
| -------- ^^^^^^^^
| |
| Previous occurrence here
5 | incorrect_set = {1, 1, 2}
6 | incorrect_set_multiline = {
|
Expand All @@ -22,12 +24,14 @@ help: Remove duplicate item
7 | "value1",

B033 [*] Sets should not contain duplicate item `1`
--> B033.py:5:21
--> B033.py:5:18
|
3 | ###
4 | incorrect_set = {"value1", 23, 5, "value1"}
5 | incorrect_set = {1, 1, 2}
| ^
| - ^
| |
| Previous occurrence here
6 | incorrect_set_multiline = {
7 | "value1",
|
Expand All @@ -42,8 +46,12 @@ help: Remove duplicate item
8 | 23,

B033 [*] Sets should not contain duplicate item `"value1"`
--> B033.py:10:5
--> B033.py:7:5
|
5 | incorrect_set = {1, 1, 2}
6 | incorrect_set_multiline = {
7 | "value1",
| -------- Previous occurrence here
8 | 23,
9 | 5,
10 | "value1",
Expand All @@ -61,12 +69,14 @@ help: Remove duplicate item
12 | incorrect_set = {1, 1}

B033 [*] Sets should not contain duplicate item `1`
--> B033.py:13:21
--> B033.py:13:18
|
11 | # B033
12 | }
13 | incorrect_set = {1, 1}
| ^
| - ^
| |
| Previous occurrence here
14 | incorrect_set = {1, 1,}
15 | incorrect_set = {0, 1, 1,}
|
Expand All @@ -81,12 +91,14 @@ help: Remove duplicate item
16 | incorrect_set = {0, 1, 1}

B033 [*] Sets should not contain duplicate item `1`
--> B033.py:14:21
--> B033.py:14:18
|
12 | }
13 | incorrect_set = {1, 1}
14 | incorrect_set = {1, 1,}
| ^
| - ^
| |
| Previous occurrence here
15 | incorrect_set = {0, 1, 1,}
16 | incorrect_set = {0, 1, 1}
|
Expand All @@ -101,12 +113,14 @@ help: Remove duplicate item
17 | incorrect_set = {

B033 [*] Sets should not contain duplicate item `1`
--> B033.py:15:24
--> B033.py:15:21
|
13 | incorrect_set = {1, 1}
14 | incorrect_set = {1, 1,}
15 | incorrect_set = {0, 1, 1,}
| ^
| - ^
| |
| Previous occurrence here
16 | incorrect_set = {0, 1, 1}
17 | incorrect_set = {
|
Expand All @@ -121,12 +135,14 @@ help: Remove duplicate item
18 | 0,

B033 [*] Sets should not contain duplicate item `1`
--> B033.py:16:24
--> B033.py:16:21
|
14 | incorrect_set = {1, 1,}
15 | incorrect_set = {0, 1, 1,}
16 | incorrect_set = {0, 1, 1}
| ^
| - ^
| |
| Previous occurrence here
17 | incorrect_set = {
18 | 0,
|
Expand All @@ -141,10 +157,12 @@ help: Remove duplicate item
19 | 1,

B033 [*] Sets should not contain duplicate item `1`
--> B033.py:20:5
--> B033.py:19:5
|
17 | incorrect_set = {
18 | 0,
19 | 1,
| - Previous occurrence here
20 | 1,
| ^
21 | }
Expand All @@ -160,12 +178,14 @@ help: Remove duplicate item
22 | incorrect_set_multiline_with_comment = {

B033 [*] Sets should not contain duplicate items, but `False` and `0` has the same value
--> B033.py:22:28
--> B033.py:22:18
|
20 | 1,
21 | }
22 | incorrect_set = {False, 1, 0}
| ^
| ----- ^
| |
| Previous occurrence here
23 | incorrect_set_multiline_with_comment = {
24 | "value1",
|
Expand All @@ -180,8 +200,12 @@ help: Remove duplicate item
25 | 23,

B033 [*] Sets should not contain duplicate item `"value1"`
--> B033.py:27:5
--> B033.py:24:5
|
22 | incorrect_set = {False, 1, 0}
23 | incorrect_set_multiline_with_comment = {
24 | "value1",
| -------- Previous occurrence here
25 | 23,
26 | # B033
27 | "value1",
Expand Down