From b1e858bc76fef274bd3adad86c394c656acab0e9 Mon Sep 17 00:00:00 2001 From: Kashiwa <13825170+ksw2000@users.noreply.github.com> Date: Mon, 24 Feb 2025 15:12:05 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor:=20the=20value=20?= =?UTF-8?q?of=20map=20is=20unused=20in=20uniqueRouteStack=20(#3320)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com> --- helpers.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/helpers.go b/helpers.go index 7e9e202c..eea6b370 100644 --- a/helpers.go +++ b/helpers.go @@ -192,12 +192,10 @@ func (app *App) methodExistCustom(c CustomCtx) bool { // uniqueRouteStack drop all not unique routes from the slice func uniqueRouteStack(stack []*Route) []*Route { var unique []*Route - m := make(map[*Route]int) + m := make(map[*Route]struct{}) for _, v := range stack { if _, ok := m[v]; !ok { - // Unique key found. Record position and collect - // in result. - m[v] = len(unique) + m[v] = struct{}{} unique = append(unique, v) } }