Skip to content

Commit

Permalink
Use proper place to put doc change
Browse files Browse the repository at this point in the history
  • Loading branch information
Splines committed Apr 17, 2024
1 parent 9e56302 commit 8e6c461
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions docs/modules/ROOT/pages/cops_performance.adoc
Expand Up @@ -1169,9 +1169,8 @@ This cop identifies places where `map { ... }.compact` can be replaced by `filte
=== Safety
This cop's autocorrection is unsafe because `map { ... }.compact` might yield
different results than `filter_map`. As seen in the example above, `filter_map`
also filters out falsy values, while `compact` only gets rid of `nil`.
This cop's autocorrection is unsafe because `map { ... }.compact` that is not
compatible with `filter_map`.
=== Examples
Expand Down
5 changes: 3 additions & 2 deletions lib/rubocop/cop/performance/map_compact.rb
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 8e6c461

Please sign in to comment.