rust-lang / www.rust-lang.org

The home of the Rust website
https://www.rust-lang.org
Apache License 2.0
362 stars 287 forks source link

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

Closed kwluoto closed 5 months ago

kwluoto commented 5 months ago

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.

Manishearth commented 5 months ago

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.