Skip to content

Commit 07caefe

Browse files
committed
refactor: simplify getFields case
1 parent d96cf67 commit 07caefe

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

plugins/hls-explicit-record-fields-plugin/src/Ide/Plugin/ExplicitFields.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,8 @@ getRecCons expr@(unLoc -> app@(HsApp _ _ _)) =
577577
[ RecordInfoApp realSpan' appExpr | RealSrcSpan realSpan' _ <- [ getLoc expr ] ]
578578

579579
getFields :: HsExpr GhcTc -> [LHsExpr GhcTc] -> Maybe RecordAppExpr
580-
getFields (HsApp _ (unLoc -> (XExpr (ConLikeTc (conLikeFieldLabels -> fls) _ _))) _) _
581-
| null fls = Nothing
582580
getFields (HsApp _ constr@(unLoc -> (XExpr (ConLikeTc (conLikeFieldLabels -> fls) _ _))) arg) args
581+
| not (null fls)
583582
= Just (RecordAppExpr constr labelWithArgs)
584583
where labelWithArgs = zipWith mkLabelWithArg fls (arg : args)
585584
mkLabelWithArg label arg = (L (getLoc arg) label, unLoc arg)

0 commit comments

Comments
 (0)