Skip to content

Result depending on execution order #277

Open
@llogiq

Description

@llogiq

In Rust issue #28160, Niko shows an example containing the line x += { x = 20; 2 }, and asks the question what execution order should be used.

I think we should have a lint against those degenerate cases. However, I'm not sure what patterns we should match.

issues left:

  • simple cases with one variable
  • struct/tuple fields (easy)
  • taking a reference to a field stops the lint from checking any further, even if it is dereferenced again (medium)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.T-ASTType: Requires working with the ASTT-MIRType: This lint will require working with the MIRgood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions