chore: fix warnings about variable case

This commit is contained in:
Greg Johnston 2024-05-10 17:19:40 -04:00
parent 3629302f88
commit 49da073fed
2 changed files with 60 additions and 69 deletions

View File

@ -221,35 +221,32 @@ macro_rules! impl_attr_for_tuples {
}
fn to_html(self, buf: &mut String, class: &mut String, style: &mut String, inner_html: &mut String,) {
paste::paste! {
let ([<$first:lower>], $([<$ty:lower>],)* ) = self;
[<$first:lower>].to_html(buf, class, style, inner_html);
$([<$ty:lower>].to_html(buf, class, style, inner_html));*
}
#[allow(non_snake_case)]
let ($first, $($ty,)* ) = self;
$first.to_html(buf, class, style, inner_html);
$($ty.to_html(buf, class, style, inner_html));*
}
fn hydrate<const FROM_SERVER: bool>(self, el: &Rndr::Element) -> Self::State {
paste::paste! {
let ([<$first:lower>], $([<$ty:lower>],)* ) = self;
#[allow(non_snake_case)]
let ($first, $($ty,)* ) = self;
(
[<$first:lower>].hydrate::<FROM_SERVER>(el),
$([<$ty:lower>].hydrate::<FROM_SERVER>(el)),*
$first.hydrate::<FROM_SERVER>(el),
$($ty.hydrate::<FROM_SERVER>(el)),*
)
}
}
fn build(self, el: &Rndr::Element) -> Self::State {
paste::paste! {
let ([<$first:lower>], $([<$ty:lower>],)*) = self;
#[allow(non_snake_case)]
let ($first, $($ty,)*) = self;
(
[<$first:lower>].build(el),
$([<$ty:lower>].build(el)),*
$first.build(el),
$($ty.build(el)),*
)
}
}
fn rebuild(self, state: &mut Self::State) {
paste::paste! {
paste::paste! {
let ([<$first:lower>], $([<$ty:lower>],)*) = self;
let ([<view_ $first:lower>], $([<view_ $ty:lower>],)*) = state;
[<$first:lower>].rebuild([<view_ $first:lower>]);
@ -258,6 +255,7 @@ macro_rules! impl_attr_for_tuples {
}
fn into_cloneable(self) -> Self::Cloneable {
#[allow(non_snake_case)]
let ($first, $($ty,)*) = self;
(
$first.into_cloneable(),
@ -266,6 +264,7 @@ macro_rules! impl_attr_for_tuples {
}
fn into_cloneable_owned(self) -> Self::CloneableOwned {
#[allow(non_snake_case)]
let ($first, $($ty,)*) = self;
(
$first.into_cloneable_owned(),
@ -315,31 +314,28 @@ macro_rules! impl_attr_for_tuples_truncate_additional {
}
fn to_html(self, buf: &mut String, class: &mut String, style: &mut String, inner_html: &mut String,) {
paste::paste! {
let ([<$first:lower>], $([<$ty:lower>],)* ) = self;
[<$first:lower>].to_html(buf, class, style, inner_html);
$([<$ty:lower>].to_html(buf, class, style, inner_html));*
}
#[allow(non_snake_case)]
let ($first, $($ty,)* ) = self;
$first.to_html(buf, class, style, inner_html);
$($ty.to_html(buf, class, style, inner_html));*
}
fn hydrate<const FROM_SERVER: bool>(self, el: &Rndr::Element) -> Self::State {
paste::paste! {
let ([<$first:lower>], $([<$ty:lower>],)* ) = self;
(
[<$first:lower>].hydrate::<FROM_SERVER>(el),
$([<$ty:lower>].hydrate::<FROM_SERVER>(el)),*
)
}
#[allow(non_snake_case)]
let ($first, $($ty,)* ) = self;
(
$first.hydrate::<FROM_SERVER>(el),
$($ty.hydrate::<FROM_SERVER>(el)),*
)
}
fn build(self, el: &Rndr::Element) -> Self::State {
paste::paste! {
let ([<$first:lower>], $([<$ty:lower>],)*) = self;
(
[<$first:lower>].build(el),
$([<$ty:lower>].build(el)),*
)
}
#[allow(non_snake_case)]
let ($first, $($ty,)*) = self;
(
$first.build(el),
$($ty.build(el)),*
)
}
fn rebuild(self, state: &mut Self::State) {
@ -352,6 +348,7 @@ macro_rules! impl_attr_for_tuples_truncate_additional {
}
fn into_cloneable(self) -> Self::Cloneable {
#[allow(non_snake_case)]
let ($first, $($ty,)*) = self;
(
$first.into_cloneable(),
@ -360,6 +357,7 @@ macro_rules! impl_attr_for_tuples_truncate_additional {
}
fn into_cloneable_owned(self) -> Self::CloneableOwned {
#[allow(non_snake_case)]
let ($first, $($ty,)*) = self;
(
$first.into_cloneable_owned(),

View File

@ -217,11 +217,10 @@ macro_rules! impl_view_for_tuples {
}
fn to_html_with_buf(self, buf: &mut String, position: &mut Position) {
paste::paste! {
let ([<$first:lower>], $([<$ty:lower>],)* ) = self;
[<$first:lower>].to_html_with_buf(buf, position);
$([<$ty:lower>].to_html_with_buf(buf, position));*
}
#[allow(non_snake_case)]
let ($first, $($ty,)* ) = self;
$first.to_html_with_buf(buf, position);
$($ty.to_html_with_buf(buf, position));*
}
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
@ -231,21 +230,19 @@ macro_rules! impl_view_for_tuples {
) where
Self: Sized,
{
paste::paste! {
let ([<$first:lower>], $([<$ty:lower>],)* ) = self;
[<$first:lower>].to_html_async_with_buf::<OUT_OF_ORDER>(buf, position);
$([<$ty:lower>].to_html_async_with_buf::<OUT_OF_ORDER>(buf, position));*
}
#[allow(non_snake_case)]
let ($first, $($ty,)* ) = self;
$first.to_html_async_with_buf::<OUT_OF_ORDER>(buf, position);
$($ty.to_html_async_with_buf::<OUT_OF_ORDER>(buf, position));*
}
fn hydrate<const FROM_SERVER: bool>(self, cursor: &Cursor<Rndr>, position: &PositionState) -> Self::State {
paste::paste! {
let ([<$first:lower>], $([<$ty:lower>],)* ) = self;
#[allow(non_snake_case)]
let ($first, $($ty,)* ) = self;
(
[<$first:lower>].hydrate::<FROM_SERVER>(cursor, position),
$([<$ty:lower>].hydrate::<FROM_SERVER>(cursor, position)),*
$first.hydrate::<FROM_SERVER>(cursor, position),
$($ty.hydrate::<FROM_SERVER>(cursor, position)),*
)
}
}
async fn resolve(self) -> Self::AsyncOutput {
@ -274,10 +271,8 @@ macro_rules! impl_view_for_tuples {
], ";"));
fn to_template(buf: &mut String, class: &mut String, style: &mut String, inner_html: &mut String, position: &mut Position) {
paste::paste! {
$first ::to_template(buf, class, style, inner_html, position);
$($ty::to_template(buf, class, style, inner_html, position));*;
}
$first ::to_template(buf, class, style, inner_html, position);
$($ty::to_template(buf, class, style, inner_html, position));*;
}
}
@ -287,11 +282,10 @@ macro_rules! impl_view_for_tuples {
Rndr: Renderer
{
fn unmount(&mut self) {
paste::paste! {
let ([<$first:lower>], $([<$ty:lower>],)*) = self;
[<$first:lower>].unmount();
$([<$ty:lower>].unmount());*
}
#[allow(non_snake_case)] // better macro performance
let ($first, $($ty,)*) = self;
$first.unmount();
$($ty.unmount());*
}
fn mount(
@ -299,11 +293,10 @@ macro_rules! impl_view_for_tuples {
parent: &Rndr::Element,
marker: Option<&Rndr::Node>,
) {
paste::paste! {
let ([<$first:lower>], $([<$ty:lower>],)*) = self;
[<$first:lower>].mount(parent, marker);
$([<$ty:lower>].mount(parent, marker));*
}
#[allow(non_snake_case)] // better macro performance
let ($first, $($ty,)*) = self;
$first.mount(parent, marker);
$($ty.mount(parent, marker));*
}
fn insert_before_this(
@ -311,11 +304,10 @@ macro_rules! impl_view_for_tuples {
parent: &Rndr::Element,
child: &mut dyn Mountable<Rndr>,
) -> bool {
paste::paste! {
let ([<$first:lower>], $([<$ty:lower>],)*) = self;
[<$first:lower>].insert_before_this(parent, child)
$(|| [<$ty:lower>].insert_before_this(parent, child))*
}
#[allow(non_snake_case)] // better macro performance
let ($first, $($ty,)*) = self;
$first.insert_before_this(parent, child)
$(|| $ty.insert_before_this(parent, child))*
}
}
@ -335,6 +327,7 @@ macro_rules! impl_view_for_tuples {
Self::Output<NewAttr>: RenderHtml<Rndr>,
{
let shared = attr.into_cloneable();
#[allow(non_snake_case)] // better macro performance
let ($first, $($ty,)*) = self;
($first.add_any_attr(shared.clone()), $($ty.add_any_attr(shared.clone()),)*)
}