make trailing commas in components optional
This commit is contained in:
1 parent
6a16df835d
commit
3f1d525734
1 file changed
+1
-5
@@ -243,16 +243,12 @@ impl Parse for ComponentField {
|
|||||||
let forked = input.fork();
|
let forked = input.fork();
|
||||||
let t: LitStr = forked.parse()?;
|
let t: LitStr = forked.parse()?;
|
||||||
// the string literal must either be the end of the input or a followed by a comma
|
// the string literal must either be the end of the input or a followed by a comma
|
||||||
if (forked.is_empty() || forked.peek(Token![,])) && is_literal_foramtted(&t) {
|
if is_literal_foramtted(&t) {
|
||||||
let content = ContentField::Formatted(input.parse()?);
|
let content = ContentField::Formatted(input.parse()?);
|
||||||
return Ok(Self { name, content });
|
return Ok(Self { name, content });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if input.peek(LitStr) && input.peek2(LitStr) {
|
|
||||||
missing_trailing_comma!(input.span());
|
|
||||||
}
|
|
||||||
|
|
||||||
let content = ContentField::ManExpr(input.parse()?);
|
let content = ContentField::ManExpr(input.parse()?);
|
||||||
Ok(Self { name, content })
|
Ok(Self { name, content })
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user