Use the result of the comparison directly instead of an if/else

This commit is contained in:
Joseph C. Sible 2024-12-13 23:20:48 -05:00
parent 0ecaf2b5f1
commit 5adfea21ee
1 changed files with 1 additions and 3 deletions

View File

@ -5082,9 +5082,7 @@ checkExpansionWithRedirection params t =
T_FdRedirect id "1" (T_IoDuplicate _ _ _) -> return () T_FdRedirect id "1" (T_IoDuplicate _ _ _) -> return ()
T_FdRedirect id "" (T_IoDuplicate _ op _) | op `elem` [T_GREATAND (Id 0), T_Greater (Id 0)] -> emit id captureId True T_FdRedirect id "" (T_IoDuplicate _ op _) | op `elem` [T_GREATAND (Id 0), T_Greater (Id 0)] -> emit id captureId True
T_FdRedirect id str (T_IoFile _ op file) | str `elem` ["", "1"] && op `elem` [ T_DGREAT (Id 0), T_Greater (Id 0) ] -> T_FdRedirect id str (T_IoFile _ op file) | str `elem` ["", "1"] && op `elem` [ T_DGREAT (Id 0), T_Greater (Id 0) ] ->
if getLiteralString file == Just "/dev/null" emit id captureId $ getLiteralString file /= Just "/dev/null"
then emit id captureId False
else emit id captureId True
_ -> acc _ -> acc
emit redirectId captureId suggestTee = do emit redirectId captureId suggestTee = do