-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow elements in attributes (redux) (#460)
* Rename control flow nodes to avoid conflict with `syn` tokens * Remove calls to `Token!` * Disallow elements in attributes * Add test * Split `into_element` out of `MaybeElement` * Fix Clippy type complexity
- Loading branch information
1 parent
3eaa6e8
commit b912bd9
Showing
6 changed files
with
282 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use maud::html; | ||
|
||
fn main() { | ||
html! { | ||
a href={ b {} } {} | ||
}; | ||
|
||
html! { | ||
a href=.pinkie-pie {} {} | ||
}; | ||
|
||
html! { | ||
a .{ b {} } {} | ||
}; | ||
|
||
html! { | ||
a #{ b {} } {} | ||
}; | ||
|
||
html! { | ||
@if true { | ||
} @else if true { | ||
} @else { | ||
a href={ b #if-else {} } {} | ||
} | ||
}; | ||
|
||
html! { | ||
@for _ in 0..10 { | ||
a href={ b #for {} } {} | ||
} | ||
}; | ||
|
||
html! { | ||
@while false { | ||
a href={ b #while {} } {} | ||
} | ||
}; | ||
|
||
html! { | ||
@match () { | ||
() => a href={ b #match {} } {} | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
error: expected one of: curly braces, literal, parentheses, `@`, `;` | ||
--> tests/warnings/elements-in-attributes.rs:5:18 | ||
| | ||
5 | a href={ b {} } {} | ||
| ^ | ||
|
||
error: expected one of: curly braces, literal, parentheses, `@`, `;` | ||
--> tests/warnings/elements-in-attributes.rs:9:16 | ||
| | ||
9 | a href=.pinkie-pie {} {} | ||
| ^ | ||
|
||
error: expected one of: curly braces, literal, parentheses, `@`, `;` | ||
--> tests/warnings/elements-in-attributes.rs:13:14 | ||
| | ||
13 | a .{ b {} } {} | ||
| ^ | ||
|
||
error: expected one of: curly braces, literal, parentheses, `@`, `;` | ||
--> tests/warnings/elements-in-attributes.rs:17:14 | ||
| | ||
17 | a #{ b {} } {} | ||
| ^ | ||
|
||
error: expected one of: curly braces, literal, parentheses, `@`, `;` | ||
--> tests/warnings/elements-in-attributes.rs:24:22 | ||
| | ||
24 | a href={ b #if-else {} } {} | ||
| ^ | ||
|
||
error: expected one of: curly braces, literal, parentheses, `@`, `;` | ||
--> tests/warnings/elements-in-attributes.rs:30:22 | ||
| | ||
30 | a href={ b #for {} } {} | ||
| ^ | ||
|
||
error: expected one of: curly braces, literal, parentheses, `@`, `;` | ||
--> tests/warnings/elements-in-attributes.rs:36:22 | ||
| | ||
36 | a href={ b #while {} } {} | ||
| ^ | ||
|
||
error: expected one of: curly braces, literal, parentheses, `@`, `;` | ||
--> tests/warnings/elements-in-attributes.rs:42:28 | ||
| | ||
42 | () => a href={ b #match {} } {} | ||
| ^ |
Oops, something went wrong.