Skip to content

Commit 80cae16

Browse files
committed
Use isOneLineSpan
1 parent a4f0cb9 commit 80cae16

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Hint/Comment.hs

+4-6
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ isSingle comm@(L (anchor -> span) _) =
5454
-- * Not a whitespace comment "-- "
5555
isSingleSome :: LEpaComment -> Bool
5656
isSingleSome comm@(L (anchor -> span) _) =
57-
isOneLineRealSpan span
57+
isOneLineSpan (RealSrcSpan span GHC.Data.Strict.Nothing)
5858
&& not (isPointRealSpan span)
5959
&& not (isCommentMultiline comm || isHaddock comm || isCommentWhitespace comm)
6060

@@ -125,9 +125,7 @@ grab msg o@(L pos _) s2 =
125125
f s = if isCommentMultiline o then "{-" ++ s ++ "-}" else "--" ++ s
126126
in rawIdea Suggestion msg loc (f s1) (Just $ f s2) [] (refact loc $ f s2)
127127

128-
-- | 'True' if the span is known to straddle only one line.
129-
-- SEE: https://gitlab.haskell.org/ghc/ghc/-/blob/master/compiler/GHC/Types/SrcLoc.hs#L480-483
128+
-- | 'True' if the span is known to straddle only one line. GHC doesn't export
129+
-- isOneLineRealSpan.
130130
isOneLineRealSpan :: RealSrcSpan -> Bool
131-
isOneLineRealSpan span = line1 == line2 where
132-
line1 = srcLocLine $ realSrcSpanStart span
133-
line2 = srcLocLine $ realSrcSpanEnd span
131+
isOneLineRealSpan span = isOneLineSpan (RealSrcSpan span GHC.Data.Strict.Nothing)

0 commit comments

Comments
 (0)