rust-lang/www.rust-lang.org

Rust Getting Started web page, "A small application" example -- needs updating?

Closed this issue · 1 comments

What needs to be fixed?

I was trying to enter the small application example into my code file per the instructions. I am using the VS Code IDE with the rust-analyzer extension. The extension is quite nice, however it would not allow me to enter the example as displayed on the website. It insisted on adding some additional stuff, which appears to be something like type information for the variables. The good news is that the resulting code ran fine, as expected. The point is that the example on the website is misleading to a newbie like me who is trying to learn the language for the first time.

Page(s) Affected

https://www.rust-lang.org/learn/get-started the "A small Rust application" section

Suggested Improvement

I suspect that the Rust language has evolved a bit since the coding example was put on the website. A simple fix would be to cut & paste the updated code (such as coerced by the VS Code rust-analyzer) into the appropriate place on the website.

I can't say for sure without looking at what VS Code produced but I'm pretty sure those are the VS Code type hints. It's not editing your code, it's showing you extra information about your code in a way that flows with it.

It is not idiomatic Rust to use explicit types everywhere.