{"record":{"id":"1e3542ad164bb8ce","repo":"yewstack/yew","slug":"this-match-expression-has-a-scrutinee-but-no-bo","errorCode":null,"errorMessage":"this `match` expression has a scrutinee, but no body","messagePattern":"this `match` expression has a scrutinee, but no body","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/yew-macro/src/html_tree/html_match.rs","lineNumber":63,"sourceCode":"    }\n}\n\nimpl Parse for HtmlMatch {\n    fn parse(input: ParseStream) -> syn::Result<Self> {\n        let match_token = input.parse::<Token![match]>()?;\n        let expr = Box::new(input.call(Expr::parse_without_eager_brace)?);\n\n        if let Expr::Block(syn::ExprBlock { block, .. }) = &*expr {\n            if block.stmts.is_empty() {\n                return Err(syn::Error::new(\n                    expr.span(),\n                    \"missing expression for `match`\",\n                ));\n            }\n        }\n\n        if input.is_empty() {\n            return Err(syn::Error::new(\n                expr.span(),\n                \"this `match` expression has a scrutinee, but no body\",\n            ));\n        }\n\n        let content;\n        let brace = braced!(content in input);\n\n        let mut arms = Vec::new();\n        while !content.is_empty() {\n            arms.push(content.parse::<HtmlMatchArm>()?);\n        }\n\n        if arms.is_empty() {\n            return Err(syn::Error::new(\n                brace.span.span(),\n                \"`match` expression must have at least one arm\",\n            ));","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/yewstack/yew/blob/0e4a05472fac4e5fce1befe60fa4a1e43a36b6a3/packages/yew-macro/src/html_tree/html_match.rs#L45-L81","documentation":"After parsing the scrutinee, `HtmlMatch::parse` checks `input.is_empty()` (html_match.rs:65-70); if nothing follows the expression, the mandatory brace-delimited body is missing and the error points at the scrutinee span. `match` inside `html!` always requires its `{ arms }` body, unlike expression children which appear without braces.","triggerScenarios":"`html! { match value }` — a scrutinee with end-of-input right after it and no `{ … }` body.","commonSituations":"Writing `match` like a bare expression child and expecting following siblings to become the body, truncation while editing, or converting a Rust `match` statement into the macro and dropping the braces.","solutions":["Add the brace body with at least one arm: `match value { _ => <p/> }`","Compute the chosen value in plain Rust before the macro and interpolate the result as `{ value }`","Use `if`/`else` for a two-way choice where match arms add nothing"],"exampleFix":"// before\nhtml! { match value }\n\n// after\nhtml! { match value { Some(v) => <p>{ v }</p>, None => <em/> } }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Memorize the shape: `match expr { arms }` — braces are mandatory inside `html!`","Write the opening `{` of the body immediately after the scrutinee","If you only need a value chosen by condition, compute it in plain Rust and interpolate the result"],"tags":["rust","yew","html-macro","match-expression","syntax","missing-block"],"backgroundTag":"incomplete-match-expression","analyzedSha":"0e4a05472fac4e5fce1befe60fa4a1e43a36b6a3","analyzedAt":"2026-08-22T21:16:31.212Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}