-
Notifications
You must be signed in to change notification settings - Fork 11
New rule: fuse-map-with-for #764
Copy link
Copy link
Closed
Labels
autopilot-candidateThe Copilot Agent should attempt this during a scheduled Autopilot runThe Copilot Agent should attempt this during a scheduled Autopilot runnew lintIssues suggesting new lints or pull requests implementing new lintsIssues suggesting new lints or pull requests implementing new lints
Metadata
Metadata
Assignees
Labels
autopilot-candidateThe Copilot Agent should attempt this during a scheduled Autopilot runThe Copilot Agent should attempt this during a scheduled Autopilot runnew lintIssues suggesting new lints or pull requests implementing new lintsIssues suggesting new lints or pull requests implementing new lints
Rule summary
A
mapexpression that produces a list which is immediately iterated over by afor*loop can be fused with thefor*loop, if the intermediate list isn't used elsewhere. This avoids constructing the intermediate list and is usually more readable. This should only be applied when themapexpression is given a short lambda.Test case
No-change test case
Additional context
Spotted this here in racket/drracket#783.