Skip to content

useless_let_if_seq should not emit a warning if multiple assignments happen #2749

Open
@DaanVandenBosch

Description

@DaanVandenBosch

I have code that looks like this:

let img_x: u32;
let img_y: u32;
let pattern_x: u32;
let pattern_y: u32;

if forward {
    img_x = start_x + scan_x;
    img_y = start_y + scan_y;
    pattern_x = scan_x;
    pattern_y = scan_y;
} else {
    img_x = start_x - scan_x;
    img_y = start_y - scan_y;
    pattern_x = scan_width - scan_x - 1;
    pattern_y = scan_height - scan_y - 1;
}

Am I right in thinking that this should be ok with clippy or is there actually a more idiomatic way of doing something like this?

If people agree with me, I'll fix the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions