mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 06:51:01 +01:00
Use AttrValue::expect_none
with hide
option
This commit is contained in:
parent
547f5889d2
commit
42fd9b8693
1 changed files with 2 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
attr::{fold_attrs, Attr, AttrValue},
|
attr::{fold_attrs, Attr},
|
||||||
error::compile_error_at,
|
error::compile_error_at,
|
||||||
fields_parse::ParserType,
|
fields_parse::ParserType,
|
||||||
rename_rules::RenameRule,
|
rename_rules::RenameRule,
|
||||||
|
@ -104,16 +104,7 @@ 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" => value.expect_none("hide").map(|_| 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…
Reference in a new issue