{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreig2gt5xocyortnun5wdkdykxsrci23vfpcmqmhv2lhu6bmn6vb4re",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mizfgvhxx3h2"
},
"path": "/t/q-why-do-match-expression-need-parenthesis-for-ops-to-the-right-but-not-left/24126#post_5",
"publishedAt": "2026-04-08T18:59:27.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "This is probably a somewhat stupid question, but why does `match` (or `if` for that mapneed a statement form at all? Why can't it just be expression whose value is discarded if used with a `;`?\n\nDo things like\n\n\n let foo;\n match bar {\n Some(_) => foo = 1;\n None => foo = 0;\n }\n // foo is now initialized\n\n\nnot work with expressions? I suppose I've never tried, but I don't immediately see a strong reason they couldn't.\n\nEDIT: sorry I've realized I just answered my own question, it's so that they can used _without_ a `;` that they have a statement form, I got tripped up by the context.",
"title": "Q: Why do match expression need parenthesis for ops to the right but not left?"
}