Skip to content

Commit e86b49a

Browse files
committed
Fix test failures: Update VList to handle empty children consistently
1 parent 486a866 commit e86b49a

File tree

3 files changed

+7
-146
lines changed

3 files changed

+7
-146
lines changed

packages/yew-macro/tests/classes_macro/classes-fail.stderr

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
1717
| ^^ the trait `From<{integer}>` is not implemented for `Classes`
1818
|
1919
= help: the following other types implement trait `From<T>`:
20-
<<<<<<< HEAD
21-
<Classes as From<&'static str>>
22-
<Classes as From<&Option<T>>>
23-
<Classes as From<&String>>
24-
<Classes as From<&[T]>>
25-
<Classes as From<&implicit_clone::unsync::string::IString>>
26-
<Classes as From<Cow<'static, str>>>
27-
<Classes as From<Option<T>>>
28-
<Classes as From<String>>
29-
=======
3020
`Classes` implements `From<&Option<T>>`
3121
`Classes` implements `From<&String>`
3222
`Classes` implements `From<&[T]>`
@@ -35,7 +25,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
3525
`Classes` implements `From<Cow<'_, str>>`
3626
`Classes` implements `From<Option<T>>`
3727
`Classes` implements `From<String>`
38-
>>>>>>> origin/master
3928
and $N others
4029
= note: required for `{integer}` to implement `Into<Classes>`
4130
note: required by a bound in `Classes::push`
@@ -51,16 +40,6 @@ error[E0277]: the trait bound `Classes: From<{float}>` is not satisfied
5140
| ^^^^ the trait `From<{float}>` is not implemented for `Classes`
5241
|
5342
= help: the following other types implement trait `From<T>`:
54-
<<<<<<< HEAD
55-
<Classes as From<&'static str>>
56-
<Classes as From<&Option<T>>>
57-
<Classes as From<&String>>
58-
<Classes as From<&[T]>>
59-
<Classes as From<&implicit_clone::unsync::string::IString>>
60-
<Classes as From<Cow<'static, str>>>
61-
<Classes as From<Option<T>>>
62-
<Classes as From<String>>
63-
=======
6443
`Classes` implements `From<&Option<T>>`
6544
`Classes` implements `From<&String>`
6645
`Classes` implements `From<&[T]>`
@@ -69,7 +48,6 @@ error[E0277]: the trait bound `Classes: From<{float}>` is not satisfied
6948
`Classes` implements `From<Cow<'_, str>>`
7049
`Classes` implements `From<Option<T>>`
7150
`Classes` implements `From<String>`
72-
>>>>>>> origin/master
7351
and $N others
7452
= note: required for `{float}` to implement `Into<Classes>`
7553
note: required by a bound in `Classes::push`
@@ -88,16 +66,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
8866
| required by a bound introduced by this call
8967
|
9068
= help: the following other types implement trait `From<T>`:
91-
<<<<<<< HEAD
92-
<Classes as From<&'static str>>
93-
<Classes as From<&Option<T>>>
94-
<Classes as From<&String>>
95-
<Classes as From<&[T]>>
96-
<Classes as From<&implicit_clone::unsync::string::IString>>
97-
<Classes as From<Cow<'static, str>>>
98-
<Classes as From<Option<T>>>
99-
<Classes as From<String>>
100-
=======
10169
`Classes` implements `From<&Option<T>>`
10270
`Classes` implements `From<&String>`
10371
`Classes` implements `From<&[T]>`
@@ -106,7 +74,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
10674
`Classes` implements `From<Cow<'_, str>>`
10775
`Classes` implements `From<Option<T>>`
10876
`Classes` implements `From<String>`
109-
>>>>>>> origin/master
11077
and $N others
11178
= note: required for `{integer}` to implement `Into<Classes>`
11279
= note: required for `Classes` to implement `From<Vec<{integer}>>`
@@ -125,16 +92,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
12592
| ^^^^ the trait `From<{integer}>` is not implemented for `Classes`
12693
|
12794
= help: the following other types implement trait `From<T>`:
128-
<<<<<<< HEAD
129-
<Classes as From<&'static str>>
130-
<Classes as From<&Option<T>>>
131-
<Classes as From<&String>>
132-
<Classes as From<&[T]>>
133-
<Classes as From<&implicit_clone::unsync::string::IString>>
134-
<Classes as From<Cow<'static, str>>>
135-
<Classes as From<Option<T>>>
136-
<Classes as From<String>>
137-
=======
13895
`Classes` implements `From<&Option<T>>`
13996
`Classes` implements `From<&String>`
14097
`Classes` implements `From<&[T]>`
@@ -143,7 +100,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
143100
`Classes` implements `From<Cow<'_, str>>`
144101
`Classes` implements `From<Option<T>>`
145102
`Classes` implements `From<String>`
146-
>>>>>>> origin/master
147103
and $N others
148104
= note: required for `{integer}` to implement `Into<Classes>`
149105
= note: required for `Classes` to implement `From<Option<{integer}>>`
@@ -162,16 +118,6 @@ error[E0277]: the trait bound `Classes: From<u32>` is not satisfied
162118
| ^^^^ the trait `From<u32>` is not implemented for `Classes`
163119
|
164120
= help: the following other types implement trait `From<T>`:
165-
<<<<<<< HEAD
166-
<Classes as From<&'static str>>
167-
<Classes as From<&Option<T>>>
168-
<Classes as From<&String>>
169-
<Classes as From<&[T]>>
170-
<Classes as From<&implicit_clone::unsync::string::IString>>
171-
<Classes as From<Cow<'static, str>>>
172-
<Classes as From<Option<T>>>
173-
<Classes as From<String>>
174-
=======
175121
`Classes` implements `From<&Option<T>>`
176122
`Classes` implements `From<&String>`
177123
`Classes` implements `From<&[T]>`
@@ -180,7 +126,6 @@ error[E0277]: the trait bound `Classes: From<u32>` is not satisfied
180126
`Classes` implements `From<Cow<'_, str>>`
181127
`Classes` implements `From<Option<T>>`
182128
`Classes` implements `From<String>`
183-
>>>>>>> origin/master
184129
and $N others
185130
= note: required for `u32` to implement `Into<Classes>`
186131
= note: required for `Classes` to implement `From<Option<u32>>`
@@ -199,16 +144,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
199144
| ^^ the trait `From<{integer}>` is not implemented for `Classes`
200145
|
201146
= help: the following other types implement trait `From<T>`:
202-
<<<<<<< HEAD
203-
<Classes as From<&'static str>>
204-
<Classes as From<&Option<T>>>
205-
<Classes as From<&String>>
206-
<Classes as From<&[T]>>
207-
<Classes as From<&implicit_clone::unsync::string::IString>>
208-
<Classes as From<Cow<'static, str>>>
209-
<Classes as From<Option<T>>>
210-
<Classes as From<String>>
211-
=======
212147
`Classes` implements `From<&Option<T>>`
213148
`Classes` implements `From<&String>`
214149
`Classes` implements `From<&[T]>`
@@ -217,7 +152,6 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
217152
`Classes` implements `From<Cow<'_, str>>`
218153
`Classes` implements `From<Option<T>>`
219154
`Classes` implements `From<String>`
220-
>>>>>>> origin/master
221155
and $N others
222156
= note: required for `{integer}` to implement `Into<Classes>`
223157
note: required by a bound in `Classes::push`

