]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/pprof/internal/profile: use idiomatic swapping
authorIskander Sharipov <quasilyte@gmail.com>
Mon, 26 Nov 2018 08:40:32 +0000 (11:40 +0300)
committerBryan C. Mills <bcmills@google.com>
Sat, 2 Mar 2019 05:10:52 +0000 (05:10 +0000)
gogrep found only one such case with the pattern below:

$tmp := $x; $x = $y; $y = $tmp

R=1.13

Change-Id: I6e46fb5ef2887f24fa9fc451323a8cef272e2886
Reviewed-on: https://go-review.googlesource.com/c/151200
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/runtime/pprof/internal/profile/profile.go

index a6f8354b1e8ccf4242ec4c1a90faa815591324e2..443accdd6d3f256eda3d73784a1f93088c369819 100644 (file)
@@ -211,9 +211,7 @@ func (p *Profile) setMain() {
                        continue
                }
                // Swap what we guess is main to position 0.
-               tmp := p.Mapping[i]
-               p.Mapping[i] = p.Mapping[0]
-               p.Mapping[0] = tmp
+               p.Mapping[i], p.Mapping[0] = p.Mapping[0], p.Mapping[i]
                break
        }
 }