Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Simplify struct creations with the Default trait #61

Closed
tomassedovic opened this issue Oct 1, 2019 · 0 comments
Closed

Simplify struct creations with the Default trait #61

tomassedovic opened this issue Oct 1, 2019 · 0 comments

Comments

@tomassedovic
Copy link
Owner

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.

@tomassedovic tomassedovic closed this as not planned Won't fix, can't repro, duplicate, stale Jan 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant