Skip to content

suggest removing & when iterating over &<some iterator type> #47744

Closed
@spastorino

Description

@spastorino
504 | /         for (_idx, _constraint) in &self.constraints.iter().enumerate() {
505 | |         }
    | |_________^ `&std::iter::Enumerate<std::slice::Iter<'_, borrow_check::nll::region_infer::Constraint>>` 

I started going for constraint in &self.constraints { then move to use enumerate and forgot to remove the &.

I figuref that the error could say maybe remove the &, calling iter and having & doesn't make sense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions