Skip to content

Latest commit

 

History

History

inconsistent_struct_pattern

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

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;