Skip to content

Commit

Permalink
Rename ParentIdent to ParentIndent (#101)
Browse files Browse the repository at this point in the history
Signed-off-by: max <[email protected]>
  • Loading branch information
PizzasBear authored Jan 9, 2024
1 parent f7eb8d1 commit ad49901
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions formatter/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use syn::{
File, Macro,
};

use crate::{ParentIdent, ViewMacro};
use crate::{ParentIndent, ViewMacro};

struct ViewMacroVisitor<'ast> {
macros: Vec<ViewMacro<'ast>>,
Expand All @@ -26,7 +26,7 @@ impl<'ast> Visit<'ast> for ViewMacroVisitor<'ast> {
let tabs = indent_chars.iter().filter(|&&c| c == '\t').count();
let spaces = indent_chars.iter().filter(|&&c| c == ' ').count();

if let Some(view_mac) = ViewMacro::try_parse(ParentIdent { tabs, spaces }, node) {
if let Some(view_mac) = ViewMacro::try_parse(ParentIndent { tabs, spaces }, node) {
self.macros.push(view_mac);
}
}
Expand Down
10 changes: 5 additions & 5 deletions formatter/src/formatter/mac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use syn::{spanned::Spanned, Macro};
use super::{Formatter, FormatterSettings};

pub struct ViewMacro<'a> {
pub parent_ident: ParentIdent,
pub parent_indent: ParentIndent,
pub cx: Option<TokenTree>,
pub global_class: Option<TokenTree>,
pub nodes: Vec<Node>,
Expand All @@ -17,13 +17,13 @@ pub struct ViewMacro<'a> {
}

#[derive(Default)]
pub struct ParentIdent {
pub struct ParentIndent {
pub tabs: usize,
pub spaces: usize,
}

impl<'a> ViewMacro<'a> {
pub fn try_parse(parent_ident: ParentIdent, mac: &'a Macro) -> Option<Self> {
pub fn try_parse(parent_indent: ParentIndent, mac: &'a Macro) -> Option<Self> {
let mut tokens = mac.tokens.clone().into_iter();
let (cx, comma) = (tokens.next(), tokens.next());

Expand Down Expand Up @@ -56,7 +56,7 @@ impl<'a> ViewMacro<'a> {
let nodes = rstml::parse2(tokens).ok()?;

Some(Self {
parent_ident,
parent_indent,
global_class,
nodes,
span,
Expand All @@ -74,7 +74,7 @@ impl<'a> ViewMacro<'a> {
impl Formatter<'_> {
pub fn view_macro(&mut self, view_mac: &ViewMacro) {
let ViewMacro {
parent_ident: parent_indent,
parent_indent,
cx,
global_class,
nodes,
Expand Down
2 changes: 1 addition & 1 deletion formatter/src/formatter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod mac;
mod node;

pub use mac::format_macro;
pub use mac::{ParentIdent, ViewMacro};
pub use mac::{ParentIndent, ViewMacro};

use serde::Deserialize;
use serde::Serialize;
Expand Down

0 comments on commit ad49901

Please sign in to comment.