Skip to content

Commit 17e9b66

Browse files
N5N3aplavin
authored andcommitted
Ensure that empty! returns the input structarray
1 parent 5a7e683 commit 17e9b66

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

src/structarray.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ end
442442

443443
function Base.empty!(s::StructArray)
444444
foreachfield(empty!, s)
445+
return s
445446
end
446447

447448
function Base.sizehint!(s::StructArray, i::Integer)

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ end
436436

437437
@testset "empty" begin
438438
s = StructVector(a = [1, 2, 3], b = ["a", "b", "c"])
439-
empty!(s)
439+
@test empty!(s) === s
440440
@test isempty(s.a)
441441
@test isempty(s.b)
442442
end

0 commit comments

Comments
 (0)