Remove unnecessary macro test helper (#825)

This commit is contained in:
Justin Starry 2019-12-26 15:05:31 -06:00 committed by GitHub
parent 75c93a889a
commit 88374c7993
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 45 deletions

View File

@ -1,24 +0,0 @@
#[macro_export]
macro_rules! pass_helper {
( @html ) => { html! {} };
( @html html! { $($view:tt)* }; $($tail:tt)* ) => {
html! { $($view)* };
pass_helper! { @ html $($tail)* }
};
( @html $head:stmt; $($tail:tt)* ) => {
$head
pass_helper! { @ html $($tail)* }
};
( $($content:tt)* ) => {
mod test_component;
use yew::prelude::*;
#[allow(unused)]
use test_component::TestComponent;
struct SubComponent;
impl Renderable for SubComponent {
fn render(&self) -> Html {
pass_helper! { @ html $($content)* }
}
}
};
}

View File

@ -1,7 +1,6 @@
#[macro_use]
mod helpers;
use yew::prelude::*;
pass_helper! {
fn compile_pass() {
html! { <>{ "Hi" }</> };
html! { <>{ format!("Hello") }</> };
html! { <>{ String::from("Hello") }</> };

View File

@ -1,8 +1,6 @@
#![recursion_limit = "256"]
#[macro_use]
mod helpers;
use yew::prelude::*;
use yew::html::ChildrenRenderer;
#[derive(Properties, Default, PartialEq)]
@ -87,7 +85,7 @@ mod scoped {
pub use super::Container;
}
pass_helper! {
fn compile_pass() {
html! { <Child int=1 /> };
// backwards compat

View File

@ -1,9 +1,7 @@
#[macro_use]
mod helpers;
use yew::prelude::*;
use std::iter;
pass_helper! {
fn compile_pass() {
html! { for iter::empty::<Html>() };
html! { for Vec::<Html>::new().into_iter() };
html! { for (0..3).map(|num| { html! { <span>{num}</span> } }) };

View File

@ -1,7 +1,6 @@
#[macro_use]
mod helpers;
use yew::prelude::*;
pass_helper! {
fn compile_pass() {
html! {};
html! { <></> };
html! {

View File

@ -1,7 +1,6 @@
#[macro_use]
mod helpers;
use yew::prelude::*;
pass_helper! {
fn compile_pass() {
html! { "" };
html! { 'a' };
html! { "hello" };

View File

@ -1,9 +1,7 @@
#![recursion_limit = "512"]
use yew::prelude::*;
#[macro_use]
mod helpers;
pass_helper! {
fn compile_pass() {
let onclick = Callback::from(|_: ClickEvent| ());
let parent_ref = NodeRef::default();
html! {