Skip to content

Commit 19384c5

Browse files
committed
chore: minor rename
1 parent 58491b9 commit 19384c5

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
//! `RefRule` generation
1+
//! `ContentTypeRule` generation
22
33
use proc_macro2::TokenStream;
44
use quote::quote;
55

66
use crate::signed_doc_spec::{self, IsRequired};
77

8-
/// Generating `RefRule` instantiation
9-
pub(crate) fn rule(
8+
/// Generating `ContentTypeRule` instantiation
9+
pub(crate) fn into_rule(
1010
content_type: &signed_doc_spec::content_type::ContentType
1111
) -> anyhow::Result<TokenStream> {
1212
if matches!(content_type.required, IsRequired::Excluded) {
@@ -25,25 +25,25 @@ pub(crate) fn rule(
2525
}
2626

2727
let exp = match content_type.value.as_str() {
28-
"application/cbor" => quote! { ContentTypeRule::Cbor },
29-
"application/cddl" => quote! { ContentTypeRule::Cddl },
30-
"application/json" => quote! { ContentTypeRule::Json },
31-
"application/json+schema" => quote! { ContentTypeRule::JsonSchema },
32-
"text/css; charset=utf-8" => quote! { ContentTypeRule::Css },
28+
"application/cbor" => quote! { ContentType::Cbor },
29+
"application/cddl" => quote! { ContentType::Cddl },
30+
"application/json" => quote! { ContentType::Json },
31+
"application/json+schema" => quote! { ContentType::JsonSchema },
32+
"text/css; charset=utf-8" => quote! { ContentType::Css },
3333
"text/css; charset=utf-8; template=handlebars" => {
34-
quote! { ContentTypeRule::CssHandlebars }
34+
quote! { ContentType::CssHandlebars }
3535
},
36-
"text/html; charset=utf-8" => quote! { ContentTypeRule::Html },
36+
"text/html; charset=utf-8" => quote! { ContentType::Html },
3737
"text/html; charset=utf-8; template=handlebars" => {
38-
quote! { ContentTypeRule::HtmlHandlebars }
38+
quote! { ContentType::HtmlHandlebars }
3939
},
40-
"text/markdown; charset=utf-8" => quote! { ContentTypeRule::Markdown },
40+
"text/markdown; charset=utf-8" => quote! { ContentType::Markdown },
4141
"text/markdown; charset=utf-8; template=handlebars" => {
42-
quote! { ContentTypeRule::MarkdownHandlebars }
42+
quote! { ContentType::MarkdownHandlebars }
4343
},
44-
"text/plain; charset=utf-8" => quote! { ContentTypeRule::Plain },
44+
"text/plain; charset=utf-8" => quote! { ContentType::Plain },
4545
"text/plain; charset=utf-8; template=handlebars" => {
46-
quote! { ContentTypeRule::PlainHandlebars }
46+
quote! { ContentType::PlainHandlebars }
4747
},
4848
_ => {
4949
return Err(anyhow::anyhow!(
@@ -55,7 +55,7 @@ pub(crate) fn rule(
5555

5656
Ok(quote! {
5757
crate::validator::rules::ContentTypeRule::Specified {
58-
exp: crate::validator::rules::#exp,
58+
exp: #exp,
5959
}
6060
})
6161
}

rust/catalyst-signed-doc-macro/src/rules/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(crate) fn catalyst_signed_documents_rules_impl() -> anyhow::Result<TokenStre
1616
for (doc_name, doc_spec) in spec.docs {
1717
let const_type_name_ident = doc_name.ident();
1818

19-
let content_type_rule = content_type::rule(&doc_spec.headers.content_type)?;
19+
let content_type_rule = content_type::into_rule(&doc_spec.headers.content_type)?;
2020
let ref_rule = doc_ref::ref_rule(&doc_spec.metadata.doc_ref)?;
2121
// TODO: implement a proper initialization for all specific validation rules
2222
let rules = quote! {

0 commit comments

Comments
 (0)