From 12f405723d7b7d2845fe716a8607834996be2a85 Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Fri, 25 Aug 2023 00:17:44 +0800 Subject: [PATCH] refactor: remove redundant nil check in `flush` (#812) 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 --- standard_renderer.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/standard_renderer.go b/standard_renderer.go index c6a1b61..0f282d8 100644 --- a/standard_renderer.go +++ b/standard_renderer.go @@ -208,10 +208,8 @@ func (r *standardRenderer) flush() { // Merge the set of lines we're skipping as a rendering optimization with // the set of lines we've explicitly asked the renderer to ignore. - if r.ignoreLines != nil { - for k, v := range r.ignoreLines { - skipLines[k] = v - } + for k, v := range r.ignoreLines { + skipLines[k] = v } // Paint new lines