Skip to content

Commit

Permalink
fix UnusedLetBind: account for inherit
Browse files Browse the repository at this point in the history
  • Loading branch information
Radvendii committed Nov 11, 2021
1 parent ecdd507 commit e51dbac
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Nix/Linter/Checks.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ checkUnusedLetBinding :: CheckBase
checkUnusedLetBinding warn e = [ (warn UnusedLetBind)
& setLoc loc
& note' varName name
| NLet_ _ binds usedIn <- [unFix e]
| NLet_ srcSpan binds usedIn <- [unFix e]
, (bind, others) <- choose binds
, NamedVar (StaticKey name :| []) _ loc <- [bind]
, all (noRef name) (values others)
, name `noRef` usedIn
, (name, loc) <- case bind of
NamedVar (StaticKey name :| []) _ loc -> [(name, loc)]
Inherit _ keys loc -> do
StaticKey name <- keys
[(name, loc)]
_ -> []
, noRef name $ Fix $ NLet_ srcSpan others usedIn
]

checkUnusedArg :: CheckBase
Expand Down

0 comments on commit e51dbac

Please sign in to comment.