Skip to content

Commit

Permalink
fix: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
nfejzic committed Sep 9, 2023
1 parent cf632a6 commit 5c81e6a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
16 changes: 7 additions & 9 deletions core/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ mod snapshot;

macro_rules! test_fn {
($fn: path) => {{
let try_run =
::std::panic::catch_unwind($fn)
.map_err(|err| {
let panic_msg = err
.downcast_ref::<&str>()
.unwrap_or(&"Panic message not available");

format!("Test case panicked: {}", panic_msg).into()
});
let try_run = ::std::panic::catch_unwind($fn).map_err(|err| {
let panic_msg = err
.downcast_ref::<&str>()
.unwrap_or(&"Panic message not available");

format!("Test case panicked: {}", panic_msg).into()
});

libtest_mimic::Trial::test(stringify!($fn), || try_run)
}};
Expand Down
8 changes: 6 additions & 2 deletions parser/src/elements/atomic/heading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,12 @@ impl ElementParser for Heading {
}

fn parse(input: Vec<Self::Token<'_>>) -> Option<Blocks> {
let HeadingToken::Level(level) = input[0] else {return None};
let HeadingToken::Content(symbols) = input[1] else {return None};
let HeadingToken::Level(level) = input[0] else {
return None;
};
let HeadingToken::Content(symbols) = input[1] else {
return None;
};
let inline_start = symbols.get(0)?.start;

let content = symbols.parse_inlines().collect();
Expand Down
8 changes: 6 additions & 2 deletions parser/src/elements/enclosed/verbatim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ impl ElementParser for Verbatim {
}

fn parse(input: Vec<Self::Token<'_>>) -> Option<Blocks> {
let Token::Delimiter { line } = input.get(0)? else {return None};
let Token::Content(symbols) = input.get(1)? else { return None };
let Token::Delimiter { line } = input.get(0)? else {
return None;
};
let Token::Content(symbols) = input.get(1)? else {
return None;
};
let content = Symbol::flatten(symbols)?;

let block = Self {
Expand Down

0 comments on commit 5c81e6a

Please sign in to comment.