Skip to content

Commit 9062e85

Browse files
Remove fromJusts
1 parent a610a75 commit 9062e85

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

cardano-node/app/conformance-test-runner.hs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import qualified Data.List.NonEmpty as NonEmpty
3636
import Data.Map (Map)
3737
import qualified Data.Map as M
3838
import qualified Data.Map.Merge.Lazy as M
39-
import Data.Maybe (fromJust, isJust, isNothing)
39+
import Data.Maybe (fromJust, isNothing)
4040
import Data.Set (Set)
4141
import qualified Data.Set as S
4242
import Data.Traversable
@@ -122,9 +122,7 @@ indexUpdate res tree ix = case res of
122122
| ix == mempty -> ShrinkNoMore mempty
123123
-- A (local) test pass, i.e. shrunk input is not a property counterexample.
124124
-- If sibling nodes have been exhausted, rollback to the parent index.
125-
-- 'fromJust' is safe here because the only index without parent
126-
-- is the empty index.
127-
| otherwise -> tryContinueIndex (Ix.succ tree) (fromJust . Ix.parent) ix
125+
| otherwise -> tryContinueIndex (Ix.succ tree) (fold . Ix.parent) ix
128126
-- When the test fails, try to stretch.
129127
TestFailure -> tryContinueIndex (Ix.stretch tree) id ix
130128

@@ -225,10 +223,8 @@ main = do
225223
testRes == TestSuccess &&
226224
(isNothing inputIndex || inputIndex == Just mempty)
227225
case (optMinimalTestOutput opts, not isGlobalSuccess) of
228-
-- 'fromJust' is safe here because an index generated
229-
-- by 'indexUpdate' is always on the tree.
230-
(Just minimalTestFilePath, True) -> encodeFile minimalTestFilePath (fromJust (Ix.lookup ix tree))
231-
(Nothing, True) -> print $ encode $ fromJust (Ix.lookup ix tree)
226+
(Just minimalTestFilePath, True) -> encodeFile minimalTestFilePath (Ix.lookup ix tree)
227+
(Nothing, True) -> print $ encode $ Ix.lookup ix tree
232228
_ -> pure ()
233229
pure mempty
234230
exitWithStatus . Flags $ testResultToFlag testRes <> mightContinueShrinking

0 commit comments

Comments
 (0)