From d585f83e1c3757e1a1edf2802abfa6171b5234f3 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 13 May 2026 19:30:27 +0300 Subject: refactor: make receiver types consistent per type (pointer receivers) fileRankHeap Len/Less/Swap converted to pointer receivers to match Push/Pop; bubbleChart HasNodes and AnimationState Settled converted to pointer receivers to match all other methods on their types. Co-Authored-By: Claude Sonnet 4.6 --- internal/statsengine/filerank.go | 16 ++++++++-------- internal/tui/dashboard/bubbles.go | 2 +- internal/tui/flamegraph/animation.go | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'internal') diff --git a/internal/statsengine/filerank.go b/internal/statsengine/filerank.go index a397381..79213ed 100644 --- a/internal/statsengine/filerank.go +++ b/internal/statsengine/filerank.go @@ -217,19 +217,19 @@ func betterFileRank(a, b *fileRankStats) bool { return a.path < b.path } -func (h fileRankHeap) Len() int { - return len(h) +func (h *fileRankHeap) Len() int { + return len(*h) } -func (h fileRankHeap) Less(i, j int) bool { +func (h *fileRankHeap) Less(i, j int) bool { // Keep the worst-ranked item at root for O(log N) eviction. - return betterFileRank(h[j], h[i]) + return betterFileRank((*h)[j], (*h)[i]) } -func (h fileRankHeap) Swap(i, j int) { - h[i], h[j] = h[j], h[i] - h[i].heapIndex = i - h[j].heapIndex = j +func (h *fileRankHeap) Swap(i, j int) { + (*h)[i], (*h)[j] = (*h)[j], (*h)[i] + (*h)[i].heapIndex = i + (*h)[j].heapIndex = j } func (h *fileRankHeap) Push(x any) { diff --git a/internal/tui/dashboard/bubbles.go b/internal/tui/dashboard/bubbles.go index 8f9b745..96ebea1 100644 --- a/internal/tui/dashboard/bubbles.go +++ b/internal/tui/dashboard/bubbles.go @@ -377,7 +377,7 @@ func (c *bubbleChart) MoveSelection(delta int) bool { return true } -func (c bubbleChart) HasNodes() bool { +func (c *bubbleChart) HasNodes() bool { return len(c.nodes) > 0 } diff --git a/internal/tui/flamegraph/animation.go b/internal/tui/flamegraph/animation.go index 103d43b..2bebba3 100644 --- a/internal/tui/flamegraph/animation.go +++ b/internal/tui/flamegraph/animation.go @@ -126,7 +126,7 @@ func (a *AnimationState) CurrentFrames() []tuiFrame { } // Settled reports whether all active springs are at rest. -func (a AnimationState) Settled() bool { +func (a *AnimationState) Settled() bool { return a.settled } -- cgit v1.2.3