Skip to content

Code example in the Guide could be improved #15452

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

Closed
aochagavia opened this issue Jul 5, 2014 · 1 comment
Closed

Code example in the Guide could be improved #15452

aochagavia opened this issue Jul 5, 2014 · 1 comment

Comments

@aochagavia
Copy link
Contributor

There is a code example in section 0.7.1 of the Guide (http://static.rust-lang.org/doc/master/guide.html#expressions-vs.-statements), which could be improved.

We use this:

let mut x = 0i;
let y = x = 5i;

But, in my opinion, it would be better to use this (avoids making x mutable):

let x;
let y = x = 5i;

Is there a reason why we prefer the first code snippet instead of the second? I could submit a PR to fix it.

cc @steveklabnik

@steveklabnik
Copy link
Member

I thought it had to be mutable, but rustc does compile things.

Yes, please submit a PR so you get credit. 😄 the text will need a tiny change as well.

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

Successfully merging a pull request may close this issue.

2 participants