diff --git a/lib/rubocop/cop/performance/map_compact.rb b/lib/rubocop/cop/performance/map_compact.rb index 2bddcc2e9..34e4646c0 100644 --- a/lib/rubocop/cop/performance/map_compact.rb +++ b/lib/rubocop/cop/performance/map_compact.rb @@ -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] # ----