This language bar is your friend. Select your favorite languages!
Edit summary for version 8 :

Version 7

Version 8

Idiom #65 Format decimal number

From real value x in [0,1], create its percentage string representation s with one digit after decimal point. E.g. 0.15625 -> "15.6%"

Idiom #65 Format decimal number

From real value x in [0,1], create its percentage string representation s with one digit after decimal point. E.g. 0.15625 -> "15.6%"

Code
let s = format!("{:.1}%", 100.0*x);
Code
let s = format!("{:.1}%", 100.0 * x);
Demo URL
https://play.rust-lang.org/?code=fn%20main()%20%7B%0A%20%20%20%20let%20x%20%3D%200.15625f64%3B%0A%20%20%20%20let%20s%20%3D%20format!(%22%7B%3A.1%7D%25%22%2C%20100.0%20*%20x)%3B%0A%20%20%20%20%0A%20%20%20%20println!(%22%7B%7D%22%2C%20s)%3B%0A%7D%0A&version=stable