diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6157716c..35e7d2d7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: with: toolchain: stable components: rustfmt, clippy - - run: cargo fmt --check && cargo clippy --examples --tests --benches --all-features + - run: cargo fmt --check && cargo clippy --all --all-features - run: cargo test --all-features coverage: runs-on: ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index 6c14cd6c..fc4e15e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ serde = { version = "1.0", features = ["derive"], optional = true } env_logger = "0.10" criterion = "0.5" pretty_assertions = "1" -swc_core = { version = "0.79.0", features = [ +swc_core = { version = "0.83.0", features = [ "ecma_ast", "ecma_visit", "ecma_parser", diff --git a/readme.md b/readme.md index 3a272398..02157dd8 100644 --- a/readme.md +++ b/readme.md @@ -258,7 +258,7 @@ The following bash scripts are useful when working on this project: ``` * lint: ```sh - cargo fmt --check && cargo clippy --examples --tests --benches + cargo fmt --check && cargo clippy --all --all-features ``` * test: ```sh diff --git a/src/construct/document.rs b/src/construct/document.rs index 656525c6..d41a5d5d 100644 --- a/src/construct/document.rs +++ b/src/construct/document.rs @@ -494,8 +494,8 @@ fn exit_containers(tokenizer: &mut Tokenizer, phase: &Phase) -> Result<(), Strin - (if *phase == Phase::After { 2 } else { 1 }); let mut exits = Vec::with_capacity(stack_close.len()); - while !stack_close.is_empty() { - let container = stack_close.pop().unwrap(); + while let Some(container) = stack_close.pop() { + let name = match container.kind { Container::BlockQuote => Name::BlockQuote, Container::GfmFootnoteDefinition => Name::GfmFootnoteDefinition, diff --git a/tests/commonmark.rs b/tests/commonmark.rs index 9dbc4176..f27e11c5 100644 --- a/tests/commonmark.rs +++ b/tests/commonmark.rs @@ -184,29 +184,29 @@ bar assert_eq!( to_html_with_options( - r###"\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~ -"###, + r#"\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~ +"#, &danger )?, - r###"

!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

-"###, + r"

!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

+", r###"Backslash escapes (12)"### ); assert_eq!( to_html_with_options( - r###"\ \A\a\ \3\φ\« -"###, + r"\ \A\a\ \3\φ\« +", &danger )?, - r###"

\ \A\a\ \3\φ\«

-"###, + r"

\ \A\a\ \3\φ\«

+", r###"Backslash escapes (13)"### ); assert_eq!( to_html_with_options( - r###"\*not emphasized* + r#"\*not emphasized* \
not a tag \[not a link](/foo) \`not code` @@ -215,7 +215,7 @@ bar \# not a heading \[foo]: /url "not a reference" \ö not a character entity -"###, +"#, &danger )?, r###"

*not emphasized* @@ -233,20 +233,20 @@ bar assert_eq!( to_html_with_options( - r###"\\*emphasis* -"###, + r"\\*emphasis* +", &danger )?, - r###"

\emphasis

-"###, + r"

\emphasis

+", r###"Backslash escapes (15)"### ); assert_eq!( to_html_with_options( - r###"foo\ + r"foo\ bar -"###, +", &danger )?, r###"

foo
@@ -257,98 +257,98 @@ bar

assert_eq!( to_html_with_options( - r###"`` \[\` `` -"###, + r"`` \[\` `` +", &danger )?, - r###"

\[\`

-"###, + r"

\[\`

+", r###"Backslash escapes (17)"### ); assert_eq!( to_html_with_options( - r###" \[\] -"###, + r" \[\] +", &danger )?, - r###"
\[\]
+        r"
\[\]
 
-"###, +", r###"Backslash escapes (18)"### ); assert_eq!( to_html_with_options( - r###"~~~ + r"~~~ \[\] ~~~ -"###, +", &danger )?, - r###"
\[\]
+        r"
\[\]
 
-"###, +", r###"Backslash escapes (19)"### ); assert_eq!( to_html_with_options( - r###" -"###, + r" +", &danger )?, - r###"

http://example.com?find=\*

-"###, + r#"

http://example.com?find=\*

+"#, r###"Backslash escapes (20)"### ); assert_eq!( to_html_with_options( - r###" -"###, + r#" +"#, &danger )?, - r###" -"###, + r#" +"#, r###"Backslash escapes (21)"### ); assert_eq!( to_html_with_options( - r###"[foo](/bar\* "ti\*tle") -"###, + r#"[foo](/bar\* "ti\*tle") +"#, &danger )?, - r###"

foo

-"###, + r#"

foo

+"#, r###"Backslash escapes (22)"### ); assert_eq!( to_html_with_options( - r###"[foo] + r#"[foo] [foo]: /bar\* "ti\*tle" -"###, +"#, &danger )?, - r###"

foo

-"###, + r#"

foo

+"#, r###"Backslash escapes (23)"### ); assert_eq!( to_html_with_options( - r###"``` foo\+bar + r"``` foo\+bar foo ``` -"###, +", &danger )?, - r###"
foo
+        r#"
foo
 
-"###, +"#, r###"Backslash escapes (24)"### ); @@ -430,36 +430,36 @@ foo assert_eq!( to_html_with_options( - r###" -"###, + r#" +"#, &danger )?, - r###" -"###, + r#" +"#, r###"Entity and numeric character references (31)"### ); assert_eq!( to_html_with_options( - r###"[foo](/föö "föö") -"###, + r#"[foo](/föö "föö") +"#, &danger )?, - r###"

foo

-"###, + r#"

foo

+"#, r###"Entity and numeric character references (32)"### ); assert_eq!( to_html_with_options( - r###"[foo] + r#"[foo] [foo]: /föö "föö" -"###, +"#, &danger )?, - r###"

foo

-"###, + r#"

foo

+"#, r###"Entity and numeric character references (33)"### ); @@ -471,9 +471,9 @@ foo "###, &danger )?, - r###"
foo
+        r#"
foo
 
-"###, +"#, r###"Entity and numeric character references (34)"### ); @@ -886,8 +886,8 @@ bar assert_eq!( to_html_with_options( - r###"\## foo -"###, + r"\## foo +", &danger )?, r###"

## foo

@@ -897,8 +897,8 @@ bar assert_eq!( to_html_with_options( - r###"# foo *bar* \*baz\* -"###, + r"# foo *bar* \*baz\* +", &danger )?, r###"

foo bar *baz*

@@ -1018,10 +1018,10 @@ bar assert_eq!( to_html_with_options( - r###"### foo \### + r"### foo \### ## foo #\## # foo \# -"###, +", &danger )?, r###"

foo ###

@@ -1233,26 +1233,26 @@ Foo assert_eq!( to_html_with_options( - r###"Foo\ + r"Foo\ ---- -"###, +", &danger )?, - r###"

Foo\

-"###, + r"

Foo\

+", r###"Setext headings (90)"### ); assert_eq!( to_html_with_options( - r###"`Foo + r#"`Foo ---- ` -"###, +"#, &danger )?, r###"

`Foo

@@ -1414,9 +1414,9 @@ Baz assert_eq!( to_html_with_options( - r###"\> foo + r"\> foo ------ -"###, +", &danger )?, r###"

> foo

@@ -1479,11 +1479,11 @@ bar

assert_eq!( to_html_with_options( - r###"Foo + r"Foo bar \--- baz -"###, +", &danger )?, r###"

Foo @@ -2065,11 +2065,11 @@ end "###, &danger )?, - r###"

def foo(x)
+        r#"
def foo(x)
   return 3
 end
 
-"###, +"#, r###"Fenced code blocks (142)"### ); @@ -2083,11 +2083,11 @@ end "###, &danger )?, - r###"
def foo(x)
+        r#"
def foo(x)
   return 3
 end
 
-"###, +"#, r###"Fenced code blocks (143)"### ); @@ -2098,8 +2098,8 @@ end "###, &danger )?, - r###"
-"###, + r#"
+"#, r###"Fenced code blocks (144)"### ); @@ -2124,9 +2124,9 @@ foo "###, &danger )?, - r###"
foo
+        r#"
foo
 
-"###, +"#, r###"Fenced code blocks (146)"### ); @@ -2222,48 +2222,48 @@ okay. assert_eq!( to_html_with_options( - r###"
+ r#"
*Markdown*
-"###, +"#, &danger )?, - r###"
+ r#"

Markdown

-"###, +"#, r###"HTML blocks (152)"### ); assert_eq!( to_html_with_options( - r###"
-"###, +"#, &danger )?, - r###"
-"###, +"#, r###"HTML blocks (153)"### ); assert_eq!( to_html_with_options( - r###"
-"###, +"#, &danger )?, - r###"
-"###, +"#, r###"HTML blocks (154)"### ); @@ -2285,14 +2285,14 @@ okay. assert_eq!( to_html_with_options( - r###"
-"###, + r#" +"#, &danger )?, - r###" -"###, + r#" +"#, r###"HTML blocks (159)"### ); @@ -2367,16 +2367,16 @@ int x = 33; assert_eq!( to_html_with_options( - r###" + r#" *bar* -"###, +"#, &danger )?, - r###" + r#" *bar* -"###, +"#, r###"HTML blocks (162)"### ); @@ -2397,16 +2397,16 @@ int x = 33; assert_eq!( to_html_with_options( - r###" + r#" *bar* -"###, +"#, &danger )?, - r###" + r#" *bar* -"###, +"#, r###"HTML blocks (164)"### ); @@ -2468,45 +2468,45 @@ int x = 33; assert_eq!( to_html_with_options( - r###"

+            r#"

 import Text.HTML.TagSoup
 
 main :: IO ()
 main = print $ parseTags tags
 
okay -"###, +"#, &danger )?, - r###"

+        r#"

 import Text.HTML.TagSoup
 
 main :: IO ()
 main = print $ parseTags tags
 

okay

-"###, +"#, r###"HTML blocks (169)"### ); assert_eq!( to_html_with_options( - r###" okay -"###, +"#, &danger )?, - r###"

okay

-"###, +"#, r###"HTML blocks (170)"### ); @@ -2535,41 +2535,41 @@ _bar_ assert_eq!( to_html_with_options( - r###" okay -"###, +"#, &danger )?, - r###"

okay

-"###, +"#, r###"HTML blocks (172)"### ); assert_eq!( to_html_with_options( - r###" -"###, +"##, &Options { compile: CompileOptions { allow_dangerous_html: true, diff --git a/tests/gfm_task_list_item.rs b/tests/gfm_task_list_item.rs index b65681d2..5d451345 100644 --- a/tests/gfm_task_list_item.rs +++ b/tests/gfm_task_list_item.rs @@ -137,7 +137,7 @@ EOL after: .replace('␉', "\t"), &Options::gfm() )?, - r###"
    + r#"
    • foo
    • bar
    @@ -250,7 +250,7 @@ Text.
  • In a list in a block quote
-"###, +"#, "should handle things like GitHub" );