mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-08 17:11:00 +08:00
Use case matching instead of null
Using null followed by a head, tail, or a partial pattern match is an anti-pattern. Use case matching instead.
This commit is contained in:
@@ -329,12 +329,11 @@ getCurrentContexts = Ms.gets contextStack
|
|||||||
|
|
||||||
popContext = do
|
popContext = do
|
||||||
v <- getCurrentContexts
|
v <- getCurrentContexts
|
||||||
if not $ null v
|
case v of
|
||||||
then do
|
(a:r) -> do
|
||||||
let (a:r) = v
|
|
||||||
setCurrentContexts r
|
setCurrentContexts r
|
||||||
return $ Just a
|
return $ Just a
|
||||||
else
|
[] ->
|
||||||
return Nothing
|
return Nothing
|
||||||
|
|
||||||
pushContext c = do
|
pushContext c = do
|
||||||
|
Reference in New Issue
Block a user