mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-22 06:45:37 +01:00
This commit is contained in:
parent
19a16d21eb
commit
7881a1cb78
1 changed files with 11 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
attr::{fold_attrs, Attr},
|
attr::{fold_attrs, Attr, AttrValue},
|
||||||
error::compile_error_at,
|
error::compile_error_at,
|
||||||
fields_parse::ParserType,
|
fields_parse::ParserType,
|
||||||
rename_rules::RenameRule,
|
rename_rules::RenameRule,
|
||||||
|
@ -104,7 +104,16 @@ impl CommandAttr {
|
||||||
"rename" => Rename(value.expect_string()?),
|
"rename" => Rename(value.expect_string()?),
|
||||||
"parse_with" => ParseWith(ParserType::parse(value)?),
|
"parse_with" => ParseWith(ParserType::parse(value)?),
|
||||||
"separator" => Separator(value.expect_string()?),
|
"separator" => Separator(value.expect_string()?),
|
||||||
"hide" => Hide,
|
"hide" => {
|
||||||
|
if let AttrValue::None(_) = value {
|
||||||
|
Hide
|
||||||
|
} else {
|
||||||
|
return Err(compile_error_at(
|
||||||
|
"The hide attribute should not have a value, remove it ",
|
||||||
|
value.span(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err(compile_error_at(
|
return Err(compile_error_at(
|
||||||
"unexpected attribute name (expected one of `prefix`, `description`, \
|
"unexpected attribute name (expected one of `prefix`, `description`, \
|
||||||
|
|
Loading…
Add table
Reference in a new issue