File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
packages/yew-macro/src/html_tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -43,18 +43,22 @@ impl Parse for HtmlFor {
4343 braced ! ( body_stream in input) ;
4444
4545 let body = HtmlChildrenTree :: parse_delimited ( & body_stream) ?;
46- // TODO: reduce nesting by using if-let guards / let-else statements once MSRV is raised
46+ // TODO: more concise code by using if-let guards once MSRV is raised
4747 for child in body. 0 . iter ( ) {
48- if let HtmlTree :: Element ( element) = child {
49- if let Some ( key) = & element. props . special . key {
50- if is_contextless_pure ( & key. value ) {
51- return Err ( syn:: Error :: new (
52- key. value . span ( ) ,
53- "duplicate key for a node in a `for`-loop\n this will create elements \
48+ let HtmlTree :: Element ( element) = child else {
49+ continue ;
50+ } ;
51+
52+ let Some ( key) = & element. props . special . key else {
53+ continue ;
54+ } ;
55+
56+ if is_contextless_pure ( & key. value ) {
57+ return Err ( syn:: Error :: new (
58+ key. value . span ( ) ,
59+ "duplicate key for a node in a `for`-loop\n this will create elements \
5460 with duplicate keys if the loop iterates more than once",
55- ) ) ;
56- }
57- }
61+ ) ) ;
5862 }
5963 }
6064 Ok ( Self { pat, iter, body } )
You can’t perform that action at this time.
0 commit comments