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 @@ -897,23 +897,13 @@ end
897
897
# # from general iterable to any array
898
898
899
899
function copyto! (dest:: AbstractArray , src)
900
- if haslength (src)
901
- length (dest) < length (src) &&
900
+ destiter = eachindex (dest)
901
+ y = iterate (destiter)
902
+ for x in src
903
+ y === nothing &&
902
904
throw (ArgumentError (" destination has fewer elements than required" ))
903
- i = Int (firstindex (dest))
904
- @inbounds for x in src
905
- dest[i] = x
906
- i += 1
907
- end
908
- else
909
- destiter = eachindex (dest)
910
- y = iterate (destiter)
911
- for x in src
912
- y === nothing &&
913
- throw (ArgumentError (" destination has fewer elements than required" ))
914
- dest[y[1 ]] = x
915
- y = iterate (destiter, y[2 ])
916
- end
905
+ dest[y[1 ]] = x
906
+ y = iterate (destiter, y[2 ])
917
907
end
918
908
return dest
919
909
end
You can’t perform that action at this time.
0 commit comments