]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/xml: remove unnecessary if conditions
authortengufromsky <nick27surgut@gmail.com>
Sun, 15 Apr 2018 16:08:56 +0000 (19:08 +0300)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sun, 15 Apr 2018 16:40:39 +0000 (16:40 +0000)
Fixes gosimple warning "if err != nil { return err };
return nil' can be simplified to 'return err"

Change-Id: Ibbc717fb066ff41ab35c481b6d44980ac809ae09
Reviewed-on: https://go-review.googlesource.com/107018
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/encoding/xml/xml.go

index 5a51d4c97979715827a4c4e2e0812fb7dd10bbae..fb52eec5f467c11706fde1a6a0bfa86d3955ef31 100644 (file)
@@ -1932,10 +1932,8 @@ func escapeText(w io.Writer, s []byte, escapeNewline bool) error {
                }
                last = i
        }
-       if _, err := w.Write(s[last:]); err != nil {
-               return err
-       }
-       return nil
+       _, err := w.Write(s[last:])
+       return err
 }
 
 // EscapeString writes to p the properly escaped XML equivalent
@@ -2018,10 +2016,8 @@ func emitCDATA(w io.Writer, s []byte) error {
                }
                s = s[i:]
        }
-       if _, err := w.Write(cdataEnd); err != nil {
-               return err
-       }
-       return nil
+       _, err := w.Write(cdataEnd)
+       return err
 }
 
 // procInst parses the `param="..."` or `param='...'`