We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
format! macro documentation could be improved by changing one of the examples to be more obvious to new users.
https://doc.rust-lang.org/std/macro.format.html
Change example format!("x = {}, y = {y}", 10, y = 30); to format!("x = {}, y = {z}", 10, z = 30);
format!("x = {}, y = {y}", 10, y = 30);
format!("x = {}, y = {z}", 10, z = 30);
Additionally, assert! could be used to demonstrate final string values:
let greeting = format!("hello {}", "world!"); assert!(greeting=="hello world!"); let xy = format!("x = {}, y = {z}", 10, z = 30); assert!(xy=="x = 10, y = 30"); let (a, b) = (1, 2); let ab = format!("{a} + {b} = 3"); assert!(ab=="1 + 2 = 3");```
The text was updated successfully, but these errors were encountered:
This is the tracker for the website, please post on rust-lang/rust for the stdlib and its docs.
Sorry, something went wrong.
@Manishearth Sorry, this is my first contribution on github ever. Have I missed something?
My intention was to have the documentation updated to help new users (like me).
Yes, this is the wrong repository for documentation fixes, this repository is for www.rust-lang.org only. Check out https://github.com/rust-lang/rust instead
Will do, thanks!
No branches or pull requests
What needs to be fixed?
format! macro documentation could be improved by changing one of the examples to be more obvious to new users.
Page(s) Affected
https://doc.rust-lang.org/std/macro.format.html
Suggested Improvement
Change example
format!("x = {}, y = {y}", 10, y = 30);
to
format!("x = {}, y = {z}", 10, z = 30);
Additionally, assert! could be used to demonstrate final string values:
The text was updated successfully, but these errors were encountered: