2026-07-21 17:46 UTC
@FineFindus@floss.social I usually am doing more complex things to filter out the output I want to look at, and `dbg!` passes through the value passed in, which means that if the binding is not boolean, you get a type error:
error[E0308]: mismatched types
--> src/main.rs:5:29
|
5 | if let Some(x) = Some(1) && dbg!(x) {}
| ^^^^^^^ expected `bool`, found integer
Replies (1)
-
@FineFindus@floss.social 2026-07-21 18:17
@ekuber@hachyderm.io I see. I usually just do `if let Some(x) = dbg!(Some(1))`, though of course also logs None values (which is often what I want anyways)