File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,18 @@ test: "used map expression not refactorable to for-each"
175175------------------------------
176176
177177
178+ test: "ignored map in begin0 refactorable to for-each "
179+ ------------------------------
180+ (define (f xs)
181+ (begin0 42
182+ (map add1 xs)))
183+ ==============================
184+ (define (f xs)
185+ (begin0 42
186+ (for-each add1 xs)))
187+ ------------------------------
188+
189+
178190test: "build-list with const refactorable to make-list "
179191------------------------------
180192(require racket/function
Original file line number Diff line number Diff line change 128128 (append arg ... ))
129129
130130
131- (define-definition-context-refactoring-rule ignored-map-to-for-each
132- #:description "The result of this `map` expression is unused. Consider using `for-each` instead. "
131+ (define-refactoring-rule ignored-map-to-for-each
132+ #:description
133+ "The result of this `map` expression is unused. Make that explicit with `for-each` instead. "
133134 #:literals (map)
134- (~seq body-before ... (~and map-expr (map proc list ... )) body-after ...+)
135- (body-before ... (~replacement (for-each proc list ... ) #:original map-expr) body-after ... ))
135+ (map proc list ... )
136+ #:when (equal? (syntax-property this-syntax 'expression-result ) 'ignored )
137+ (for-each proc list ... ))
136138
137139
138140(define-refactoring-rule build-list-const-to-make-list
You can’t perform that action at this time.
0 commit comments