Skip to content

Commit

Permalink
bump html5gum to 0.5.5
Browse files Browse the repository at this point in the history
there's some perf improvements there, but one requires manual
configuration.

custom should_emit_errors, when inlined, eliminates some useless code
that just wastes time when we don't care about errors.
  • Loading branch information
untitaker committed Jul 25, 2023
1 parent 0d7c0a7 commit fb95caf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lychee-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ futures = "0.3.27"
glob = "0.3.1"
headers = "0.3.8"
html5ever = "0.26.0"
html5gum = "0.5.4"
html5gum = "0.5.5"
http = "0.2.9"
hyper = "0.14.27"
ip_network = "0.4.1"
Expand Down
13 changes: 9 additions & 4 deletions lychee-lib/src/extract/html5gum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ impl Emitter for &mut LinkExtractor {
self.flush_current_characters();
}
fn emit_error(&mut self, _: Error) {}

#[inline]
fn should_emit_errors() -> bool {
false
}
fn pop_token(&mut self) -> Option<()> {
None
}
Expand Down Expand Up @@ -401,9 +406,9 @@ mod tests {
#[test]
fn test_include_nofollow() {
let input = r#"
<a rel="nofollow" href="https://foo.com">do not follow me</a>
<a rel="canonical,nofollow,dns-prefetch" href="https://example.com">do not follow me</a>
<a href="https://example.org">i'm fine</a>
<a rel="nofollow" href="https://foo.com">do not follow me</a>
<a rel="canonical,nofollow,dns-prefetch" href="https://example.com">do not follow me</a>
<a href="https://example.org">i'm fine</a>
"#;
let expected = vec![RawUri {
text: "https://example.org".to_string(),
Expand All @@ -420,7 +425,7 @@ mod tests {
<script>
var foo = "https://example.com";
</script>
<a href="https://example.org">i'm fine</a>
<a href="https://example.org">i'm fine</a>
"#;
let expected = vec![RawUri {
text: "https://example.org".to_string(),
Expand Down

0 comments on commit fb95caf

Please sign in to comment.