♻️ Refactor: the value of map is unused in uniqueRouteStack (#3320)

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
pull/3324/head
Kashiwa 2025-02-24 15:12:05 +08:00 committed by GitHub
parent 5b0a96e4f9
commit b1e858bc76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 4 deletions

View File

@ -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)
}
}