From e0b4c739874a9df69dd9679030b067d0a8cc27a6 Mon Sep 17 00:00:00 2001 From: Thomas Zahner Date: Wed, 24 Apr 2024 11:35:56 +0200 Subject: [PATCH] Adapt to breaking changes & revert to pulldown-cmark 0.9 --- Cargo.lock | 11 ++--------- lychee-bin/src/archive/mod.rs | 4 ++-- lychee-lib/Cargo.toml | 2 +- lychee-lib/src/extract/html/html5ever.rs | 10 +++++----- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 795e9c4..9fd2b11 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3113,23 +3113,16 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.10.2" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0530d13d87d1f549b66a3e8d0c688952abe5994e204ed62615baaf25dc029c" +checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" dependencies = [ "bitflags 2.4.1", "getopts", "memchr", - "pulldown-cmark-escape", "unicase", ] -[[package]] -name = "pulldown-cmark-escape" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d8f9aa0e3cbcfaf8bf00300004ee3b72f74770f9cbac93f6928771f613276b" - [[package]] name = "pwned" version = "0.5.0" diff --git a/lychee-bin/src/archive/mod.rs b/lychee-bin/src/archive/mod.rs index 7246f8a..767b232 100644 --- a/lychee-bin/src/archive/mod.rs +++ b/lychee-bin/src/archive/mod.rs @@ -1,7 +1,7 @@ use reqwest::{Error, Url}; use serde::{Deserialize, Serialize}; use std::fmt::Display; -use strum::{Display, EnumIter, EnumString, EnumVariantNames}; +use strum::{Display, EnumIter, EnumString, VariantNames}; use crate::color::{color, GREEN, PINK}; @@ -23,7 +23,7 @@ impl Display for Suggestion { } #[non_exhaustive] -#[derive(Debug, Deserialize, Default, Clone, Display, EnumIter, EnumString, EnumVariantNames)] +#[derive(Debug, Deserialize, Default, Clone, Display, EnumIter, EnumString, VariantNames)] pub(crate) enum Archive { #[serde(rename = "wayback")] #[strum(serialize = "wayback", ascii_case_insensitive)] diff --git a/lychee-lib/Cargo.toml b/lychee-lib/Cargo.toml index 7fb539d..00ec685 100644 --- a/lychee-lib/Cargo.toml +++ b/lychee-lib/Cargo.toml @@ -33,7 +33,7 @@ once_cell = "1.19.0" openssl-sys = { version = "0.9.102", optional = true } path-clean = "1.0.1" percent-encoding = "2.3.1" -pulldown-cmark = "0.10.2" +pulldown-cmark = "0.9.6" regex = "1.10.4" # Use trust-dns to avoid lookup failures on high concurrency # https://github.com/seanmonstar/reqwest/issues/296 diff --git a/lychee-lib/src/extract/html/html5ever.rs b/lychee-lib/src/extract/html/html5ever.rs index 25ed226..bceed2c 100644 --- a/lychee-lib/src/extract/html/html5ever.rs +++ b/lychee-lib/src/extract/html/html5ever.rs @@ -166,7 +166,7 @@ impl LinkExtractor { /// Extract unparsed URL strings from an HTML string. pub(crate) fn extract_html(buf: &str, include_verbatim: bool) -> Vec { - let mut input = BufferQueue::new(); + let mut input = BufferQueue::default(); input.push_back(StrTendril::from(buf)); let mut tokenizer = Tokenizer::new( @@ -267,9 +267,9 @@ mod tests { #[test] fn test_include_nofollow() { let input = r#" - do not follow me - do not follow me - do not follow me + do not follow me + do not follow me + do not follow me "#; let expected = vec![RawUri { text: "https://example.org".to_string(), @@ -286,7 +286,7 @@ mod tests { - i'm fine + i'm fine "#; let expected = vec![RawUri { text: "https://example.org".to_string(),