@@ -4,7 +4,8 @@ macro_rules! storage_of {
44 ( $id: ident, [ $( $value: expr) ,* ] ) => { std:: collections:: HashSet <String > } ;
55 ( $id: ident, $( =int $check: expr; ) + $_: expr) => { i64 } ;
66 ( $id: ident, $( =enum $k: ident; ) + $_: ident) => { $crate:: defaults:: enums:: $id } ;
7- ( $id: ident, $_: expr) => { Option <Box <str >> } ;
7+ ( $id: ident, None ) => { Option <Box <str >> } ;
8+ ( $id: ident, $_: expr) => { Box <str > } ;
89}
910
1011macro_rules! referent_of {
@@ -13,7 +14,8 @@ macro_rules! referent_of {
1314 ( $id: ident, [ $( $value: expr) ,* ] ) => { & std:: collections:: HashSet <String > } ;
1415 ( $id: ident, $( =int $check: expr; ) + $_: expr) => { i64 } ;
1516 ( $id: ident, $( =enum $k: ident; ) + $_: ident) => { $crate:: defaults:: enums:: $id } ;
16- ( $id: ident, $_: expr) => { Option <& str > } ;
17+ ( $id: ident, None ) => { Option <& str > } ;
18+ ( $id: ident, $_: expr) => { & str } ;
1719}
1820
1921macro_rules! initializer_of {
@@ -23,7 +25,7 @@ macro_rules! initializer_of {
2325 ( $id: ident, $( =int $check: expr; ) + $value: expr) => { $value } ;
2426 ( $id: ident, $( =enum $k: ident; ) + $value: ident) => { $crate:: defaults:: enums:: $id:: $value } ;
2527 ( $id: ident, None ) => { None } ;
26- ( $id: ident, $value: expr) => { Some ( $value. into( ) ) } ;
28+ ( $id: ident, $value: expr) => { $value. into( ) } ;
2729 ( $id: ident, $( $_: tt) * ) => { return None } ;
2830}
2931
@@ -40,9 +42,12 @@ macro_rules! result_of {
4042 ( $id: expr, $( =value $k: expr; ) + $_: expr) => {
4143 $id
4244 } ;
43- ( $id: expr, $_ : expr ) => {
45+ ( $id: expr, None ) => {
4446 $id. as_deref( )
4547 } ;
48+ ( $id: expr, $_: expr) => {
49+ $id. as_ref( )
50+ } ;
4651}
4752
4853macro_rules! modifier_of {
@@ -103,7 +108,7 @@ macro_rules! modifier_of {
103108 ( $id: ident, $value: expr) => {
104109 $crate:: defaults:: SettingKind :: Text ( |text| {
105110 let text = text. into( ) ;
106- Some ( Box :: new( move |obj: & mut Settings | obj. $id = Some ( text) ) )
111+ Some ( Box :: new( move |obj: & mut Settings | obj. $id = text) )
107112 } )
108113 } ;
109114}
0 commit comments