mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-08 05:51:09 -07:00
Remove unnecessary uses of head
This commit is contained in:
parent
c95914f9b3
commit
6d06103cab
5 changed files with 14 additions and 15 deletions
|
@ -186,12 +186,12 @@ getNextIdSpanningTokens startTok endTok = do
|
|||
|
||||
-- Get an ID starting from the first token of the list, and ending after the last
|
||||
getNextIdSpanningTokenList list =
|
||||
if null list
|
||||
then do
|
||||
case list of
|
||||
[] -> do
|
||||
pos <- getPosition
|
||||
getNextIdBetween pos pos
|
||||
else
|
||||
getNextIdSpanningTokens (head list) (last list)
|
||||
(h:_) ->
|
||||
getNextIdSpanningTokens h (last list)
|
||||
|
||||
-- Get the span covered by an id
|
||||
getSpanForId :: Monad m => Id -> SCParser m (SourcePos, SourcePos)
|
||||
|
@ -1826,7 +1826,7 @@ readPendingHereDocs = do
|
|||
let thereIsNoTrailer = null trailingSpace && null trailer
|
||||
let leaderIsOk = null leadingSpace
|
||||
|| dashed == Dashed && leadingSpacesAreTabs
|
||||
let trailerStart = if null trailer then '\0' else head trailer
|
||||
let trailerStart = case trailer of [] -> '\0'; (h:_) -> h
|
||||
let hasTrailingSpace = not $ null trailingSpace
|
||||
let hasTrailer = not $ null trailer
|
||||
let ppt = parseProblemAt trailerPos ErrorC
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue