Skip to content

Commit

Permalink
Fix a bug in ignored-map-to-for-each
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfirth committed Sep 2, 2024
1 parent 1895321 commit 15fe086
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions default-recommendations/list-shortcuts-test.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,10 @@ test: "ignored map expression refactorable to for-each"
; comment after
(displayln "foo"))
------------------------------


test: "used map expression not refactorable to for-each"
------------------------------
(define (f func xs ys zs)
(map func xs ys zs))
------------------------------
2 changes: 1 addition & 1 deletion default-recommendations/list-shortcuts.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
(define-definition-context-refactoring-rule ignored-map-to-for-each
#:description "The result of this `map` expression is unused. Consider using `for-each` instead."
#:literals (map)
(~seq body-before ... (~and map-expr (map proc list ...)) body-after ...)
(~seq body-before ... (~and map-expr (map proc list ...)) body-after ...+)
(body-before ... (~replacement (for-each proc list ...) #:original map-expr) body-after ...))


Expand Down

0 comments on commit 15fe086

Please sign in to comment.