Skip to content

Commit e57501c

Browse files
authored
minor code quality improvements (#39159)
1 parent 1393310 commit e57501c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

base/accumulate.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ function _accumulate1!(op, B, v1, A::AbstractVector, dim::Integer)
441441
inds = LinearIndices(A)
442442
inds == LinearIndices(B) || throw(DimensionMismatch("LinearIndices of A and B don't match"))
443443
dim > 1 && return copyto!(B, A)
444-
(i1, state) = iterate(inds) # We checked earlier that A isn't empty
444+
(i1, state) = iterate(inds)::NTuple{2,Any} # We checked earlier that A isn't empty
445445
cur_val = v1
446446
B[i1] = cur_val
447447
next = iterate(inds, state)

base/toml_parser.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,9 +658,12 @@ end
658658

659659
function push!!(v::Vector, el)
660660
T = eltype(v)
661-
if el isa T || typeof(el) === T
661+
t = typeof(el)
662+
if el isa T || t === T
662663
push!(v, el::T)
663664
return v
665+
elseif T === Union{}
666+
return t[el]
664667
else
665668
if typeof(T) === Union
666669
newT = Any

0 commit comments

Comments
 (0)