Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify struct creations with the Default trait #61

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant