1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-03-19 21:10:15 +02:00

Remove unnecessary loop.

Loops were returning directly.

Fixes #181.
This commit is contained in:
Alec Thomas 2018-12-31 21:54:40 +11:00
parent c4bec47e7d
commit e27f19c12f

View File

@ -77,7 +77,15 @@ func (d *httpBodyContentTyper) Tokenise(options *TokeniseOptions, text string) (
} }
return func() Token { return func() Token {
for token := it(); token != EOF; token = it() { token := it()
if token == EOF {
if subIterator != nil {
return subIterator()
}
return EOF
}
switch { switch {
case token.Type == Name && strings.ToLower(token.Value) == "content-type": case token.Type == Name && strings.ToLower(token.Value) == "content-type":
{ {
@ -117,16 +125,7 @@ func (d *httpBodyContentTyper) Tokenise(options *TokeniseOptions, text string) (
} }
} }
return token return token
}
if subIterator != nil {
for token := subIterator(); token != EOF; token = subIterator() {
return token
}
}
return EOF
}, nil }, nil
} }