Skip to content

Latest commit

 

History

History
26 lines (23 loc) · 500 Bytes

File metadata and controls

26 lines (23 loc) · 500 Bytes

inconsistent_struct_pattern

What it does

Checks for struct patterns whose fields whose fields do not match their declared order.

Why is this bad?

It can be harder to spot mistakes in inconsistent code.

Example

struct Struct {
    a: bool,
    b: bool,
};
let strukt = Struct { a: false, b: true };
let Struct { b, a } = strukt;

Use instead:

struct Struct {
    a: bool,
    b: bool,
};
let strukt = Struct { a: false, b: true };
let Struct { a, b } = strukt;