You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-12-23 15:01:49 +02:00
Inline variables printed with println! and friends (#315)
The course follows the style of inlining variable names where possible in `println!` statements.
This commit is contained in:
@@ -6,7 +6,7 @@ It is safe to read an immutable static variable:
|
||||
static HELLO_WORLD: &str = "Hello, world!";
|
||||
|
||||
fn main() {
|
||||
println!("HELLO_WORLD: {}", HELLO_WORLD);
|
||||
println!("HELLO_WORLD: {HELLO_WORLD}");
|
||||
}
|
||||
```
|
||||
|
||||
@@ -23,7 +23,7 @@ fn add_to_counter(inc: u32) {
|
||||
fn main() {
|
||||
add_to_counter(42);
|
||||
|
||||
unsafe { println!("COUNTER: {}", COUNTER); } // Potential data race!
|
||||
unsafe { println!("COUNTER: {COUNTER}"); } // Potential data race!
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user