aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--askama_parser/src/node.rs17
1 files changed, 5 insertions, 12 deletions
diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs
index b9685e8..4a0fa30 100644
--- a/askama_parser/src/node.rs
+++ b/askama_parser/src/node.rs
@@ -699,18 +699,11 @@ pub enum Whitespace {
impl Whitespace {
fn parse(i: &str) -> IResult<&str, Self> {
- alt((char('-'), char('+'), char('~')))(i).map(|(s, r)| (s, Self::from(r)))
- }
-}
-
-impl From<char> for Whitespace {
- fn from(c: char) -> Self {
- match c {
- '+' => Self::Preserve,
- '-' => Self::Suppress,
- '~' => Self::Minimize,
- _ => panic!("unsupported `Whitespace` conversion"),
- }
+ alt((
+ value(Self::Preserve, char('+')),
+ value(Self::Suppress, char('-')),
+ value(Self::Minimize, char('~')),
+ ))(i)
}
}