You've already forked comprehensive-rust
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 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:
@ -4,13 +4,11 @@ Like with `if let`, there is a
|
||||
[`while let`](https://doc.rust-lang.org/reference/expressions/loop-expr.html#predicate-pattern-loops)
|
||||
variant which repeatedly tests a value against a pattern:
|
||||
|
||||
<!-- mdbook-xgettext: skip -->
|
||||
|
||||
```rust,editable
|
||||
fn main() {
|
||||
let mut name = String::from("Comprehensive Rust 🦀");
|
||||
while let Some(c) = name.pop() {
|
||||
println!("character: {c}");
|
||||
dbg!(c);
|
||||
}
|
||||
// (There are more efficient ways to reverse a string!)
|
||||
}
|
||||
|
Reference in New Issue
Block a user