Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Revisit iteration styles  #4

@fpacifici

Description

@fpacifici

Reflect on the different iteration styles into_iter, iter, iter_mut, vs &, &mut.
for example here:

for topic in topics.iter() {

you take the argument as an allocated Vec, but you only iterate over references of its members via .iter, afterwards freeing that allocation. Better to either take a &[T] as above, or consume the vector via into_iter (or just … in topics as that will also consume the vec)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions