Skip to content

Commit

Permalink
refactor(mrml-core): format code
Browse files Browse the repository at this point in the history
Signed-off-by: Jérémie Drouet <[email protected]>
  • Loading branch information
jdrouet committed Jul 30, 2023
1 parent 4f94b98 commit 08590cf
Show file tree
Hide file tree
Showing 23 changed files with 44 additions and 42 deletions.
4 changes: 1 addition & 3 deletions packages/mrml-core/src/mj_accordion/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use xmlparser::StrSpan;
use super::{MjAccordion, MjAccordionChild};
use crate::comment::Comment;
use crate::mj_accordion_element::NAME as MJ_ACCORDION_ELEMENT;
use crate::prelude::parser::{
ChildrenParser, ElementParser, Error, MrmlParser, MrmlToken,
};
use crate::prelude::parser::{ChildrenParser, ElementParser, Error, MrmlParser, MrmlToken};

impl<'a> ChildrenParser<'a, Vec<MjAccordionChild>> for MrmlParser<'a> {
fn parse_children(&mut self) -> Result<Vec<MjAccordionChild>, Error> {
Expand Down
6 changes: 2 additions & 4 deletions packages/mrml-core/src/mj_accordion_title/parse.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use xmlparser::StrSpan;

use super::MjAccordionTitle;
use crate::{
prelude::parser::{ChildrenParser, ElementParser, Error, MrmlParser},
text::Text,
};
use crate::prelude::parser::{ChildrenParser, ElementParser, Error, MrmlParser};
use crate::text::Text;

impl<'a> ChildrenParser<'a, Vec<Text>> for MrmlParser<'a> {
fn parse_children(&mut self) -> Result<Vec<Text>, Error> {
Expand Down
3 changes: 2 additions & 1 deletion packages/mrml-core/src/mj_attributes/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ impl<'a> ElementParser<'a, MjAttributes> for MrmlParser<'a> {

#[cfg(test)]
mod tests {
use crate::{mj_attributes::MjAttributes, prelude::parser::MrmlParser};
use crate::mj_attributes::MjAttributes;
use crate::prelude::parser::MrmlParser;

#[test]
fn parse_complete() {
Expand Down
3 changes: 2 additions & 1 deletion packages/mrml-core/src/mj_attributes_all/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ impl<'a> ElementParser<'a, MjAttributesAll> for MrmlParser<'a> {

#[cfg(test)]
mod tests {
use crate::{mj_attributes_all::MjAttributesAll, prelude::parser::MrmlParser};
use crate::mj_attributes_all::MjAttributesAll;
use crate::prelude::parser::MrmlParser;

#[test]
fn parse_complete() {
Expand Down
3 changes: 2 additions & 1 deletion packages/mrml-core/src/mj_attributes_class/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ impl<'a> ElementParser<'a, MjAttributesClass> for MrmlParser<'a> {

#[cfg(test)]
mod tests {
use crate::{mj_attributes_class::MjAttributesClass, prelude::parser::MrmlParser};
use crate::mj_attributes_class::MjAttributesClass;
use crate::prelude::parser::MrmlParser;

#[test]
fn parse_complete() {
Expand Down
3 changes: 2 additions & 1 deletion packages/mrml-core/src/mj_attributes_element/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ impl<'a> ElementParser<'a, MjAttributesElement> for MrmlParser<'a> {

#[cfg(test)]
mod tests {
use crate::{mj_attributes::MjAttributes, prelude::parser::MrmlParser};
use crate::mj_attributes::MjAttributes;
use crate::prelude::parser::MrmlParser;

#[test]
fn parse_complete() {
Expand Down
3 changes: 2 additions & 1 deletion packages/mrml-core/src/mj_body/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ impl<'a> ElementParser<'a, MjBody> for MrmlParser<'a> {

#[cfg(test)]
mod tests {
use crate::{mj_body::MjBody, prelude::parser::MrmlParser};
use crate::mj_body::MjBody;
use crate::prelude::parser::MrmlParser;

#[test]
fn parse_complete() {
Expand Down
3 changes: 2 additions & 1 deletion packages/mrml-core/src/mj_breakpoint/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ impl<'a> ElementParser<'a, MjBreakpoint> for MrmlParser<'a> {

#[cfg(test)]
mod tests {
use crate::{mj_breakpoint::MjBreakpoint, prelude::parser::MrmlParser};
use crate::mj_breakpoint::MjBreakpoint;
use crate::prelude::parser::MrmlParser;

#[test]
fn success() {
Expand Down
3 changes: 2 additions & 1 deletion packages/mrml-core/src/mj_button/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ impl<'a> ElementParser<'a, MjButton> for MrmlParser<'a> {

#[cfg(test)]
mod tests {
use crate::{mj_button::MjButton, prelude::parser::MrmlParser};
use crate::mj_button::MjButton;
use crate::prelude::parser::MrmlParser;

#[test]
fn success() {
Expand Down
7 changes: 3 additions & 4 deletions packages/mrml-core/src/mj_carousel/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use xmlparser::StrSpan;
use super::{MjCarousel, MjCarouselChild};
use crate::comment::Comment;
use crate::mj_carousel_image::NAME as MJ_CAROUSEL_IMAGE;
use crate::prelude::parser::{
ChildrenParser, ElementParser, Error, MrmlParser, MrmlToken,
};
use crate::prelude::parser::{ChildrenParser, ElementParser, Error, MrmlParser, MrmlToken};

impl<'a> ChildrenParser<'a, Vec<MjCarouselChild>> for MrmlParser<'a> {
fn parse_children(&mut self) -> Result<Vec<MjCarouselChild>, Error> {
Expand Down Expand Up @@ -46,7 +44,8 @@ impl<'a> ElementParser<'a, MjCarousel> for MrmlParser<'a> {

#[cfg(test)]
mod tests {
use crate::{mj_carousel::MjCarousel, prelude::parser::MrmlParser};
use crate::mj_carousel::MjCarousel;
use crate::prelude::parser::MrmlParser;

#[test]
fn with_all_children() {
Expand Down
3 changes: 2 additions & 1 deletion packages/mrml-core/src/mj_font/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ impl<'a> ElementParser<'a, MjFont> for MrmlParser<'a> {

#[cfg(test)]
mod tests {
use crate::{mj_font::MjFont, prelude::parser::MrmlParser};
use crate::mj_font::MjFont;
use crate::prelude::parser::MrmlParser;

#[test]
fn success() {
Expand Down
3 changes: 2 additions & 1 deletion packages/mrml-core/src/mj_head/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ impl<'a> ElementParser<'a, MjHeadChild> for MrmlParser<'a> {

#[cfg(test)]
mod tests {
use crate::{mj_head::MjHead, prelude::parser::MrmlParser};
use crate::mj_head::MjHead;
use crate::prelude::parser::MrmlParser;

#[test]
fn raw_children() {
Expand Down
4 changes: 1 addition & 3 deletions packages/mrml-core/src/mj_navbar/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use xmlparser::StrSpan;
use super::{MjNavbar, MjNavbarChild};
use crate::comment::Comment;
use crate::mj_navbar_link::NAME as MJ_NAVBAR_LINK;
use crate::prelude::parser::{
ChildrenParser, ElementParser, Error, MrmlParser, MrmlToken,
};
use crate::prelude::parser::{ChildrenParser, ElementParser, Error, MrmlParser, MrmlToken};

impl<'a> ChildrenParser<'a, Vec<MjNavbarChild>> for MrmlParser<'a> {
fn parse_children(&mut self) -> Result<Vec<MjNavbarChild>, Error> {
Expand Down
3 changes: 2 additions & 1 deletion packages/mrml-core/src/mj_preview/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ impl<'a> ElementParser<'a, MjPreview> for MrmlParser<'a> {

#[cfg(test)]
mod tests {
use crate::{mj_preview::MjPreview, prelude::parser::MrmlParser};
use crate::mj_preview::MjPreview;
use crate::prelude::parser::MrmlParser;

#[test]
fn should_parse() {
Expand Down
4 changes: 1 addition & 3 deletions packages/mrml-core/src/mj_social/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use xmlparser::StrSpan;
use super::{MjSocial, MjSocialChild};
use crate::comment::Comment;
use crate::mj_social_element::NAME as MJ_SOCIAL_ELEMENT;
use crate::prelude::parser::{
ChildrenParser, ElementParser, Error, MrmlParser, MrmlToken,
};
use crate::prelude::parser::{ChildrenParser, ElementParser, Error, MrmlParser, MrmlToken};

impl<'a> ChildrenParser<'a, Vec<MjSocialChild>> for MrmlParser<'a> {
fn parse_children(&mut self) -> Result<Vec<MjSocialChild>, Error> {
Expand Down
3 changes: 2 additions & 1 deletion packages/mrml-core/src/mj_social_element/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ impl<'a> ElementParser<'a, MjSocialElement> for MrmlParser<'a> {

#[cfg(test)]
mod tests {
use crate::{mj_social_element::MjSocialElement, prelude::parser::MrmlParser};
use crate::mj_social_element::MjSocialElement;
use crate::prelude::parser::MrmlParser;

#[test]
fn parse_with_empty_children() {
Expand Down
3 changes: 2 additions & 1 deletion packages/mrml-core/src/mj_style/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ impl<'a> ElementParser<'a, MjStyle> for MrmlParser<'a> {

#[cfg(test)]
mod tests {
use crate::{mj_style::MjStyle, prelude::parser::MrmlParser};
use crate::mj_style::MjStyle;
use crate::prelude::parser::MrmlParser;

#[test]
fn should_work_empty() {
Expand Down
3 changes: 2 additions & 1 deletion packages/mrml-core/src/mj_title/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ impl<'a> ElementParser<'a, MjTitle> for MrmlParser<'a> {

#[cfg(test)]
mod tests {
use crate::{mj_title::MjTitle, prelude::parser::MrmlParser};
use crate::mj_title::MjTitle;
use crate::prelude::parser::MrmlParser;

#[test]
fn success() {
Expand Down
3 changes: 1 addition & 2 deletions packages/mrml-core/src/mjml/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ use xmlparser::StrSpan;
use super::{Mjml, MjmlAttributes, MjmlChildren};
use crate::mj_body::NAME as MJ_BODY;
use crate::mj_head::NAME as MJ_HEAD;
use crate::prelude::parser::Error;
use crate::prelude::parser::{
self, AttributesParser, ChildrenParser, ElementParser, MrmlParser, MrmlToken,
self, AttributesParser, ChildrenParser, ElementParser, Error, MrmlParser, MrmlToken,
};

impl<'a> AttributesParser<'a, MjmlAttributes> for MrmlParser<'a> {
Expand Down
6 changes: 2 additions & 4 deletions packages/mrml-core/src/node/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@
// &mut self,
// tag: xmlparser::StrSpan<'a>,
// tokenizer: &mut xmlparser::Tokenizer<'a>,
// ) -> Result<(), Error> {
// self.children
// .push(T::parse(tag, tokenizer, self.opts.clone())?);
// Ok(())
// ) -> Result<(), Error> { self.children .push(T::parse(tag, tokenizer,
// self.opts.clone())?); Ok(())
// }

// parse_comment!();
Expand Down
4 changes: 2 additions & 2 deletions packages/mrml-core/src/prelude/parser/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ pub trait IncludeLoader: std::fmt::Debug {
///
/// You can have an example of simple resolve function with the
/// [`MemoryIncludeLoader`](crate::prelude::parser::memory_loader::MemoryIncludeLoader).
///
fn resolve(&self, path: &str) -> Result<String, IncludeLoaderError>;
}

#[cfg(test)]
mod tests {
use std::{io::ErrorKind, sync::Arc};
use std::io::ErrorKind;
use std::sync::Arc;

use super::IncludeLoaderError;

Expand Down
5 changes: 3 additions & 2 deletions packages/mrml-core/src/prelude/parser/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use std::{convert::TryFrom, fmt::Display, sync::Arc};
use std::convert::TryFrom;
use std::fmt::Display;
use std::sync::Arc;

use xmlparser::{StrSpan, Token, Tokenizer};

use self::loader::IncludeLoaderError;

use super::hash::Map;

#[cfg(feature = "http-loader-base")]
Expand Down
4 changes: 2 additions & 2 deletions packages/mrml-core/src/prelude/parser/noop_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use crate::prelude::parser::loader::IncludeLoader;

#[derive(Debug, Default)]
/// This struct is a simple
/// [`IncludeLoader`](crate::prelude::parser::loader::IncludeLoader) that doesn't
/// resolve any template. This is the default loader.
/// [`IncludeLoader`](crate::prelude::parser::loader::IncludeLoader) that
/// doesn't resolve any template. This is the default loader.
///
/// # Example
/// ```rust
Expand Down

0 comments on commit 08590cf

Please sign in to comment.