Skip to content

Commit

Permalink
Improve wording of filter_map autocorrect safety in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Splines committed Apr 17, 2024
1 parent 6d72c73 commit bcc4f38
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/rubocop/cop/performance/map_compact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ module Performance
# This cop identifies places where `map { ... }.compact` can be replaced by `filter_map`.
#
# @safety
# This cop's autocorrection is unsafe because `map { ... }.compact` that is not
# compatible with `filter_map`.
# This cop's autocorrection is unsafe because `map { ... }.compact` might yield
# different results than `filter_map`. As illustrated in the example, `filter_map`
# also filters out falsy values, while `compact` only gets rid of `nil`.
#
# [source,ruby]
# ----
Expand Down

0 comments on commit bcc4f38

Please sign in to comment.