Skip to content
Snippets Groups Projects
Commit c82fb934 authored by Sylvain Henry's avatar Sylvain Henry Committed by Marge Bot
Browse files

Hadrian: avoid allocations in WayUnit's Read instance (#19209)

parent c062fac0
No related branches found
No related tags found
No related merge requests found
...@@ -27,8 +27,15 @@ instance Show WayUnit where ...@@ -27,8 +27,15 @@ instance Show WayUnit where
Logging -> "l" Logging -> "l"
Dynamic -> "dyn" Dynamic -> "dyn"
-- TODO: get rid of non-derived Read instance
instance Read WayUnit where instance Read WayUnit where
readsPrec _ s = [(unit, "") | unit <- [minBound ..], show unit == s] readsPrec _ = \case
"thr" -> [(Threaded,"")]
"debug" -> [(Debug,"")]
"p" -> [(Profiling,"")]
"l" -> [(Logging,"")]
"dyn" -> [(Dynamic,"")]
_ -> []
-- | Collection of 'WayUnit's that stands for the different ways source code -- | Collection of 'WayUnit's that stands for the different ways source code
-- is to be built. -- is to be built.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment