diff options
Diffstat (limited to 'document_tree/src/elements.rs')
| -rw-r--r-- | document_tree/src/elements.rs | 42 | 
1 files changed, 21 insertions, 21 deletions
| diff --git a/document_tree/src/elements.rs b/document_tree/src/elements.rs index 1db0a24..e32c677 100644 --- a/document_tree/src/elements.rs +++ b/document_tree/src/elements.rs @@ -59,7 +59,7 @@ macro_rules! impl_element { ($name:ident) => (  macro_rules! impl_children { ($name:ident, $childtype:ident) => (  	impl HasChildren<$childtype> for $name {  		#[allow(clippy::needless_update)] -		fn with_children(children: Vec<$childtype>) -> $name { $name { children: children, ..Default::default() } } +		fn with_children(children: Vec<$childtype>) -> $name { $name { children, ..Default::default() } }  		fn children    (&    self) -> &    Vec<$childtype> { &    self.children }  		fn children_mut(&mut self) -> &mut Vec<$childtype> { &mut self.children }  	} @@ -68,7 +68,7 @@ macro_rules! impl_children { ($name:ident, $childtype:ident) => (  macro_rules! impl_extra { ($name:ident $($more:tt)*) => (  	impl ExtraAttributes<extra_attributes::$name> for $name {  		#[allow(clippy::needless_update)] -		fn with_extra(extra: extra_attributes::$name) -> $name { $name { common: Default::default(), extra: extra $($more)* } } +		fn with_extra(extra: extra_attributes::$name) -> $name { $name { common: Default::default(), extra $($more)* } }  		fn extra    (&    self) -> &    extra_attributes::$name { &    self.extra }  		fn extra_mut(&mut self) -> &mut extra_attributes::$name { &mut self.extra }  	} @@ -82,7 +82,7 @@ impl<T, C, A> HasExtraAndChildren<C, A> for T where T: HasChildren<C> + ExtraAtt  	#[allow(clippy::needless_update)]  	fn with_extra_and_children(extra: A, mut children: Vec<C>) -> Self {  		let mut r = Self::with_extra(extra); -		r.children_mut().extend(children.drain(..)); +		r.children_mut().append(&mut children);  		r  	}  } @@ -96,11 +96,11 @@ macro_rules! impl_new {(  ) => (  	$(#[$attr])*  	#[derive(Debug,PartialEq,Serialize,Clone)] -	pub struct $name { $(  +	pub struct $name { $(  		$(#[$fattr])* $field: $typ,  	)* }  	impl $name { -		pub fn new( $( $field: $typ, )* ) -> $name { $name { $( $field: $field, )* } } +		pub fn new( $( $field: $typ, )* ) -> $name { $name { $( $field, )* } }  	}  )} @@ -156,14 +156,14 @@ impl_elems!(  	(Section, StructuralSubElement)  	(Topic,   SubTopic)  	(Sidebar, SubSidebar) -	 +  	//structural subelements  	(Title,      TextOrInlineElement)  	(Subtitle,   TextOrInlineElement)  	(Decoration, DecorationElement)  	(Docinfo,    BibliographicElement)  	(Transition) -	 +  	//bibliographic elements  	(Author,       TextOrInlineElement)  	(Authors,      AuthorInfo) @@ -176,11 +176,11 @@ impl_elems!(  	(Date,         TextOrInlineElement)  	(Copyright,    TextOrInlineElement)  	(Field,        SubField) -	 +  	//decoration elements  	(Header, BodyElement)  	(Footer, BodyElement) -	 +  	//simple body elements  	(Paragraph,              TextOrInlineElement)  	(LiteralBlock,           TextOrInlineElement; +) @@ -193,17 +193,17 @@ impl_elems!(  	(Target; +)  	(Raw, String; +)  	(Image; *) -	 +  	//compound body elements  	(Compound,  BodyElement)  	(Container, BodyElement) -	 +  	(BulletList,     ListItem; +)  	(EnumeratedList, ListItem; +)  	(DefinitionList, DefinitionListItem)  	(FieldList,      Field)  	(OptionList,     OptionListItem) -	 +  	(LineBlock,     SubLineBlock)  	(BlockQuote,    SubBlockQuote)  	(Admonition,    SubTopic) @@ -229,32 +229,32 @@ impl_elems!(  	(TableRow,   TableEntry;    +)  	(TableEntry, BodyElement;   +)  	(TableColspec; +) -	 +  	//body sub elements  	(ListItem, BodyElement) -	 +  	(DefinitionListItem, SubDLItem)  	(Term,               TextOrInlineElement)  	(Classifier,         TextOrInlineElement)  	(Definition,         BodyElement) -	 +  	(FieldName, TextOrInlineElement)  	(FieldBody, BodyElement) -	 +  	(OptionListItem, SubOptionListItem)  	(OptionGroup,    Option_)  	(Description,    BodyElement)  	(Option_,        SubOption)  	(OptionString,   String)  	(OptionArgument, String; +) -	 +  	(Line,        TextOrInlineElement)  	(Attribution, TextOrInlineElement)  	(Label,       TextOrInlineElement) -	 +  	(Caption, TextOrInlineElement)  	(Legend,  BodyElement) -	 +  	//inline elements  	(Emphasis,              TextOrInlineElement)  	(Literal,               String) @@ -272,12 +272,12 @@ impl_elems!(  	(Problematic,           TextOrInlineElement; +)  	(Generated,             TextOrInlineElement)  	(Math,                  String) -	 +  	//also have non-inline versions. Inline image is no figure child, inline target has content  	(TargetInline, String; +)  	(RawInline,    String; +)  	(ImageInline; *) -	 +  	//text element = String  ); | 