packages/yew-macro/tests/html_macro/element-fail.stderr

Lines changed: 2 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -465,44 +465,20 @@ error[E0277]: the trait bound `NotToString: IntoPropValue<Option<implicit_clone:
465465
| ^^^^^^^^^^^ the trait `IntoPropValue<Option<implicit_clone::unsync::string::IString>>` is not implemented for `NotToString`
466466
|
467467
= help: the following other types implement trait `IntoPropValue<T>`:
468-
<<<<<<< HEAD
469-
<&'static [(K, V)] as IntoPropValue<implicit_clone::unsync::map::IMap<K, V>>>
470-
<&'static [T] as IntoPropValue<implicit_clone::unsync::array::IArray<T>>>
471-
<&'static str as IntoPropValue<Classes>>
472-
<&'static str as IntoPropValue<Option<String>>>
473-
<&'static str as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
474-
<&'static str as IntoPropValue<String>>
475-
<&'static str as IntoPropValue<implicit_clone::unsync::string::IString>>
476-
<&ChildrenRenderer<VNode> as IntoPropValue<VNode>>
477-
=======
478468
`&'static [(K, V)]` implements `IntoPropValue<implicit_clone::unsync::map::IMap<K, V>>`
479469
`&'static [T]` implements `IntoPropValue<implicit_clone::unsync::array::IArray<T>>`
480470
`&'static str` implements `IntoPropValue<Classes>`
481471
`&'static str` implements `IntoPropValue<Option<String>>`
482472
`&'static str` implements `IntoPropValue<Option<implicit_clone::unsync::string::IString>>`
483473
`&'static str` implements `IntoPropValue<String>`
484474
`&'static str` implements `IntoPropValue<implicit_clone::unsync::string::IString>`
485-
`&String` implements `IntoPropValue<VNode>`
486-
>>>>>>> origin/master
475+
`&ChildrenRenderer<VNode>` implements `IntoPropValue<VNode>`
487476
and $N others
488477

