Skip to content

Commit e4067d2

Browse files
committed
Fix: Match the wording of the readme and report from wastedassign
1 parent 86f5e05 commit e4067d2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

testdata/src/a/a.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,28 @@ func noUseParams(params string) int {
2828

2929
func f(param int) int {
3030
println(param)
31-
useOutOfIf := 1212121 // want "wasted assignment"
31+
useOutOfIf := 1212121 // want "reassigned, but reassigned without using the value"
3232
ret := 0
3333
if false {
3434
useOutOfIf = 200 // want "reassigned, but never used afterwards"
3535
return 0
3636
} else if param == 100 {
37-
useOutOfIf = 100 // want "wasted assignment"
37+
useOutOfIf = 100 // want "reassigned, but reassigned without using the value"
3838
useOutOfIf = 201
3939
useOutOfIf = pa(useOutOfIf)
40-
useOutOfIf += 200 // want "wasted assignment"
40+
useOutOfIf += 200 // want "reassigned, but reassigned without using the value"
4141
} else {
4242
useOutOfIf = 100
4343
useOutOfIf += 100
4444
useOutOfIf = pa(useOutOfIf)
45-
useOutOfIf += 200 // want "wasted assignment"
45+
useOutOfIf += 200 // want "reassigned, but reassigned without using the value"
4646
}
4747

4848
if false {
4949
useOutOfIf = 200 // want "reassigned, but never used afterwards"
5050
return 0
5151
} else if param == 200 {
52-
useOutOfIf = 100 // want "wasted assignment"
52+
useOutOfIf = 100 // want "reassigned, but reassigned without using the value"
5353
useOutOfIf = 201
5454
useOutOfIf = pa(useOutOfIf)
5555
useOutOfIf += 200
@@ -92,10 +92,10 @@ func r(param int) int {
9292
} else if param == 100 {
9393
ret = useOutOfIf
9494
} else if param == 200 {
95-
useOutOfIf = 100 // want "wasted assignment"
95+
useOutOfIf = 100 // want "reassigned, but reassigned without using the value"
9696
useOutOfIf = 100
9797
useOutOfIf = pa(useOutOfIf)
98-
useOutOfIf += 200 // want "wasted assignment"
98+
useOutOfIf += 200 // want "reassigned, but reassigned without using the value"
9999
}
100100
useOutOfIf = 12
101101
println(useOutOfIf)
@@ -109,7 +109,7 @@ func mugen() {
109109
var i int
110110
var hoge int
111111
for {
112-
hoge = 5 // want "wasted assignment"
112+
hoge = 5 // want "reassigned, but reassigned without using the value"
113113
// break
114114
}
115115

wastedassign.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func (wr wastedReason) String() string {
155155
case noUseUntilReturn:
156156
return "reassigned, but never used afterwards"
157157
case reassignedSoon:
158-
return "wasted assignment"
158+
return "reassigned, but reassigned without using the value"
159159
case notWasted:
160160
return ""
161161
default:

0 commit comments

Comments
 (0)