Fix test failures: Update VList to handle empty children consistently

This commit is contained in:
Matt Yan 2025-08-27 09:50:48 +09:00
parent 486a866ba1
commit e86b49af3d
3 changed files with 7 additions and 146 deletions

View File

@ -17,16 +17,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
| ^^ the trait `From<{integer}>` is not implemented for `Classes`
|
= help: the following other types implement trait `From<T>`:
<<<<<<< HEAD
<Classes as From<&'static str>>
<Classes as From<&Option<T>>>
<Classes as From<&String>>
<Classes as From<&[T]>>
<Classes as From<&implicit_clone::unsync::string::IString>>
<Classes as From<Cow<'static, str>>>
<Classes as From<Option<T>>>
<Classes as From<String>>
=======
`Classes` implements `From<&Option<T>>`
`Classes` implements `From<&String>`
`Classes` implements `From<&[T]>`
@ -35,7 +25,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
`Classes` implements `From<Cow<'_, str>>`
`Classes` implements `From<Option<T>>`
`Classes` implements `From<String>`
>>>>>>> origin/master
and $N others
= note: required for `{integer}` to implement `Into<Classes>`
note: required by a bound in `Classes::push`
@ -51,16 +40,6 @@ error[E0277]: the trait bound `Classes: From<{float}>` is not satisfied
| ^^^^ the trait `From<{float}>` is not implemented for `Classes`
|
= help: the following other types implement trait `From<T>`:
<<<<<<< HEAD
<Classes as From<&'static str>>
<Classes as From<&Option<T>>>
<Classes as From<&String>>
<Classes as From<&[T]>>
<Classes as From<&implicit_clone::unsync::string::IString>>
<Classes as From<Cow<'static, str>>>
<Classes as From<Option<T>>>
<Classes as From<String>>
=======
`Classes` implements `From<&Option<T>>`
`Classes` implements `From<&String>`
`Classes` implements `From<&[T]>`
@ -69,7 +48,6 @@ error[E0277]: the trait bound `Classes: From<{float}>` is not satisfied
`Classes` implements `From<Cow<'_, str>>`
`Classes` implements `From<Option<T>>`
`Classes` implements `From<String>`
>>>>>>> origin/master
and $N others
= note: required for `{float}` to implement `Into<Classes>`
note: required by a bound in `Classes::push`
@ -88,16 +66,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
| required by a bound introduced by this call
|
= help: the following other types implement trait `From<T>`:
<<<<<<< HEAD
<Classes as From<&'static str>>
<Classes as From<&Option<T>>>
<Classes as From<&String>>
<Classes as From<&[T]>>
<Classes as From<&implicit_clone::unsync::string::IString>>
<Classes as From<Cow<'static, str>>>
<Classes as From<Option<T>>>
<Classes as From<String>>
=======
`Classes` implements `From<&Option<T>>`
`Classes` implements `From<&String>`
`Classes` implements `From<&[T]>`
@ -106,7 +74,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
`Classes` implements `From<Cow<'_, str>>`
`Classes` implements `From<Option<T>>`
`Classes` implements `From<String>`
>>>>>>> origin/master
and $N others
= note: required for `{integer}` to implement `Into<Classes>`
= note: required for `Classes` to implement `From<Vec<{integer}>>`
@ -125,16 +92,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
| ^^^^ the trait `From<{integer}>` is not implemented for `Classes`
|
= help: the following other types implement trait `From<T>`:
<<<<<<< HEAD
<Classes as From<&'static str>>
<Classes as From<&Option<T>>>
<Classes as From<&String>>
<Classes as From<&[T]>>
<Classes as From<&implicit_clone::unsync::string::IString>>
<Classes as From<Cow<'static, str>>>
<Classes as From<Option<T>>>
<Classes as From<String>>
=======
`Classes` implements `From<&Option<T>>`
`Classes` implements `From<&String>`
`Classes` implements `From<&[T]>`
@ -143,7 +100,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
`Classes` implements `From<Cow<'_, str>>`
`Classes` implements `From<Option<T>>`
`Classes` implements `From<String>`
>>>>>>> origin/master
and $N others
= note: required for `{integer}` to implement `Into<Classes>`
= note: required for `Classes` to implement `From<Option<{integer}>>`
@ -162,16 +118,6 @@ error[E0277]: the trait bound `Classes: From<u32>` is not satisfied
| ^^^^ the trait `From<u32>` is not implemented for `Classes`
|
= help: the following other types implement trait `From<T>`:
<<<<<<< HEAD
<Classes as From<&'static str>>
<Classes as From<&Option<T>>>
<Classes as From<&String>>
<Classes as From<&[T]>>
<Classes as From<&implicit_clone::unsync::string::IString>>
<Classes as From<Cow<'static, str>>>
<Classes as From<Option<T>>>
<Classes as From<String>>
=======
`Classes` implements `From<&Option<T>>`
`Classes` implements `From<&String>`
`Classes` implements `From<&[T]>`
@ -180,7 +126,6 @@ error[E0277]: the trait bound `Classes: From<u32>` is not satisfied
`Classes` implements `From<Cow<'_, str>>`
`Classes` implements `From<Option<T>>`
`Classes` implements `From<String>`
>>>>>>> origin/master
and $N others
= note: required for `u32` to implement `Into<Classes>`
= note: required for `Classes` to implement `From<Option<u32>>`
@ -199,16 +144,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
| ^^ the trait `From<{integer}>` is not implemented for `Classes`
|
= help: the following other types implement trait `From<T>`:
<<<<<<< HEAD
<Classes as From<&'static str>>
<Classes as From<&Option<T>>>
<Classes as From<&String>>
<Classes as From<&[T]>>
<Classes as From<&implicit_clone::unsync::string::IString>>
<Classes as From<Cow<'static, str>>>
<Classes as From<Option<T>>>
<Classes as From<String>>
=======
`Classes` implements `From<&Option<T>>`
`Classes` implements `From<&String>`
`Classes` implements `From<&[T]>`
@ -217,7 +152,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
`Classes` implements `From<Cow<'_, str>>`
`Classes` implements `From<Option<T>>`
`Classes` implements `From<String>`
>>>>>>> origin/master
and $N others
= note: required for `{integer}` to implement `Into<Classes>`
note: required by a bound in `Classes::push`

