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

Use dbg! instead of println! in day 3 & 4. (#2669)

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

Co-authored-by: Eric Githinji <egithinji@google.com>
This commit is contained in:
Eric Githinji
2025-02-27 21:46:55 +03:00
committed by GitHub
parent 241c28ed7e
commit ea53e3c935
12 changed files with 25 additions and 25 deletions

View File

@ -11,7 +11,7 @@ Rust will trigger a panic if a fatal error happens at runtime:
```rust,editable,should_panic
fn main() {
let v = vec![10, 20, 30];
println!("v[100]: {}", v[100]);
dbg!(v[100]);
}
```
@ -33,12 +33,12 @@ use std::panic;
fn main() {
let result = panic::catch_unwind(|| "No problem here!");
println!("{result:?}");
dbg!(result);
let result = panic::catch_unwind(|| {
panic!("oh no!");
});
println!("{result:?}");
dbg!(result);
}
```