mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 02:31:04 +01:00
Remove redundant nil check (#2194)
From the Go docs: "If the map is nil, the number of iterations is 0." [1] Therefore, an additional nil check for before the loop is unnecessary. [1]: https://go.dev/ref/spec#For_range Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
parent
9f53d15133
commit
6a449876e9
|
@ -244,7 +244,6 @@ func (w *ResponseRecorder) CopyTo(res ResponseWriter) {
|
|||
}
|
||||
|
||||
// append the headers
|
||||
if w.headers != nil {
|
||||
for k, values := range w.headers {
|
||||
for _, v := range values {
|
||||
if to.headers.Get(v) == "" {
|
||||
|
@ -252,7 +251,6 @@ func (w *ResponseRecorder) CopyTo(res ResponseWriter) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// append the body
|
||||
if len(w.chunks) > 0 {
|
||||
|
|
|
@ -319,7 +319,6 @@ func (w *responseWriter) CopyTo(to ResponseWriter) {
|
|||
}
|
||||
|
||||
// append the headers
|
||||
if w.Header() != nil {
|
||||
for k, values := range w.Header() {
|
||||
for _, v := range values {
|
||||
if to.Header().Get(v) == "" {
|
||||
|
@ -327,7 +326,6 @@ func (w *responseWriter) CopyTo(to ResponseWriter) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// the body is not copied, this writer doesn't support recording
|
||||
}
|
||||
|
||||
|
|
|
@ -282,12 +282,10 @@ func (s *JetEngine) initSet() {
|
|||
}
|
||||
|
||||
s.Set = jet.NewSet(s.loader, opts...)
|
||||
if s.vars != nil {
|
||||
for key, value := range s.vars {
|
||||
s.Set.AddGlobal(key, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
s.mu.Unlock()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user