Skip to content

Commit

Permalink
Clean up inner loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ttencate committed Jan 21, 2025
1 parent c801b5d commit 26b20d3
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions godot-core/src/builtin/collections/packed_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use godot_ffi as sys;
use crate::builtin::*;
use crate::meta::{AsArg, ToGodot};
use std::mem::{size_of, MaybeUninit};
use std::{fmt, ops, ptr};
use std::{fmt, iter, ops, ptr};
use sys::types::*;
use sys::{ffi_methods, interface_fn, GodotFfi};

Expand Down Expand Up @@ -560,13 +560,9 @@ macro_rules! impl_packed_array {
while let Some(item) = iter.next() {
buf[0].write(item);
let mut buf_len = 1;
while buf_len < BUFFER_CAPACITY {
if let Some(item) = iter.next() {
buf[buf_len].write(item);
buf_len += 1;
} else {
break;
}
for (src, dst) in iter::zip(&mut iter, buf.iter_mut().skip(1)) {
dst.write(src);
buf_len += 1;
}
let capacity = len + buf_len;
self.resize(capacity);
Expand Down

0 comments on commit 26b20d3

Please sign in to comment.