File tree Expand file tree Collapse file tree 1 file changed +15
-17
lines changed
rust/catalyst-signed-doc-macro/src/rules Expand file tree Collapse file tree 1 file changed +15
-17
lines changed Original file line number Diff line number Diff line change @@ -33,21 +33,19 @@ pub(crate) fn into_rule(
3333 anyhow:: ensure!( !is_field_empty, "'value' field must exist" ) ;
3434 }
3535
36- if let Some ( value) = & field. value {
37- let template = ContentTypeTemplate ( value. clone ( ) ) ;
38- let Some ( _) = content_types. get ( & template) else {
39- return Err ( anyhow:: anyhow!( "Unsupported Content Type: {}" , value) ) ;
40- } ;
41- let ident = template. ident ( ) ;
42-
43- Ok ( quote ! {
44- crate :: validator:: rules:: ContentTypeRule :: Specified {
45- exp: ContentType :: #ident,
46- }
47- } )
48- } else {
49- Ok ( quote ! {
50- crate :: validator:: rules:: ContentTypeRule :: NotSpecified
51- } )
52- }
36+ let Some ( value) = & field. value else {
37+ anyhow:: bail!( "'value' field must exist" ) ;
38+ } ;
39+
40+ let template = ContentTypeTemplate ( value. clone ( ) ) ;
41+ let Some ( _) = content_types. get ( & template) else {
42+ return Err ( anyhow:: anyhow!( "Unsupported Content Type: {}" , value) ) ;
43+ } ;
44+ let ident = template. ident ( ) ;
45+
46+ Ok ( quote ! {
47+ crate :: validator:: rules:: ContentTypeRule :: Specified {
48+ exp: ContentType :: #ident,
49+ }
50+ } )
5351}
You can’t perform that action at this time.
0 commit comments