@@ -61,19 +61,15 @@ formatOne mode config = \case
61 -- 101 is different from all the other exit codes we already use.
61 -- 101 is different from all the other exit codes we already use.
62 exitWith (ExitFailure 101)
62 exitWith (ExitFailure 101)
63 Just inputFile -> do
63 Just inputFile -> do
64− originalInput <- TIO.readFile inputFile
65− formattedInput <- ormoluFile config inputFile
64+ r <- ormoluFile config inputFile
66 case mode of
65 case mode of
68− TIO.putStr formattedInput
67+ TIO.putStr r
69− InPlace -> do
68+ InPlace ->
70− -- Only write when the contents have changed, in order to avoid
71− -- updating the modified timestamp if the file was already correctly
73− when (formattedInput /= originalInput) $
74− TIO.writeFile inputFile formattedInput
69+ TIO.writeFile inputFile r
75 Check -> do
70 Check -> do
76− when (formattedInput /= originalInput) $
71+ r' <- TIO.readFile inputFile
77 -- 100 is different to all the other exit code that are emitted
73 -- 100 is different to all the other exit code that are emitted
78 -- either from an 'OrmoluException' or from 'error' and
74 -- either from an 'OrmoluException' or from 'error' and
79 -- 'notImplemented'.
75 -- 'notImplemented'.