@shanecelis@mastodon.gamedev.place
2026-07-21 18:37 UTC
@ekuber@hachyderm.io That's a cool trick in general. In this case I'd opt to use Option::inspect.
if let Some(next) = iter.peek().inspect(|next| tracing::info!(?next)) ...
https://doc.rust-lang.org/std/option/enum.Option.html#method.inspect
Replies (1)
-
@ekuber@hachyderm.io 2026-07-21 19:07
@shanecelis@mastodon.gamedev.place True. I generally use this when deconstructing AST/HIR nodes, and I encounter those more often than most, so the pattern might have less applicability for other people.