@@ -179,25 +179,22 @@ p_match' placer render style isInfix strictness m_pats GRHSs {..} = do
179179 NoSrcStrict -> return ()
180180 SrcStrict -> txt "!"
181181 SrcLazy -> txt "~"
182− inci' <- case NE.nonEmpty m_pats of
183− Nothing -> id <$ case style of
182+ indentBody <- case NE.nonEmpty m_pats of
183+ Nothing -> False <$ case style of
184184 Function name -> p_rdrName name
185185 _ -> return ()
186186 Just ne_pats -> do
187187 let combinedSpans =
188188 combineSrcSpans' $
189189 getLoc <$> ne_pats
190− inci' =
191− if isOneLineSpan combinedSpans
192− then id
193− else inci
190+ indentBody = not (isOneLineSpan combinedSpans)
194191 switchLayout [combinedSpans] $ do
195192 let stdCase = sep breakpoint (located' p_pat) m_pats
196193 case style of
197194 Function name ->
198195 p_infixDefHelper
199196 isInfix
200− inci'
197+ indentBody
201198 (p_rdrName name)
202199 (located' p_pat <$> m_pats)
203200 PatternBind -> stdCase
@@ -212,7 +209,7 @@ p_match' placer render style isInfix strictness m_pats GRHSs {..} = do
212209 when needsSpace space
213210 sitcc stdCase
214211 LambdaCase -> stdCase
215− return inci'
212+ return indentBody
216213 let -- Calculate position of end of patterns. This is useful when we decide
217214 -- about putting certain constructions in hanging positions.
218215 endOfPats = case NE.nonEmpty m_pats of
@@ -224,7 +221,7 @@ p_match' placer render style isInfix strictness m_pats GRHSs {..} = do
224221 Case -> True
225222 LambdaCase -> True
226223 _ -> False
227− let hasGuards = withGuards grhssGRHSs
224+ hasGuards = withGuards grhssGRHSs
228225 grhssSpan =
229226 combineSrcSpans' $
230227 getGRHSSpan . unLoc <$> NE.fromList grhssGRHSs
@@ -253,7 +250,7 @@ p_match' placer render style isInfix strictness m_pats GRHSs {..} = do
253250 txt "where"
254251 unless whereIsEmpty breakpoint
255252 inci $ located grhssLocalBinds p_hsLocalBinds
256− inci' $ do
253+ inciIf indentBody $ do
257254 unless (length grhssGRHSs > 1) $
258255 case style of
259256 Function _ | hasGuards -> return ()
@@ -589,23 +586,20 @@ p_hsExpr' s = \case
589586 -- do-block or case expression it is not a good idea. It seems
590587 -- to be safe to always bump indentation when the function
591588 -- expression is parenthesised.
592− indent =
589+ doIndent =
593590 case func of
594− L _ (HsPar NoExtField _) -> inci
595− L _ (HsAppType NoExtField _ _) -> inci
596− L _ (HsMultiIf NoExtField _) -> inci
597− L spn _ ->
598− if isOneLineSpan spn
599− then inci
600− else id
591+ L _ (HsPar NoExtField _) -> True
592+ L _ (HsAppType NoExtField _ _) -> True
593+ L _ (HsMultiIf NoExtField _) -> True
594+ L spn _ -> isOneLineSpan spn
601595 ub <- getLayout <&> \case
602596 SingleLine -> useBraces
603597 MultiLine -> id
604598 ub $ do
605599 located func (p_hsExpr' s)
606600 breakpoint
607− indent $ sep breakpoint (located' p_hsExpr) initp
608− indent $ do
601+ inciIf doIndent $ sep breakpoint (located' p_hsExpr) initp
602+ inciIf doIndent $ do
609603 unless (null initp) breakpoint
610604 located lastp p_hsExpr
611605 Hanging -> do