Closed
Description
I tried this code:
fn main() {
for (idx, rt_child) in root.iter_children().enumerate() {
if let(Some(rt_child)) = rt_child {
let reply_node = root_child_arena.get_reply_node(rt_child);
info!("reply_node: {} {:?} {}", Move::from_index(idx), reply_node.get_visits(), reply_node.get_score());
}
}
}
I expected to see no compiler warning on the if let(Some(rt_child)) = rt_child
line.
Instead, this happened:
warning: unnecessary parentheses around pattern
--> src/main.rs:3:17
|
3 | if let(Some(rt_child)) = rt_child {
| ^ ^
|
= note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
|
3 - if let(Some(rt_child)) = rt_child {
3 + if letSome(rt_child) = rt_child {
|
For more information about this error, try `rustc --explain E0425`.
warning: `playground` (bin "playground") generated 1 warning
error: could not compile `playground` due to 3 previous errors; 1 warning emitted
Meta
here is a rust playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=9d2bfd8156a76f0a565f0caf81b52d80
rustc --version --verbose
:
1.64.0