Skip to content

Commit

Permalink
Merge pull request #1501 from taufik-rama/master
Browse files Browse the repository at this point in the history
Added new Rust 1.58 direct format args
  • Loading branch information
marioidival authored Feb 8, 2022
2 parents 8186f0d + 4504870 commit abbccac
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/hello/print.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ fn main() {
// handling. This will not work.
println!("This struct `{}` won't print...", Structure(3));
// FIXME ^ Comment out this line.
// For Rust 1.58 and above, you can directly capture the argument from
// surrounding variable. Just like the above, this will output
// " 1". 5 white spaces and a "1".
let number: f64 = 1.0;
let width: usize = 6;
println!("{number:>width$}");
}
```

Expand Down

0 comments on commit abbccac

Please sign in to comment.