Skip to content

Commit f584e37

Browse files
Hongbo LiJuliaLawall
authored andcommitted
coccinelle: Remove unnecessary parentheses for only one possible change.
The parentheses are only needed if there is a disjunction, ie a set of possible changes. If there is only one pattern, we can remove these parentheses. Just like the format: - x + y not: ( - x + y ) Signed-off-by: Hongbo Li <lihongbo22@huawei.com> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
1 parent 253244c commit f584e37

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

scripts/coccinelle/api/string_choices.cocci

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,14 @@ coccilib.report.print_report(p[0], "opportunity for str_plural(%s)" % e)
4343
@str_up_down depends on patch@
4444
expression E;
4545
@@
46-
(
4746
- ((E) ? "up" : "down")
4847
+ str_up_down(E)
49-
)
5048

5149
@str_up_down_r depends on !patch exists@
5250
expression E;
5351
position P;
5452
@@
55-
(
5653
* ((E@P) ? "up" : "down")
57-
)
5854

5955
@script:python depends on report@
6056
p << str_up_down_r.P;
@@ -66,18 +62,14 @@ coccilib.report.print_report(p[0], "opportunity for str_up_down(%s)" % e)
6662
@str_down_up depends on patch@
6763
expression E;
6864
@@
69-
(
7065
- ((E) ? "down" : "up")
7166
+ str_down_up(E)
72-
)
7367

7468
@str_down_up_r depends on !patch exists@
7569
expression E;
7670
position P;
7771
@@
78-
(
7972
* ((E@P) ? "down" : "up")
80-
)
8173

8274
@script:python depends on report@
8375
p << str_down_up_r.P;

0 commit comments

Comments
 (0)