yew/packages/yew-macro/tests/hook_attr/hook_location-fail.rs
Kaede Hoshikawa fc067ab56c
Fix Call Generics & FnOnce macro hygiene (#2437)
* Fix Call Generics & FnOnce macro hygiene.

* Add a failure case as well.

* Remove a unused struct in test case.

* Update packages/yew-macro/tests/hook_attr/hook-const-generic-pass.rs

Co-authored-by: Muhammad Hamza <muhammadhamza1311@gmail.com>
2022-02-12 18:26:23 +05:00

40 lines
672 B
Rust

use yew::prelude::*;
#[derive(Debug, PartialEq, Clone)]
struct Ctx;
#[hook]
fn use_some_html() -> Html {
if let Some(_m) = use_context::<Ctx>() {
use_context::<Ctx>().unwrap();
todo!()
}
let _ = || {
use_context::<Ctx>().unwrap();
todo!()
};
for _ in 0..10 {
use_context::<Ctx>().unwrap();
}
while let Some(_m) = use_context::<Ctx>() {
use_context::<Ctx>().unwrap();
}
match use_context::<Ctx>() {
Some(_) => use_context::<Ctx>(),
None => {
todo!()
}
}
loop {
use_context::<Ctx>().unwrap();
todo!()
}
}
fn main() {}