Refactor Parser::parse_item_doc
This patch simplifies the Parser::parse_item_doc function by collecting all members before pushing them into the member groups.
This commit is contained in:
parent
93575ab452
commit
1e9da34694
@ -77,25 +77,17 @@ impl Parser {
|
|||||||
doc.description = description.map(From::from);
|
doc.description = description.map(From::from);
|
||||||
doc.definition = definition.map(From::from);
|
doc.definition = definition.map(From::from);
|
||||||
|
|
||||||
let (ty, groups) = get_variants(&self.document, name)?;
|
let members = vec![
|
||||||
if !groups.is_empty() {
|
get_variants(&self.document, name)?,
|
||||||
doc.groups.push((ty, groups));
|
get_fields(&self.document, name)?,
|
||||||
}
|
get_assoc_types(&self.document, name)?,
|
||||||
let (ty, groups) = get_fields(&self.document, name)?;
|
get_methods(&self.document, name)?,
|
||||||
if !groups.is_empty() {
|
get_implementations(&self.document, name)?,
|
||||||
doc.groups.push((ty, groups));
|
];
|
||||||
}
|
for (ty, groups) in members.into_iter() {
|
||||||
let (ty, groups) = get_assoc_types(&self.document, name)?;
|
if !groups.is_empty() {
|
||||||
if !groups.is_empty() {
|
doc.groups.push((ty, groups));
|
||||||
doc.groups.push((ty, groups));
|
}
|
||||||
}
|
|
||||||
let (ty, groups) = get_methods(&self.document, name)?;
|
|
||||||
if !groups.is_empty() {
|
|
||||||
doc.groups.push((ty, groups));
|
|
||||||
}
|
|
||||||
let (ty, groups) = get_implementations(&self.document, name)?;
|
|
||||||
if !groups.is_empty() {
|
|
||||||
doc.groups.push((ty, groups));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(doc)
|
Ok(doc)
|
||||||
|
Loading…
Reference in New Issue
Block a user