roguelike-tutorial
roguelike-tutorial copied to clipboard
Simplify struct creations with the `Default` trait
trafficstars
For example, the Object::new method could be simplified to something like this:
Object {
x: x,
y: y,
char: char,
color: color,
name: name.into(),
blocks: blocks,
level: 1,
.. default::Default(),
}
Removing all the None and false values. That would simplify the tutorial as we wouldn't have to change the structs so often. The Game one seems like another likely candidate.