aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-13 20:38:19 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-13 20:38:19 +0200
commit1c51fedaeedecd536903982d7dbc663ab9fc2623 (patch)
treeba22bd4bcb3865dc65e05f6cf90e41e3e82fe3cc /src
parentec1cee9d7e01722b1d87552bb5f7b0cab7602af6 (diff)
downloadmarkdown-rs-1c51fedaeedecd536903982d7dbc663ab9fc2623.tar.gz
markdown-rs-1c51fedaeedecd536903982d7dbc663ab9fc2623.tar.bz2
markdown-rs-1c51fedaeedecd536903982d7dbc663ab9fc2623.zip
Refactor some code to improve coverage
Diffstat (limited to 'src')
-rw-r--r--src/parser.rs4
-rw-r--r--src/util/encode.rs4
2 files changed, 3 insertions, 5 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 4e8d859..e40aa5a 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -70,11 +70,9 @@ pub fn parse<'a>(
defs.append(&mut result.definitions);
if result.done {
- break;
+ return Ok((events, parse_state));
}
result = subtokenize(&mut events, &parse_state, &None)?;
}
-
- Ok((events, parse_state))
}
diff --git a/src/util/encode.rs b/src/util/encode.rs
index a26d954..51eadaf 100644
--- a/src/util/encode.rs
+++ b/src/util/encode.rs
@@ -39,8 +39,8 @@ pub fn encode(value: &str, encode_html: bool) -> String {
b'&' => "&amp;",
b'"' => "&quot;",
b'<' => "&lt;",
- b'>' => "&gt;",
- _ => panic!("impossible"),
+ // `b'>'`
+ _ => "&gt;",
});
start = index + 1;