Skip to content

Commit

Permalink
[Docs] Tweak the doc for Performance/RangeInclude
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Aug 13, 2023
1 parent f33d0ce commit 728c964
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/rubocop/cop/performance/range_include.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ module Performance
# @safety
# This cop is unsafe because `Range#include?` (or `Range#member?`) and `Range#cover?`
# are not equivalent behavior.
# Example of a case where `Range#cover?` may not provide the desired result:
#
# [source,ruby]
# ----
# ('a'..'z').cover?('yellow') # => true
# ----
#
# @example
# # bad
Expand All @@ -20,11 +26,6 @@ module Performance
#
# # good
# ('a'..'z').cover?('b') # => true
#
# # Example of a case where `Range#cover?` may not provide
# # the desired result:
#
# ('a'..'z').cover?('yellow') # => true
class RangeInclude < Base
extend AutoCorrector

Expand Down

0 comments on commit 728c964

Please sign in to comment.