From 712aebad6b6d79823f5c86ff7af1279429be05ff Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sat, 20 Jul 2019 03:50:34 +0200 Subject: [PATCH] Simplify code Use a single append call instead of a ranged for loop. --- mux.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mux.go b/mux.go index a2cd193e..26f9582a 100644 --- a/mux.go +++ b/mux.go @@ -111,10 +111,8 @@ func copyRouteConf(r routeConf) routeConf { c.regexp.queries = append(c.regexp.queries, copyRouteRegexp(q)) } - c.matchers = make([]matcher, 0, len(r.matchers)) - for _, m := range r.matchers { - c.matchers = append(c.matchers, m) - } + c.matchers = make([]matcher, len(r.matchers)) + copy(c.matchers, r.matchers) return c }