Skip to content

Add a lint for items used before definition,inside expression block #5352

Open

Description

I would like to have a lint like the items_after_statements lint,but which only triggers if an item defined inside an expression block is used before it's defined.

For example,it would trigger with this code:

fn hello() {
    println!("First statement");
    let hello: Bar = (0..10).collect();
    type Bar = Vec<u32>;
}

But it would not trigger with this code:

fn hello() {
    println!("First statement");
    type Bar = Vec<u32>;
    let hello: Bar = (0..10).collect();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.L-styleLint: Belongs in the style lint groupT-ASTType: Requires working with the AST

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions