cln: hlint: Fix redundant return warning.

This commit is contained in:
Stephen Morgan 2021-08-16 16:54:58 +10:00 committed by Simon Michael
parent 8bf7cd30ae
commit 1c211f8ab8
6 changed files with 3 additions and 9 deletions

View File

@ -50,7 +50,6 @@
- ignore: {name: "Redundant bang pattern"} - ignore: {name: "Redundant bang pattern"}
- ignore: {name: "Use zipWith"} - ignore: {name: "Use zipWith"}
- ignore: {name: "Replace case with maybe"} - ignore: {name: "Replace case with maybe"}
- ignore: {name: "Redundant return"}
- ignore: {name: "Avoid lambda using `infix`"} - ignore: {name: "Avoid lambda using `infix`"}
- ignore: {name: "Use <|>"} - ignore: {name: "Use <|>"}
- ignore: {name: "Use zip"} - ignore: {name: "Use zip"}

View File

@ -986,7 +986,6 @@ lotpricep = label "ledger-style lot price" $ do
lift skipNonNewlineSpaces lift skipNonNewlineSpaces
char '}' char '}'
when (doublebrace) $ void $ char '}' when (doublebrace) $ void $ char '}'
return ()
-- Parse a Ledger-style lot date [DATE], and ignore it. -- Parse a Ledger-style lot date [DATE], and ignore it.
-- https://www.ledger-cli.org/3.0/doc/ledger3.html#Fixing-Lot-Prices . -- https://www.ledger-cli.org/3.0/doc/ledger3.html#Fixing-Lot-Prices .

View File

@ -1266,8 +1266,7 @@ csvFieldValue :: CsvRules -> CsvRecord -> CsvFieldName -> Maybe Text
csvFieldValue rules record fieldname = do csvFieldValue rules record fieldname = do
fieldindex <- if | T.all isDigit fieldname -> readMay $ T.unpack fieldname fieldindex <- if | T.all isDigit fieldname -> readMay $ T.unpack fieldname
| otherwise -> lookup (T.toLower fieldname) $ rcsvfieldindexes rules | otherwise -> lookup (T.toLower fieldname) $ rcsvfieldindexes rules
fieldvalue <- T.strip <$> atMay record (fieldindex-1) T.strip <$> atMay record (fieldindex-1)
return fieldvalue
-- | Parse the date string using the specified date-format, or if unspecified -- | Parse the date string using the specified date-format, or if unspecified
-- the "simple date" formats (YYYY/MM/DD, YYYY-MM-DD, YYYY.MM.DD, leading -- the "simple date" formats (YYYY/MM/DD, YYYY-MM-DD, YYYY.MM.DD, leading

View File

@ -134,9 +134,8 @@ words' :: String -> [String]
words' "" = [] words' "" = []
words' s = map stripquotes $ fromparse $ parsewithString p s words' s = map stripquotes $ fromparse $ parsewithString p s
where where
p = do ss <- (singleQuotedPattern <|> doubleQuotedPattern <|> patterns) `sepBy` skipNonNewlineSpaces1 p = (singleQuotedPattern <|> doubleQuotedPattern <|> patterns) `sepBy` skipNonNewlineSpaces1
-- eof -- eof
return ss
patterns = many (noneOf whitespacechars) patterns = many (noneOf whitespacechars)
singleQuotedPattern = between (char '\'') (char '\'') (many $ noneOf "'") singleQuotedPattern = between (char '\'') (char '\'') (many $ noneOf "'")
doubleQuotedPattern = between (char '"') (char '"') (many $ noneOf "\"") doubleQuotedPattern = between (char '"') (char '"') (many $ noneOf "\"")

View File

@ -35,7 +35,6 @@ main = do
let rates = [0.70, 0.71 .. 1.3] let rates = [0.70, 0.71 .. 1.3]
mapM_ (\(n,d,(a,b),c,p) -> putStr $ showtxn n d a b c p) $ take numtxns $ zip5 [1..] dates accts comms (drop 1 comms) mapM_ (\(n,d,(a,b),c,p) -> putStr $ showtxn n d a b c p) $ take numtxns $ zip5 [1..] dates accts comms (drop 1 comms)
mapM_ (\(d,rate) -> putStr $ showmarketprice d rate) $ take numtxns $ zip dates (cycle $ rates ++ init (tail (reverse rates))) mapM_ (\(d,rate) -> putStr $ showmarketprice d rate) $ take numtxns $ zip dates (cycle $ rates ++ init (tail (reverse rates)))
return ()
showtxn :: Int -> Day -> String -> String -> Char -> Char -> String showtxn :: Int -> Day -> String -> String -> Char -> Char -> String
showtxn txnno date acct1 acct2 comm pricecomm = showtxn txnno date acct1 acct2 comm pricecomm =

View File

@ -20,7 +20,6 @@ main = do
today <- getCurrentDay today <- getCurrentDay
let startdate = addDays (-numentries) today let startdate = addDays (-numentries) today
mapM_ (putStr . showentry) [startdate..today] mapM_ (putStr . showentry) [startdate..today]
return ()
showentry d = showentry d =
printf "i %s 09:00:00 dummy\no %s 17:00:00\n" (show d) (show d) printf "i %s 09:00:00 dummy\no %s 17:00:00\n" (show d) (show d)