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,32 +221,29 @@ macro_rules! impl_attr_for_tuples {
} }
fn to_html(self, buf: &mut String, class: &mut String, style: &mut String, inner_html: &mut String,) { fn to_html(self, buf: &mut String, class: &mut String, style: &mut String, inner_html: &mut String,) {
paste::paste! { #[allow(non_snake_case)]
let ([<$first:lower>], $([<$ty:lower>],)* ) = self; let ($first, $($ty,)* ) = self;
[<$first:lower>].to_html(buf, class, style, inner_html); $first.to_html(buf, class, style, inner_html);
$([<$ty:lower>].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 { fn hydrate<const FROM_SERVER: bool>(self, el: &Rndr::Element) -> Self::State {
paste::paste! { #[allow(non_snake_case)]
let ([<$first:lower>], $([<$ty:lower>],)* ) = self; let ($first, $($ty,)* ) = self;
( (
[<$first:lower>].hydrate::<FROM_SERVER>(el), $first.hydrate::<FROM_SERVER>(el),
$([<$ty:lower>].hydrate::<FROM_SERVER>(el)),* $($ty.hydrate::<FROM_SERVER>(el)),*
) )
} }
}
fn build(self, el: &Rndr::Element) -> Self::State { fn build(self, el: &Rndr::Element) -> Self::State {
paste::paste! { #[allow(non_snake_case)]
let ([<$first:lower>], $([<$ty:lower>],)*) = self; let ($first, $($ty,)*) = self;
( (
[<$first:lower>].build(el), $first.build(el),
$([<$ty:lower>].build(el)),* $($ty.build(el)),*
) )
} }
}
fn rebuild(self, state: &mut Self::State) { fn rebuild(self, state: &mut Self::State) {
paste::paste! { paste::paste! {
@ -258,6 +255,7 @@ macro_rules! impl_attr_for_tuples {
} }
fn into_cloneable(self) -> Self::Cloneable { fn into_cloneable(self) -> Self::Cloneable {
#[allow(non_snake_case)]
let ($first, $($ty,)*) = self; let ($first, $($ty,)*) = self;
( (
$first.into_cloneable(), $first.into_cloneable(),
@ -266,6 +264,7 @@ macro_rules! impl_attr_for_tuples {
} }
fn into_cloneable_owned(self) -> Self::CloneableOwned { fn into_cloneable_owned(self) -> Self::CloneableOwned {
#[allow(non_snake_case)]
let ($first, $($ty,)*) = self; let ($first, $($ty,)*) = self;
( (
$first.into_cloneable_owned(), $first.into_cloneable_owned(),
@ -315,32 +314,29 @@ 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,) { fn to_html(self, buf: &mut String, class: &mut String, style: &mut String, inner_html: &mut String,) {
paste::paste! { #[allow(non_snake_case)]
let ([<$first:lower>], $([<$ty:lower>],)* ) = self; let ($first, $($ty,)* ) = self;
[<$first:lower>].to_html(buf, class, style, inner_html); $first.to_html(buf, class, style, inner_html);
$([<$ty:lower>].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 { fn hydrate<const FROM_SERVER: bool>(self, el: &Rndr::Element) -> Self::State {
paste::paste! { #[allow(non_snake_case)]
let ([<$first:lower>], $([<$ty:lower>],)* ) = self; let ($first, $($ty,)* ) = self;
( (
[<$first:lower>].hydrate::<FROM_SERVER>(el), $first.hydrate::<FROM_SERVER>(el),
$([<$ty:lower>].hydrate::<FROM_SERVER>(el)),* $($ty.hydrate::<FROM_SERVER>(el)),*
) )
} }
}
fn build(self, el: &Rndr::Element) -> Self::State { fn build(self, el: &Rndr::Element) -> Self::State {
paste::paste! { #[allow(non_snake_case)]
let ([<$first:lower>], $([<$ty:lower>],)*) = self; let ($first, $($ty,)*) = self;
( (
[<$first:lower>].build(el), $first.build(el),
$([<$ty:lower>].build(el)),* $($ty.build(el)),*
) )
} }
}
fn rebuild(self, state: &mut Self::State) { fn rebuild(self, state: &mut Self::State) {
paste::paste! { paste::paste! {
@ -352,6 +348,7 @@ macro_rules! impl_attr_for_tuples_truncate_additional {
} }
fn into_cloneable(self) -> Self::Cloneable { fn into_cloneable(self) -> Self::Cloneable {
#[allow(non_snake_case)]
let ($first, $($ty,)*) = self; let ($first, $($ty,)*) = self;
( (
$first.into_cloneable(), $first.into_cloneable(),
@ -360,6 +357,7 @@ macro_rules! impl_attr_for_tuples_truncate_additional {
} }
fn into_cloneable_owned(self) -> Self::CloneableOwned { fn into_cloneable_owned(self) -> Self::CloneableOwned {
#[allow(non_snake_case)]
let ($first, $($ty,)*) = self; let ($first, $($ty,)*) = self;
( (
$first.into_cloneable_owned(), $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) { fn to_html_with_buf(self, buf: &mut String, position: &mut Position) {
paste::paste! { #[allow(non_snake_case)]
let ([<$first:lower>], $([<$ty:lower>],)* ) = self; let ($first, $($ty,)* ) = self;
[<$first:lower>].to_html_with_buf(buf, position); $first.to_html_with_buf(buf, position);
$([<$ty:lower>].to_html_with_buf(buf, position));* $($ty.to_html_with_buf(buf, position));*
}
} }
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>( fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
@ -231,22 +230,20 @@ macro_rules! impl_view_for_tuples {
) where ) where
Self: Sized, Self: Sized,
{ {
paste::paste! { #[allow(non_snake_case)]
let ([<$first:lower>], $([<$ty:lower>],)* ) = self; let ($first, $($ty,)* ) = self;
[<$first:lower>].to_html_async_with_buf::<OUT_OF_ORDER>(buf, position); $first.to_html_async_with_buf::<OUT_OF_ORDER>(buf, position);
$([<$ty:lower>].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 { fn hydrate<const FROM_SERVER: bool>(self, cursor: &Cursor<Rndr>, position: &PositionState) -> Self::State {
paste::paste! { #[allow(non_snake_case)]
let ([<$first:lower>], $([<$ty:lower>],)* ) = self; let ($first, $($ty,)* ) = self;
( (
[<$first:lower>].hydrate::<FROM_SERVER>(cursor, position), $first.hydrate::<FROM_SERVER>(cursor, position),
$([<$ty:lower>].hydrate::<FROM_SERVER>(cursor, position)),* $($ty.hydrate::<FROM_SERVER>(cursor, position)),*
) )
} }
}
async fn resolve(self) -> Self::AsyncOutput { async fn resolve(self) -> Self::AsyncOutput {
#[allow(non_snake_case)] #[allow(non_snake_case)]
@ -274,12 +271,10 @@ 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) { 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); $first ::to_template(buf, class, style, inner_html, position);
$($ty::to_template(buf, class, style, inner_html, position));*; $($ty::to_template(buf, class, style, inner_html, position));*;
} }
} }
}
impl<$first, $($ty),*, Rndr> Mountable<Rndr> for ($first, $($ty,)*) where impl<$first, $($ty),*, Rndr> Mountable<Rndr> for ($first, $($ty,)*) where
$first: Mountable<Rndr>, $first: Mountable<Rndr>,
@ -287,11 +282,10 @@ macro_rules! impl_view_for_tuples {
Rndr: Renderer Rndr: Renderer
{ {
fn unmount(&mut self) { fn unmount(&mut self) {
paste::paste! { #[allow(non_snake_case)] // better macro performance
let ([<$first:lower>], $([<$ty:lower>],)*) = self; let ($first, $($ty,)*) = self;
[<$first:lower>].unmount(); $first.unmount();
$([<$ty:lower>].unmount());* $($ty.unmount());*
}
} }
fn mount( fn mount(
@ -299,11 +293,10 @@ macro_rules! impl_view_for_tuples {
parent: &Rndr::Element, parent: &Rndr::Element,
marker: Option<&Rndr::Node>, marker: Option<&Rndr::Node>,
) { ) {
paste::paste! { #[allow(non_snake_case)] // better macro performance
let ([<$first:lower>], $([<$ty:lower>],)*) = self; let ($first, $($ty,)*) = self;
[<$first:lower>].mount(parent, marker); $first.mount(parent, marker);
$([<$ty:lower>].mount(parent, marker));* $($ty.mount(parent, marker));*
}
} }
fn insert_before_this( fn insert_before_this(
@ -311,11 +304,10 @@ macro_rules! impl_view_for_tuples {
parent: &Rndr::Element, parent: &Rndr::Element,
child: &mut dyn Mountable<Rndr>, child: &mut dyn Mountable<Rndr>,
) -> bool { ) -> bool {
paste::paste! { #[allow(non_snake_case)] // better macro performance
let ([<$first:lower>], $([<$ty:lower>],)*) = self; let ($first, $($ty,)*) = self;
[<$first:lower>].insert_before_this(parent, child) $first.insert_before_this(parent, child)
$(|| [<$ty:lower>].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>, Self::Output<NewAttr>: RenderHtml<Rndr>,
{ {
let shared = attr.into_cloneable(); let shared = attr.into_cloneable();
#[allow(non_snake_case)] // better macro performance
let ($first, $($ty,)*) = self; let ($first, $($ty,)*) = self;
($first.add_any_attr(shared.clone()), $($ty.add_any_attr(shared.clone()),)*) ($first.add_any_attr(shared.clone()), $($ty.add_any_attr(shared.clone()),)*)
} }