Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.0.1-2020.1.5 / simple / testdata / src / if-return / if-return.go
1 package pkg
2
3 func fn() bool { return true }
4 func fn1() bool {
5         x := true
6         if x { // want `should use 'return x'`
7                 return true
8         }
9         return false
10 }
11
12 func fn2() bool {
13         x := true
14         if !x {
15                 return true
16         }
17         if x {
18                 return true
19         }
20         return false
21 }
22
23 func fn3() int {
24         var x bool
25         if x {
26                 return 1
27         }
28         return 2
29 }
30
31 func fn4() bool { return true }
32
33 func fn5() bool {
34         if fn() { // want `should use 'return !fn\(\)'`
35                 return false
36         }
37         return true
38 }
39
40 func fn6() bool {
41         if fn3() != fn3() { // want `should use 'return fn3\(\) != fn3\(\)'`
42                 return true
43         }
44         return false
45 }
46
47 func fn7() bool {
48         if 1 > 2 { // want `should use 'return 1 > 2'`
49                 return true
50         }
51         return false
52 }
53
54 func fn8() bool {
55         if fn() || fn() {
56                 return true
57         }
58         return false
59 }
60
61 func fn9(x int) bool {
62         if x > 0 {
63                 return true
64         }
65         return true
66 }
67
68 func fn10(x int) bool {
69         if x > 0 { // want `should use 'return x <= 0'`
70                 return false
71         }
72         return true
73 }
74
75 func fn11(x bool) bool {
76         if x { // want `should use 'return !x'`
77                 return false
78         }
79         return true
80 }
81
82 func fn12() bool {
83         var x []bool
84         if x[0] { // want `should use 'return !x\[0\]'`
85                 return false
86         }
87         return true
88 }
89
90 func fn13(a, b int) bool {
91         if a != b { // want `should use 'return a == b' instead of 'if a != b`
92                 return false
93         }
94         return true
95 }