intellij-rust: Yew html macro error Expect Html found ()

Environment

  • IntelliJ Rust plugin version: 0.3.139.3615-203
  • Rust toolchain version: 1.49.0
  • IDE name and version: RubyMine 2020.3.1
  • Operating system: Ubuntu 20.04 x64

Problem description

When wrapping the html in the match it gives this markup error but it works fine. Also the compiler thinks it is ok.

Schermafdruk van 2021-01-27 09-33-57

Steps to reproduce

Wrap a view in a match case like this:

fn view(&self) -> Html {
        let account: models::Account = models::Account::default(),

        match self.props.kind {
            ViewKind::Name => {
                html! {
                    <>
                         <>{ &account.name }</>
                    </>
                }
            }
            ViewKind::Avatar => {
                html! {
                    <>
                        <img src=&account.avatar_url class="avatar img-fluid avatar-xs mr-3" alt=&account.name />
                    </>
                }
            }
        }
    }

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 11
  • Comments: 16 (3 by maintainers)

Most upvoted comments

For me using html![] or html!() seems to work, but fails in a different way. It then detects the code as unreachable.

FWIW, I’m on nightly yew and nightly rust plugin and this is still broken.