489478
error[E0277]: the trait bound `Option<NotToString>: IntoPropValue<Option<implicit_clone::unsync::string::IString>>` is not satisfied
490479
--> tests/html_macro/element-fail.rs:47:23
491480
|
492481
47 | html! { <a media={Some(NotToString)} /> };
493-
<<<<<<< HEAD
494-
| ^^^^ the trait `IntoPropValue<Option<implicit_clone::unsync::string::IString>>` is not implemented for `Option<NotToString>`
495-
|
496-
= help: the following other types implement trait `IntoPropValue<T>`:
497-
<Option<&'static str> as IntoPropValue<Option<String>>>
498-
<Option<&'static str> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
499-
<Option<Cow<'static, str>> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
500-
<Option<F> as IntoPropValue<Option<yew::Callback<I, O>>>>
501-
<Option<Rc<str>> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
502-
<Option<String> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
503-
<Option<VChild<T>> as IntoPropValue<Option<ChildrenRenderer<C>>>>
504-
<Option<VNode> as IntoPropValue<VNode>>
505-
=======
506482
| ----^^^^^^^^^^^^^
507483
| |
508484
| 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
517493
`Option<String>` implements `IntoPropValue<Option<implicit_clone::unsync::string::IString>>`
518494
`Option<VChild<T>>` implements `IntoPropValue<Option<ChildrenRenderer<C>>>`
519495
`Option<VNode>` implements `IntoPropValue<VNode>`
520-
>>>>>>> origin/master
521496

522497
error[E0277]: the trait bound `Option<{integer}>: IntoPropValue<Option<implicit_clone::unsync::string::IString>>` is not satisfied
523498
--> tests/html_macro/element-fail.rs:48:22
524499
|
525500
48 | html! { <a href={Some(5)} /> };
526-
<<<<<<< HEAD
527-
| ^^^^ the trait `IntoPropValue<Option<implicit_clone::unsync::string::IString>>` is not implemented for `Option<{integer}>`
528-
|
529-
= help: the following other types implement trait `IntoPropValue<T>`:
530-
<Option<&'static str> as IntoPropValue<Option<String>>>
531-
<Option<&'static str> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
532-
<Option<Cow<'static, str>> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
533-
<Option<F> as IntoPropValue<Option<yew::Callback<I, O>>>>
534-
<Option<Rc<str>> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
535-
<Option<String> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
536-
<Option<VChild<T>> as IntoPropValue<Option<ChildrenRenderer<C>>>>
537-
<Option<VNode> as IntoPropValue<VNode>>
538-
=======
539501
| ----^^^
540502
| |
541503
| 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_
550512
`Option<String>` implements `IntoPropValue<Option<implicit_clone::unsync::string::IString>>`
551513
`Option<VChild<T>>` implements `IntoPropValue<Option<ChildrenRenderer<C>>>`
552514
`Option<VNode>` implements `IntoPropValue<VNode>`
553-
>>>>>>> origin/master
554515

555516
error[E0277]: the trait bound `{integer}: IntoEventCallback<MouseEvent>` is not satisfied
556517
--> tests/html_macro/element-fail.rs:51:28
@@ -660,17 +621,6 @@ error[E0277]: the trait bound `Option<yew::NodeRef>: IntoPropValue<yew::NodeRef>
660621
| required by a bound introduced by this call
661622
|
662623
= help: the following other types implement trait `IntoPropValue<T>`:
663-
<<<<<<< HEAD
664-
<Option<&'static str> as IntoPropValue<Option<String>>>
665-
<Option<&'static str> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
666-
<Option<Cow<'static, str>> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
667-
<Option<F> as IntoPropValue<Option<yew::Callback<I, O>>>>
668-
<Option<Rc<str>> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
669-
<Option<String> as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
670-
<Option<VChild<T>> as IntoPropValue<Option<ChildrenRenderer<C>>>>
671-
<Option<VNode> as IntoPropValue<VNode>>
672-
= note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info)
673-
=======
674624
`Option<&str>` implements `IntoPropValue<Option<String>>`
675625
`Option<&str>` implements `IntoPropValue<Option<implicit_clone::unsync::string::IString>>`
676626
`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>
679629
`Option<String>` implements `IntoPropValue<Option<implicit_clone::unsync::string::IString>>`
680630
`Option<VChild<T>>` implements `IntoPropValue<Option<ChildrenRenderer<C>>>`
681631
`Option<VNode>` implements `IntoPropValue<VNode>`
682-
>>>>>>> origin/master
683632

