diff --git a/doc/data/messages/c/consider-using-set-comprehension/bad.py b/doc/data/messages/c/consider-using-set-comprehension/bad.py new file mode 100644 index 0000000000..657a211627 --- /dev/null +++ b/doc/data/messages/c/consider-using-set-comprehension/bad.py @@ -0,0 +1,3 @@ +NUMBERS = [1, 2, 2, 3, 4, 4] + +UNIQUE_EVEN_NUMBERS = set([number for number in NUMBERS if number % 2 == 0]) # [consider-using-set-comprehension] diff --git a/doc/data/messages/c/consider-using-set-comprehension/good.py b/doc/data/messages/c/consider-using-set-comprehension/good.py new file mode 100644 index 0000000000..4914fc2b00 --- /dev/null +++ b/doc/data/messages/c/consider-using-set-comprehension/good.py @@ -0,0 +1,3 @@ +NUMBERS = [1, 2, 2, 3, 4, 4] + +UNIQUE_EVEN_NUMBERS = {number for number in NUMBERS if number % 2 == 0}