View File

@ -465,16 +465,6 @@ error[E0277]: the trait bound `NotToString: IntoPropValue<Option<implicit_clone:
| ^^^^^^^^^^^ the trait `IntoPropValue<Option<implicit_clone::unsync::string::IString>>` is not implemented for `NotToString`
|
= help: the following other types implement trait `IntoPropValue<T>`:
<<<<<<< HEAD
<&'static [(K, V)] as IntoPropValue<implicit_clone::unsync::map::IMap<K, V>>>
<&'static [T] as IntoPropValue<implicit_clone::unsync::array::IArray<T>>>
<&'static str as IntoPropValue<Classes>>
<&'static str as IntoPropValue<Option<String>>>
<&'static str as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
<&'static str as IntoPropValue<String>>
<&'static str as IntoPropValue<implicit_clone::unsync::string::IString>>
<&ChildrenRenderer<VNode> as IntoPropValue<VNode>>
=======
`&'static [(K, V)]` implements `IntoPropValue<implicit_clone::unsync::map::IMap<K, V>>`
`&'static [T]` implements `IntoPropValue<implicit_clone::unsync::array::IArray<T>>`
`&'static str` implements `IntoPropValue<Classes>`
@ -482,27 +472,13 @@ error[E0277]: the trait bound `NotToString: IntoPropValue<Option<implicit_clone:
`&'static str` implements `IntoPropValue<Option<implicit_clone::unsync::string::IString>>`
`&'static str` implements `IntoPropValue<String>`
`&'static str` implements `IntoPropValue<implicit_clone::unsync::string::IString>`
`&String` implements `IntoPropValue<VNode>`
>>>>>>> origin/master
`&ChildrenRenderer<VNode>` implements `IntoPropValue<VNode>`
and $N others
error[E0277]: the trait bound `Option<NotToString>: IntoPropValue<Option<implicit_clone::unsync::string::IString>>` is not satisfied
--> tests/html_macro/element-fail.rs:47:23
|
47 | html! { <a media={Some(NotToString)} /> };
<<<<<<< HEAD
| ^^^^ the trait `IntoPropValue<Option<implicit_clone::unsync::string::IString>>` is not implemented for `Option<NotToString>`
|
= help: the following other types implement trait `IntoPropValue<T>`:
<Option<&'static str> as IntoPropValue<Option<String>>>
<Option<&'static str> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
<Option<Cow<'static, str>> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
<Option<F> as IntoPropValue<Option<yew::Callback<I, O>>>>
<Option<Rc<str>> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
<Option<String> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
<Option<VChild<T>> as IntoPropValue<Option<ChildrenRenderer<C>>>>
<Option<VNode> as IntoPropValue<VNode>>
=======
| ----^^^^^^^^^^^^^
| |
| the trait `IntoPropValue<Option<implicit_clone::unsync::string::IString>>` is not implemented for `Option<NotToString>`
@ -517,25 +493,11 @@ error[E0277]: the trait bound `Option<NotToString>: IntoPropValue<Option<implici
`Option<String>` implements `IntoPropValue<Option<implicit_clone::unsync::string::IString>>`
`Option<VChild<T>>` implements `IntoPropValue<Option<ChildrenRenderer<C>>>`
`Option<VNode>` implements `IntoPropValue<VNode>`
>>>>>>> origin/master
error[E0277]: the trait bound `Option<{integer}>: IntoPropValue<Option<implicit_clone::unsync::string::IString>>` is not satisfied
--> tests/html_macro/element-fail.rs:48:22
|
48 | html! { <a href={Some(5)} /> };
<<<<<<< HEAD
| ^^^^ the trait `IntoPropValue<Option<implicit_clone::unsync::string::IString>>` is not implemented for `Option<{integer}>`
|
= help: the following other types implement trait `IntoPropValue<T>`:
<Option<&'static str> as IntoPropValue<Option<String>>>
<Option<&'static str> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
<Option<Cow<'static, str>> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
<Option<F> as IntoPropValue<Option<yew::Callback<I, O>>>>
<Option<Rc<str>> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
<Option<String> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
<Option<VChild<T>> as IntoPropValue<Option<ChildrenRenderer<C>>>>
<Option<VNode> as IntoPropValue<VNode>>
=======
| ----^^^
| |
| the trait `IntoPropValue<Option<implicit_clone::unsync::string::IString>>` is not implemented for `Option<{integer}>`
@ -550,7 +512,6 @@ error[E0277]: the trait bound `Option<{integer}>: IntoPropValue<Option<implicit_
`Option<String>` implements `IntoPropValue<Option<implicit_clone::unsync::string::IString>>`
`Option<VChild<T>>` implements `IntoPropValue<Option<ChildrenRenderer<C>>>`
`Option<VNode>` implements `IntoPropValue<VNode>`
>>>>>>> origin/master
error[E0277]: the trait bound `{integer}: IntoEventCallback<MouseEvent>` is not satisfied
--> tests/html_macro/element-fail.rs:51:28
@ -660,17 +621,6 @@ error[E0277]: the trait bound `Option<yew::NodeRef>: IntoPropValue<yew::NodeRef>
| required by a bound introduced by this call
|
= help: the following other types implement trait `IntoPropValue<T>`:
<<<<<<< HEAD
<Option<&'static str> as IntoPropValue<Option<String>>>
<Option<&'static str> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
<Option<Cow<'static, str>> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
<Option<F> as IntoPropValue<Option<yew::Callback<I, O>>>>
<Option<Rc<str>> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
<Option<String> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
<Option<VChild<T>> as IntoPropValue<Option<ChildrenRenderer<C>>>>
<Option<VNode> as IntoPropValue<VNode>>
= note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info)
=======
`Option<&str>` implements `IntoPropValue<Option<String>>`
`Option<&str>` implements `IntoPropValue<Option<implicit_clone::unsync::string::IString>>`
`Option<Cow<'_, str>>` implements `IntoPropValue<Option<implicit_clone::unsync::string::IString>>`
@ -679,7 +629,6 @@ error[E0277]: the trait bound `Option<yew::NodeRef>: IntoPropValue<yew::NodeRef>
`Option<String>` implements `IntoPropValue<Option<implicit_clone::unsync::string::IString>>`
`Option<VChild<T>>` implements `IntoPropValue<Option<ChildrenRenderer<C>>>`
`Option<VNode>` implements `IntoPropValue<VNode>`
>>>>>>> origin/master
error[E0277]: the trait bound `yew::Callback<String>: IntoEventCallback<MouseEvent>` is not satisfied
--> tests/html_macro/element-fail.rs:58:29
@ -716,16 +665,6 @@ error[E0277]: the trait bound `NotToString: IntoPropValue<Option<implicit_clone:
| ^^^^^^^^^^^ the trait `IntoPropValue<Option<implicit_clone::unsync::string::IString>>` is not implemented for `NotToString`
|
= help: the following other types implement trait `IntoPropValue<T>`:
<<<<<<< HEAD
<&'static [(K, V)] as IntoPropValue<implicit_clone::unsync::map::IMap<K, V>>>
<&'static [T] as IntoPropValue<implicit_clone::unsync::array::IArray<T>>>
<&'static str as IntoPropValue<Classes>>
<&'static str as IntoPropValue<Option<String>>>
<&'static str as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
<&'static str as IntoPropValue<String>>
<&'static str as IntoPropValue<implicit_clone::unsync::string::IString>>
<&ChildrenRenderer<VNode> as IntoPropValue<VNode>>
=======
`&'static [(K, V)]` implements `IntoPropValue<implicit_clone::unsync::map::IMap<K, V>>`
`&'static [T]` implements `IntoPropValue<implicit_clone::unsync::array::IArray<T>>`
`&'static str` implements `IntoPropValue<Classes>`
@ -733,8 +672,7 @@ error[E0277]: the trait bound `NotToString: IntoPropValue<Option<implicit_clone:
`&'static str` implements `IntoPropValue<Option<implicit_clone::unsync::string::IString>>`
`&'static str` implements `IntoPropValue<String>`
`&'static str` implements `IntoPropValue<implicit_clone::unsync::string::IString>`
`&String` implements `IntoPropValue<VNode>`
>>>>>>> origin/master
`&ChildrenRenderer<VNode>` implements `IntoPropValue<VNode>`
and $N others
error[E0277]: the trait bound `(): IntoPropValue<yew::NodeRef>` is not satisfied
@ -751,20 +689,6 @@ error[E0277]: the trait bound `(): IntoPropValue<yew::NodeRef>` is not satisfied
= help: for that trait implementation, expected `VNode`, found `yew::NodeRef`
error[E0277]: the trait bound `implicit_clone::unsync::string::IString: From<{integer}>` is not satisfied
<<<<<<< HEAD
--> tests/html_macro/element-fail.rs:77:16
|
77 | html! { <@{55}></@> };
| ^^ the trait `From<{integer}>` is not implemented for `implicit_clone::unsync::string::IString`
|
= help: the following other types implement trait `From<T>`:
<implicit_clone::unsync::string::IString as From<&'static str>>
<implicit_clone::unsync::string::IString as From<&implicit_clone::unsync::string::IString>>
<implicit_clone::unsync::string::IString as From<Cow<'static, str>>>
<implicit_clone::unsync::string::IString as From<Rc<str>>>
<implicit_clone::unsync::string::IString as From<String>>
= note: required because of the requirements on the impl of `Into<implicit_clone::unsync::string::IString>` for `{integer}`
=======
--> tests/html_macro/element-fail.rs:79:16
|
79 | html! { <@{55}></@> };
@ -778,4 +702,3 @@ error[E0277]: the trait bound `implicit_clone::unsync::string::IString: From<{in
`implicit_clone::unsync::string::IString` implements `From<Rc<str>>`
`implicit_clone::unsync::string::IString` implements `From<String>`
= note: required for `{integer}` to implement `Into<implicit_clone::unsync::string::IString>`
>>>>>>> origin/master

View File

@ -143,7 +143,11 @@ impl VList {
fully_keyed: FullyKeyedState,
) -> Self {
VList {
children: Some(Rc::new(children)),
children: if children.is_empty() {
None
} else {
Some(Rc::new(children))
},
fully_keyed,
key,
}