Skip to content

Commit

Permalink
Don't use :nodoc: when overriding public methods (#11096)
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil authored Sep 24, 2021
1 parent 02fea5e commit 9e9da00
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 26 deletions.
3 changes: 0 additions & 3 deletions src/array.cr
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ class Array(T)
equals?(other) { |x, y| x == y }
end

# :nodoc:
def ==(other)
false
end
Expand Down Expand Up @@ -1023,7 +1022,6 @@ class Array(T)
self
end

# :nodoc:
def inspect(io : IO) : Nil
to_s io
end
Expand Down Expand Up @@ -2159,7 +2157,6 @@ class Array(T)
end
end

# :nodoc:
def index(object, offset : Int = 0)
# Optimize for the case of looking for a byte in a byte slice
if T.is_a?(UInt8.class) &&
Expand Down
1 change: 0 additions & 1 deletion src/big/big_int.cr
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,6 @@ struct BigInt < Int
end
end

# :nodoc:
def digits(base = 10) : Array(Int32)
if self < 0
raise ArgumentError.new("Can't request digits of negative number")
Expand Down
1 change: 0 additions & 1 deletion src/compress/deflate/reader.cr
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ class Compress::Deflate::Reader < IO
initialize(@io, @sync_close, @dict)
end

# :nodoc:
def inspect(io : IO) : Nil
to_s(io)
end
Expand Down
1 change: 0 additions & 1 deletion src/compress/deflate/writer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class Compress::Deflate::Writer < IO
@closed
end

# :nodoc:
def inspect(io : IO) : Nil
to_s(io)
end
Expand Down
2 changes: 0 additions & 2 deletions src/crystal/datum.cr
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,10 @@ module Crystal
self[index_or_key]
end

# :nodoc:
def inspect(io : IO) : Nil
@raw.inspect(io)
end

# :nodoc:
def to_s(io : IO) : Nil
@raw.to_s(io)
end
Expand Down
1 change: 0 additions & 1 deletion src/enum.cr
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ struct Enum
value <=> other.value
end

# :nodoc:
def ==(other)
false
end
Expand Down
6 changes: 5 additions & 1 deletion src/indexable.cr
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,11 @@ module Indexable(T)
unsafe_fetch(random.rand(size))
end

# :nodoc:
# :inherit:
#
# If `self` is not empty and `n` is equal to 1, calls `sample(random)` exactly
# once. Thus, *random* will be left in a different state compared to the
# implementation in `Enumerable`.
def sample(n : Int, random = Random::DEFAULT) : Array(T)
return super unless n == 1

Expand Down
4 changes: 0 additions & 4 deletions src/io/memory.cr
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ class IO::Memory < IO
string
end

# :nodoc:
def read_byte : UInt8?
check_open

Expand All @@ -184,7 +183,6 @@ class IO::Memory < IO
end
end

# :nodoc:
def peek : Bytes
check_open

Expand All @@ -203,14 +201,12 @@ class IO::Memory < IO
end
end

# :nodoc:
def skip_to_end : Nil
check_open

@pos = @bytesize
end

# :nodoc:
def gets_to_end : String
return super if @encoding

Expand Down
2 changes: 0 additions & 2 deletions src/json/any.cr
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,10 @@ struct JSON::Any
as_h if @raw.is_a?(Hash)
end

# :nodoc:
def inspect(io : IO) : Nil
@raw.inspect(io)
end

# :nodoc:
def to_s(io : IO) : Nil
@raw.to_s(io)
end
Expand Down
1 change: 0 additions & 1 deletion src/log/metadata.cr
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ class Log::Metadata
true
end

# :nodoc:
def ==(other)
false
end
Expand Down
19 changes: 14 additions & 5 deletions src/range.cr
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,12 @@ struct Range(B, E)
includes?(value)
end

# :nodoc:
def to_s(io : IO) : Nil
@begin.try &.inspect(io)
io << (@exclusive ? "..." : "..")
@end.try &.inspect(io)
end

# :nodoc:
def inspect(io : IO) : Nil
to_s(io)
end
Expand Down Expand Up @@ -387,7 +385,11 @@ struct Range(B, E)
{% end %}
end

# :nodoc:
# :inherit:
#
# If `self` is not empty and `n` is equal to 1, calls `sample(random)` exactly
# once. Thus, *random* will be left in a different state compared to the
# implementation in `Enumerable`.
def sample(n : Int, random = Random::DEFAULT)
{% if B == Nil || E == Nil %}
{% raise "Can't sample an open range" %}
Expand All @@ -411,7 +413,6 @@ struct Range(B, E)
Range.new(@begin.clone, @end.clone, @exclusive)
end

# :nodoc:
def map(&block : B -> U) forall U
b = self.begin
e = self.end
Expand All @@ -427,7 +428,15 @@ struct Range(B, E)
end
end

# :nodoc:
# Returns the number of values in this range.
#
# If both the beginning and the end of this range are `Int`s, runs in constant
# time instead of linear.
#
# ```
# (3..8).size # => 5
# (3...8).size # => 6
# ```
def size
{% if B == Nil || E == Nil %}
{% raise "Can't calculate size of an open range" %}
Expand Down
1 change: 0 additions & 1 deletion src/slice.cr
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,6 @@ struct Slice(T)
self
end

# :nodoc:
def index(object, offset : Int = 0)
# Optimize for the case of looking for a byte in a byte slice
if T.is_a?(UInt8.class) &&
Expand Down
1 change: 0 additions & 1 deletion src/static_array.cr
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ struct StaticArray(T, N)
array
end

# :nodoc:
def index(object, offset : Int = 0)
# Optimize for the case of looking for a byte in a byte slice
if T.is_a?(UInt8.class) &&
Expand Down
2 changes: 0 additions & 2 deletions src/yaml/any.cr
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,10 @@ struct YAML::Any
@raw.as?(Bytes)
end

# :nodoc:
def inspect(io : IO) : Nil
@raw.inspect(io)
end

# :nodoc:
def to_s(io : IO) : Nil
@raw.to_s(io)
end
Expand Down

0 comments on commit 9e9da00

Please sign in to comment.