mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
Fix build error
And slightly improve efficiency by exiting early from an iteration
This commit is contained in:
parent
09f2ce327c
commit
c5d99433f7
2 changed files with 2 additions and 5 deletions
|
@ -516,8 +516,7 @@ impl<'a> DataSection<'a> {
|
|||
|
||||
impl Serialize for DataSection<'_> {
|
||||
fn serialize<T: SerialBuffer>(&self, buffer: &mut T) {
|
||||
let total_payload_size = self.segments.iter().map(|seg| seg.init.len()).sum();
|
||||
if total_payload_size > 0 {
|
||||
if self.segments.iter().any(|seg| !seg.init.is_empty()) {
|
||||
serialize_vector_section(buffer, SectionId::Data, &self.segments);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue