1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-07-06 06:27:53 +02:00

Use dbg! instead of println! in Day 2. (#2657)

Part of #2478 to clean up code blocks when all that is needed is a
trivial debug print statement.

As mentioned in previous related PRs, in some places I've opted to
retain the use of println! because dbg! makes it less readable.

Co-authored-by: Eric Githinji <egithinji@google.com>
This commit is contained in:
Eric Githinji
2025-02-26 00:12:06 +03:00
committed by GitHub
parent 32a8b4bf13
commit 1a64c9ba9a
6 changed files with 12 additions and 13 deletions

View File

@ -35,7 +35,7 @@ fn main() {
*page_count += 1;
}
println!("{page_counts:#?}");
dbg!(page_counts);
}
```

View File

@ -13,10 +13,10 @@ returns an `Option<usize>`.
fn main() {
let name = "Löwe 老虎 Léopard Gepardi";
let mut position: Option<usize> = name.find('é');
println!("find returned {position:?}");
dbg!(position);
assert_eq!(position.unwrap(), 14);
position = name.find('Z');
println!("find returned {position:?}");
dbg!(position);
assert_eq!(position.expect("Character not found"), 0);
}
```