Enumeration variants with the same prefix or suffix as the enumeration name are repetitive. Variants should describe themselves, and not include the name of the parent enum in their names.
Restrict the names of enumeration variants to avoid repetition. Repetitive names encourage glob exports which may cause namespace overlaps.
enum Brush {
LineBrush,
CircleBrush,
SelectBrush
}
// this nomenclature encourages glob exports:
use Brush::*;
let x = LineBrush;
match x {
LineBrush => { }
CircleBrush => { }
_ => { }
}
enum Brush {
Line,
Circle,
Select
}
// equally explicit, but more idiomatic:
let x = Brush::Line;
match x {
Brush::Line => { }
Brush::Circle => { }
_ => { }
}