bump html5gum to 0.5.5 (#1181)

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.
This commit is contained in:
Markus Unterwaditzer 2023-07-26 01:31:44 +02:00 committed by GitHub
parent 0d7c0a77cf
commit 566fca4c3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 7 deletions

4
Cargo.lock generated
View file

@ -1631,9 +1631,9 @@ dependencies = [
[[package]]
name = "html5gum"
version = "0.5.4"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6c265e703c0be340cdd35ebc90bb4430a6f3c9b00a67c23c2c58220cc7987f5"
checksum = "a133aac7511abbaa924b45436d4f8684c4e1adbda73b3c5716d9e52bd9f45e45"
dependencies = [
"jetscii",
]

View file

@ -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"

View file

@ -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
}
@ -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(),
@ -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(),