summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-08-30 13:23:21 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-08-30 13:23:21 -0400
commita64c16bf7d6cf3ba5295a23496e10ed70c1656dc (patch)
tree0992823d20075951b74bf37a782a36f312a56f92
parent5ef11350aafe2aec48f66799743423a9c6e42556 (diff)
tweak
-rw-r--r--Backend.hs7
-rw-r--r--Utility/DataUnits.hs3
2 files changed, 4 insertions, 6 deletions
diff --git a/Backend.hs b/Backend.hs
index 0bb9f4b57..75327de80 100644
--- a/Backend.hs
+++ b/Backend.hs
@@ -122,8 +122,7 @@ lookupBackendName s = fromMaybe unknown $ maybeLookupBackendName s
where
unknown = error $ "unknown backend " ++ s
maybeLookupBackendName :: String -> Maybe (Backend Annex)
-maybeLookupBackendName s =
- if 1 /= length matches
- then Nothing
- else Just $ head matches
+maybeLookupBackendName s
+ | length matches == 1 = Just $ head matches
+ | otherwise = Nothing
where matches = filter (\b -> s == B.name b) list
diff --git a/Utility/DataUnits.hs b/Utility/DataUnits.hs
index f2bc333ea..0baa5dd89 100644
--- a/Utility/DataUnits.hs
+++ b/Utility/DataUnits.hs
@@ -137,8 +137,7 @@ compareSizes units abbrev old new
{- Parses strings like "10 kilobytes" or "0.5tb". -}
readSize :: [Unit] -> String -> Maybe ByteSize
readSize units input
- | null parsednum = Nothing
- | null parsedunit = Nothing
+ | null parsednum || null parsedunit = Nothing
| otherwise = Just $ round $ number * fromIntegral multiplier
where
(number, rest) = head parsednum