Fix typos
This commit is contained in:
parent
44b61c5534
commit
5fb87250dd
|
@ -26,7 +26,8 @@
|
|||
"tamasfe.even-better-toml",
|
||||
"serayuzgur.crates",
|
||||
"redhat.vscode-yaml",
|
||||
"eamodio.gitlens"
|
||||
"eamodio.gitlens",
|
||||
"streetsidesoftware.code-spell-checker"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
@ -111,27 +111,27 @@ fn generate_builder_field(
|
|||
parameter: &parser::ReturnTypeParameter,
|
||||
enum_names: &HashMap<String, String>,
|
||||
) -> proc_macro2::TokenStream {
|
||||
let namestr = ¶meter.name;
|
||||
let name = util::to_ident(&namestr.to_snake().replace("__", "_"));
|
||||
let enum_name = match enum_names.get(namestr) {
|
||||
let name_string = ¶meter.name;
|
||||
let name = util::to_ident(&name_string.to_snake().replace("__", "_"));
|
||||
let enum_name = match enum_names.get(name_string) {
|
||||
Some(enum_type) => enum_type.to_owned(),
|
||||
None => parameter.return_type.to_owned_type(),
|
||||
};
|
||||
let rtype = util::to_ident(&enum_name);
|
||||
let rtype_as_quote = if parameter.return_type.is_list() {
|
||||
quote! { std::vec::Vec<#rtype> }
|
||||
let return_type = util::to_ident(&enum_name);
|
||||
let return_type_as_quote = if parameter.return_type.is_list() {
|
||||
quote! { std::vec::Vec<#return_type> }
|
||||
} else {
|
||||
quote! { #rtype }
|
||||
quote! { #return_type }
|
||||
};
|
||||
let generate_field = |field_name| {
|
||||
quote! {
|
||||
#[serde(rename = #namestr)]
|
||||
pub #field_name: #rtype_as_quote
|
||||
#[serde(rename = #name_string)]
|
||||
pub #field_name: #return_type_as_quote
|
||||
}
|
||||
};
|
||||
|
||||
// "type" is a reserved keyword in Rust, so we just add "t_" to it.
|
||||
if namestr == "type" {
|
||||
if name_string == "type" {
|
||||
generate_field(format_ident!("t_{}", name))
|
||||
} else {
|
||||
generate_field(name)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum MdContent {
|
||||
Text(String),
|
||||
Asterix(String),
|
||||
Asterisk(String),
|
||||
Table(Table),
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ impl MdContent {
|
|||
pub fn inner_value_as_string(&self) -> String {
|
||||
match self {
|
||||
MdContent::Text(text) => text.into(),
|
||||
MdContent::Asterix(text) => text.into(),
|
||||
MdContent::Asterisk(text) => text.into(),
|
||||
MdContent::Table(table) => table.raw(),
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ impl MdToken {
|
|||
content: line.trim_matches('#').trim().to_string(),
|
||||
})
|
||||
} else if line.starts_with('*') {
|
||||
MdToken::Content(MdContent::Asterix(
|
||||
MdToken::Content(MdContent::Asterisk(
|
||||
line.trim_matches('*').trim().to_string(),
|
||||
))
|
||||
} else {
|
||||
|
|
|
@ -113,8 +113,8 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn should_remove_surrounding_asterix() {
|
||||
run_test!("should_remove_surrounding_asterix");
|
||||
fn should_remove_surrounding_asterisk() {
|
||||
run_test!("should_remove_surrounding_asterisk");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -32,7 +32,7 @@ TokenTree {
|
|||
Text(
|
||||
"",
|
||||
),
|
||||
Asterix(
|
||||
Asterisk(
|
||||
"Parameters:",
|
||||
),
|
||||
Text(
|
||||
|
@ -114,7 +114,7 @@ TokenTree {
|
|||
Text(
|
||||
"",
|
||||
),
|
||||
Asterix(
|
||||
Asterisk(
|
||||
"Returns:",
|
||||
),
|
||||
Text(
|
||||
|
|
|
@ -7,7 +7,7 @@ TokenTree {
|
|||
"A",
|
||||
),
|
||||
content: [
|
||||
Asterix(
|
||||
Asterisk(
|
||||
"B",
|
||||
),
|
||||
],
|
|
@ -5,7 +5,7 @@ pub fn parse_method_description(content: &[MdContent]) -> Option<String> {
|
|||
.iter()
|
||||
// skip until we get to the "Returns:" text
|
||||
.skip_while(|row| match row {
|
||||
MdContent::Asterix(text) => !text.starts_with("Returns:"),
|
||||
MdContent::Asterisk(text) => !text.starts_with("Returns:"),
|
||||
_ => true,
|
||||
})
|
||||
// there is one space before the table
|
||||
|
|
|
@ -6,7 +6,7 @@ pub fn parse_parameters(content: &[md_parser::MdContent]) -> Option<Vec<types::T
|
|||
let mut it = content
|
||||
.iter()
|
||||
.skip_while(|row| match row {
|
||||
md_parser::MdContent::Asterix(content) | md_parser::MdContent::Text(content) => {
|
||||
md_parser::MdContent::Asterisk(content) | md_parser::MdContent::Text(content) => {
|
||||
!content.starts_with("Parameters:")
|
||||
}
|
||||
_ => true,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user