blob: 40d26d08cba116db64c5f7557fcea6a319e66209 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// check-pass
#![deny(named_arguments_used_positionally)]
fn main() {
let value: f64 = 314.15926;
let digits_before_decimal = 1;
let digits_after_decimal = 2;
let width = digits_before_decimal + 1 + digits_after_decimal;
println!(
"{value:0>width$.digits_after_decimal$}",
value = value,
width = width,
digits_after_decimal = digits_after_decimal,
);
}
|