polish: change in cx to cx

This commit is contained in:
Jonathan Kelley committed 2021-09-16 13:20:04 -04:00
1 parent 0ded32e184
commit 9971ff215d
21 files changed
+426 -320

No files matched your search

+3 -3
View File
@@ -87,7 +87,7 @@ pub fn derive_typed_builder(input: proc_macro::TokenStream) -> proc_macro::Token
/// // To fix this, call "render" method or use the "in" syntax to produce VNodes.
/// // There's nothing we can do about it, sorry :/ (unless you want *really* unhygenic macros)
/// {match true {
/// true => rsx!(in cx, h1 {"Top text"}),
/// true => rsx!(cx, h1 {"Top text"}),
/// false => cx.render(rsx!( h1 {"Bottom text"}))
/// }}
///
@@ -98,9 +98,9 @@ pub fn derive_typed_builder(input: proc_macro::TokenStream) -> proc_macro::Token
///
/// // True conditions need to be rendered (same reasons as matching)
/// {if true {
/// rsx!(in cx, h1 {"Top text"})
/// rsx!(cx, h1 {"Top text"})
/// } else {
/// rsx!(in cx, h1 {"Bottom text"})
/// rsx!(cx, h1 {"Bottom text"})
/// }}
///
/// // returning "None" is a bit noisy... but rare in practice
+1 -2
View File
@@ -39,8 +39,7 @@ impl Parse for RsxBody<AS_HTML> {
}
fn try_parse_custom_context(input: ParseStream) -> Result<Option<Ident>> {
let res = if input.peek(Token![in]) && input.peek2(Ident) && input.peek3(Token![,]) {
let _ = input.parse::<Token![in]>()?;
let res = if input.peek(Ident) && input.peek2(Token![,]) {
let name = input.parse::<Ident>()?;
input.parse::<Token![,]>()?;
Some(name)