Skip to content

Conversation

@soniseth0
Copy link
Contributor

Removes unnecessary allocation by avoiding full HashMap clone when extending, diagnostics_notes collection in priv_module_data_helper.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion


crates/cairo-lang-defs/src/db.rs line 985 at r1 (raw file):

        aux_data.extend(
            priv_module_data.aux_data.iter().map(|(file, aux_data)| (*file, aux_data.clone())),
        );

Suggestion:

        diagnostics_notes
            .extend(priv_module_data.diagnostics_notes.iter().map(|(k, v)| (*k, v.clone())));
        file_queue.extend(priv_module_data.files.keys().copied());
        plugin_diagnostics
            .extend(priv_module_data.plugin_diagnostics.iter().map(|v| (module_id, v.clone())));
        aux_data.extend(priv_module_data.aux_data.iter().map(|(k, v)| (*k, v.clone())));

@soniseth0 soniseth0 closed this by deleting the head repository Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants