File tree Expand file tree Collapse file tree 1 file changed +6
-16
lines changed Expand file tree Collapse file tree 1 file changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -891,23 +891,13 @@ end
891
891
# # from general iterable to any array
892
892
893
893
function copyto! (dest:: AbstractArray , src)
894
- if haslength (src)
895
- length (dest) < length (src) &&
894
+ destiter = eachindex (dest)
895
+ y = iterate (destiter)
896
+ for x in src
897
+ y === nothing &&
896
898
throw (ArgumentError (" destination has fewer elements than required" ))
897
- i = Int (firstindex (dest))
898
- @inbounds for x in src
899
- dest[i] = x
900
- i += 1
901
- end
902
- else
903
- destiter = eachindex (dest)
904
- y = iterate (destiter)
905
- for x in src
906
- y === nothing &&
907
- throw (ArgumentError (" destination has fewer elements than required" ))
908
- dest[y[1 ]] = x
909
- y = iterate (destiter, y[2 ])
910
- end
899
+ dest[y[1 ]] = x
900
+ y = iterate (destiter, y[2 ])
911
901
end
912
902
return dest
913
903
end
You can’t perform that action at this time.
0 commit comments