Skip to content

Commit

Permalink
Don't use isnothing
Browse files Browse the repository at this point in the history
  • Loading branch information
Drvi committed Aug 26, 2022
1 parent d0a038d commit ed43e09
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Parsers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ function Options(
push!(refs, comment)
cmt = ptrlen(comment)
end
if !isnothing(groupmark) && ((groupmark == decimal || isnumeric(groupmark)) || (delim == groupmark && !quoted) || (oq == groupmark) || (cq == groupmark))
if groupmark !== nothing && (groupmark == decimal || isnumeric(groupmark) || (delim == groupmark && !quoted) || (oq == groupmark) || (cq == groupmark))
throw(ArgumentError("`groupmark` cannot be a number, a quoting char, coincide with `decimal` and `delim` unless `quoted=true`."))
end
df = dateformat === nothing ? nothing : dateformat isa String ? Format(dateformat) : dateformat isa Dates.DateFormat ? Format(dateformat) : dateformat
return Options(refs, sent, ignorerepeated, ignoreemptylines, wh1 % UInt8, wh2 % UInt8, quoted, oq % UInt8, cq % UInt8, e % UInt8, del, decimal % UInt8, trues, falses, df, cmt, stripwhitespace || stripquoted, stripquoted, isnothing(groupmark) ? nothing : UInt8(groupmark))
return Options(refs, sent, ignorerepeated, ignoreemptylines, wh1 % UInt8, wh2 % UInt8, quoted, oq % UInt8, cq % UInt8, e % UInt8, del, decimal % UInt8, trues, falses, df, cmt, stripwhitespace || stripquoted, stripquoted, groupmark === nothing ? nothing : UInt8(groupmark))
end

Options(;
Expand Down
2 changes: 1 addition & 1 deletion src/floats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ end
@inline function parsedigits(::Type{T}, source, pos, len, b, code, options, digits::IntType, neg::Bool, startpos) where {T <: SupportedFloats, IntType}
x = zero(T)
ndigits = 0
has_groupmark = !isnothing(options.groupmark)
has_groupmark = options.groupmark !== nothing
# we already previously checked if `b` was decimal or a digit, so don't need to check explicitly again
if b != options.decimal
b -= UInt8('0')
Expand Down
2 changes: 1 addition & 1 deletion src/ints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ overflowval(::Type{T}) where {T <: Integer} = div(typemax(T) - T(9), T(10))
@inline function typeparser(::Type{T}, source, pos, len, b, code, options) where {T <: Integer}
x = zero(T)
neg = false
has_groupmark = !isnothing(options.groupmark)
has_groupmark = options.groupmark !== nothing
# start actual int parsing
neg = b == UInt8('-')
if neg || b == UInt8('+')
Expand Down

0 comments on commit ed43e09

Please sign in to comment.