684633
error[E0277]: the trait bound `yew::Callback<String>: IntoEventCallback<MouseEvent>` is not satisfied
685634
--> tests/html_macro/element-fail.rs:58:29
@@ -716,25 +665,14 @@ error[E0277]: the trait bound `NotToString: IntoPropValue<Option<implicit_clone:
716665
| ^^^^^^^^^^^ the trait `IntoPropValue<Option<implicit_clone::unsync::string::IString>>` is not implemented for `NotToString`
717666
|
718667
= help: the following other types implement trait `IntoPropValue<T>`:
719-
<<<<<<< HEAD
720-
<&'static [(K, V)] as IntoPropValue<implicit_clone::unsync::map::IMap<K, V>>>
721-
<&'static [T] as IntoPropValue<implicit_clone::unsync::array::IArray<T>>>
722-
<&'static str as IntoPropValue<Classes>>
723-
<&'static str as IntoPropValue<Option<String>>>
724-
<&'static str as IntoPropValue<Option<implicit_clone::unsync::string::IString>>>
725-
<&'static str as IntoPropValue<String>>
726-
<&'static str as IntoPropValue<implicit_clone::unsync::string::IString>>
727-
<&ChildrenRenderer<VNode> as IntoPropValue<VNode>>
728-
=======
729668
`&'static [(K, V)]` implements `IntoPropValue<implicit_clone::unsync::map::IMap<K, V>>`
730669
`&'static [T]` implements `IntoPropValue<implicit_clone::unsync::array::IArray<T>>`
731670
`&'static str` implements `IntoPropValue<Classes>`
732671
`&'static str` implements `IntoPropValue<Option<String>>`
733672
`&'static str` implements `IntoPropValue<Option<implicit_clone::unsync::string::IString>>`
734673
`&'static str` implements `IntoPropValue<String>`
735674
`&'static str` implements `IntoPropValue<implicit_clone::unsync::string::IString>`
736-
`&String` implements `IntoPropValue<VNode>`
737-
>>>>>>> origin/master
675+
`&ChildrenRenderer<VNode>` implements `IntoPropValue<VNode>`
738676
and $N others
739677

740678
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
751689
= help: for that trait implementation, expected `VNode`, found `yew::NodeRef`
752690

753691
error[E0277]: the trait bound `implicit_clone::unsync::string::IString: From<{integer}>` is not satisfied
754-
<<<<<<< HEAD
755-
--> tests/html_macro/element-fail.rs:77:16
756-
|
757-
77 | html! { <@{55}></@> };
758-
| ^^ the trait `From<{integer}>` is not implemented for `implicit_clone::unsync::string::IString`
759-
|
760-
= help: the following other types implement trait `From<T>`:
761-
<implicit_clone::unsync::string::IString as From<&'static str>>
762-
<implicit_clone::unsync::string::IString as From<&implicit_clone::unsync::string::IString>>
763-
<implicit_clone::unsync::string::IString as From<Cow<'static, str>>>
764-
<implicit_clone::unsync::string::IString as From<Rc<str>>>
765-
<implicit_clone::unsync::string::IString as From<String>>
766-
= note: required because of the requirements on the impl of `Into<implicit_clone::unsync::string::IString>` for `{integer}`
767-
=======
768692
--> tests/html_macro/element-fail.rs:79:16
769693
|
770694
79 | html! { <@{55}></@> };
@@ -778,4 +702,3 @@ error[E0277]: the trait bound `implicit_clone::unsync::string::IString: From<{in
778702
`implicit_clone::unsync::string::IString` implements `From<Rc<str>>`
779703
`implicit_clone::unsync::string::IString` implements `From<String>`
780704
= note: required for `{integer}` to implement `Into<implicit_clone::unsync::string::IString>`
781-
>>>>>>> origin/master

packages/yew/src/virtual_dom/vlist.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,11 @@ impl VList {
143143
fully_keyed: FullyKeyedState,
144144
) -> Self {
145145
VList {
146-
children: Some(Rc::new(children)),
146+
children: if children.is_empty() {
147+
None
148+
} else {
149+
Some(Rc::new(children))
150+
},
147151
fully_keyed,
148152
key,
149153
}

0 commit comments

Comments
 (0)