Skip to content

Commit 2f657bf

Browse files
committed
chore: Apply fmt
1 parent 5169819 commit 2f657bf

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

Diff for: src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use crate::rawtext_stable_hack::MacroPattern;
88
use crate::{
99
atoms::{CloseTag, OpenTag},
1010
node::{CustomNode, NodeType},
11+
Infallible,
1112
};
12-
use crate::Infallible;
1313

1414
pub type TransformBlockFn = dyn Fn(ParseStream) -> Result<Option<TokenStream>>;
1515
pub type ElementWildcardFn = dyn Fn(&OpenTag, &CloseTag) -> bool;

Diff for: src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,8 @@ pub mod rawtext_stable_hack;
237237
pub mod visitor;
238238
pub use config::ParserConfig;
239239
pub use error::Error;
240-
pub use node::atoms;
240+
pub use node::{atoms, Infallible};
241241
use node::{CustomNode, Node};
242-
pub use node::Infallible;
243242
pub use parser::{recoverable, recoverable::ParsingResult, Parser};
244243

245244
/// Parse the given [`proc-macro::TokenStream`] into a [`Node`] tree.

Diff for: src/node/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub use node_name::{NodeName, NodeNameFragment};
2222
pub use node_value::{InvalidBlock, NodeBlock};
2323

2424
pub use self::raw_text::RawText;
25-
use crate::recoverable::{RecoverableContext, ParseRecoverable};
25+
use crate::recoverable::{ParseRecoverable, RecoverableContext};
2626

2727
/// Node types.
2828
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -264,14 +264,13 @@ pub trait CustomNode: ParseRecoverable + ToTokens {
264264
/// Recieves a [`ParseStream::fork`].
265265
///
266266
/// [`ParseStream::fork`]: syn::parse::ParseBuffer::fork
267-
///
268267
fn peek_element(input: ParseStream) -> bool;
269268
}
270269

271270
/// Newtype for `std::convert::Infallible` used to implement
272271
/// `ToTokens`` for `Infallible``.
273272
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
274-
pub struct Infallible (convert::Infallible);
273+
pub struct Infallible(convert::Infallible);
275274

276275
impl From<convert::Infallible> for Infallible {
277276
fn from(s: convert::Infallible) -> Self {
@@ -289,7 +288,7 @@ impl ParseRecoverable for Infallible {
289288
}
290289
}
291290
impl CustomNode for Infallible {
292-
fn peek_element( _: ParseStream) -> bool {
291+
fn peek_element(_: ParseStream) -> bool {
293292
false
294293
}
295-
}
294+
}

Diff for: src/rawtext_stable_hack.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ pub fn inject_raw_text_default<C: CustomNode>(source: &mut [Node<C>]) {
3232

3333
// Inject raw text to every raw node, recovered using proc-macro2 second
3434
// parsing;
35-
pub fn inject_raw_text<C: CustomNode + std::fmt::Debug>(source: &mut [Node<C>], hacked: &[Node<C>]) {
35+
pub fn inject_raw_text<C: CustomNode + std::fmt::Debug>(
36+
source: &mut [Node<C>],
37+
hacked: &[Node<C>],
38+
) {
3639
assert_eq!(
3740
source.len(),
3841
hacked.len(),

Diff for: tests/custom_node.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use quote::{quote, TokenStreamExt};
22
use rstml::{
33
atoms::{self, OpenTag, OpenTagEnd},
44
node::{CustomNode, Node, NodeElement},
5-
recoverable::{Recoverable, ParseRecoverable},
5+
recoverable::{ParseRecoverable, Recoverable},
66
Parser, ParserConfig,
77
};
88
use syn::{parse_quote, Expr, Token};

Diff for: tests/test.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rstml::{
88
CustomNode, KeyedAttribute, KeyedAttributeValue, Node, NodeAttribute, NodeElement, NodeType,
99
},
1010
parse2,
11-
recoverable::{RecoverableContext, ParseRecoverable},
11+
recoverable::{ParseRecoverable, RecoverableContext},
1212
Parser, ParserConfig,
1313
};
1414
use syn::{
@@ -165,7 +165,6 @@ struct TestCustomNode {
165165
data: TokenStream,
166166
}
167167

168-
169168
impl ToTokens for TestCustomNode {
170169
fn to_tokens(&self, tokens: &mut TokenStream) {
171170
self.bracket.surround(tokens, |c| self.data.to_tokens(c))
@@ -190,7 +189,6 @@ impl CustomNode for TestCustomNode {
190189
fn peek_element(input: ParseStream) -> bool {
191190
input.peek(Bracket)
192191
}
193-
194192
}
195193

196194
macro_rules! test_unquoted {

0 commit comments

Comments
 (0)