From fbb77d7f0e5990a5babfe6e6bf57910793d6100e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Sep 2023 10:50:45 +0200 Subject: [PATCH] Bump the dependencies group with 10 updates (#1249) * Bump the dependencies group with 10 updates Bumps the dependencies group with 10 updates: | Package | From | To | | --- | --- | --- | | [clap](https://github.com/clap-rs/clap) | `4.3.23` | `4.4.2` | | [dashmap](https://github.com/xacrimon/dashmap) | `5.5.1` | `5.5.3` | | [openssl-sys](https://github.com/sfackler/rust-openssl) | `0.9.91` | `0.9.92` | | [regex](https://github.com/rust-lang/regex) | `1.9.3` | `1.9.5` | | [reqwest](https://github.com/seanmonstar/reqwest) | `0.11.19` | `0.11.20` | | [octocrab](https://github.com/XAMPPRocky/octocrab) | `0.29.3` | `0.30.1` | | [thiserror](https://github.com/dtolnay/thiserror) | `1.0.47` | `1.0.48` | | [typed-builder](https://github.com/idanarye/rust-typed-builder) | `0.15.2` | `0.16.0` | | [url](https://github.com/servo/rust-url) | `2.4.0` | `2.4.1` | | [criterion](https://github.com/bheisler/criterion.rs) | ``4c19e91`` | ``180f4b4`` | Updates `clap` from 4.3.23 to 4.4.2 - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/v4.3.23...v4.4.2) Updates `dashmap` from 5.5.1 to 5.5.3 - [Release notes](https://github.com/xacrimon/dashmap/releases) - [Commits](https://github.com/xacrimon/dashmap/compare/v5.5.1...v.5.5.3) Updates `openssl-sys` from 0.9.91 to 0.9.92 - [Release notes](https://github.com/sfackler/rust-openssl/releases) - [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.91...openssl-sys-v0.9.92) Updates `regex` from 1.9.3 to 1.9.5 - [Release notes](https://github.com/rust-lang/regex/releases) - [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/regex/compare/1.9.3...1.9.5) Updates `reqwest` from 0.11.19 to 0.11.20 - [Release notes](https://github.com/seanmonstar/reqwest/releases) - [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md) - [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.19...v0.11.20) Updates `octocrab` from 0.29.3 to 0.30.1 - [Release notes](https://github.com/XAMPPRocky/octocrab/releases) - [Changelog](https://github.com/XAMPPRocky/octocrab/blob/main/CHANGELOG.md) - [Commits](https://github.com/XAMPPRocky/octocrab/compare/v0.29.3...v0.30.1) Updates `thiserror` from 1.0.47 to 1.0.48 - [Release notes](https://github.com/dtolnay/thiserror/releases) - [Commits](https://github.com/dtolnay/thiserror/compare/1.0.47...1.0.48) Updates `typed-builder` from 0.15.2 to 0.16.0 - [Changelog](https://github.com/idanarye/rust-typed-builder/blob/master/CHANGELOG.md) - [Commits](https://github.com/idanarye/rust-typed-builder/commits) Updates `url` from 2.4.0 to 2.4.1 - [Release notes](https://github.com/servo/rust-url/releases) - [Commits](https://github.com/servo/rust-url/compare/v2.4.0...v2.4.1) Updates `criterion` from `4c19e91` to `180f4b4` - [Commits](https://github.com/bheisler/criterion.rs/compare/4c19e913b84e6a7e4a8470cb0f766796886ed891...180f4b48964a1fe6bdd7c49cf6d197071bee2e9b) --- updated-dependencies: - dependency-name: clap dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: dashmap dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: openssl-sys dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: regex dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: reqwest dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: octocrab dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: thiserror dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: typed-builder dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: url dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: criterion dependency-type: direct:production dependency-group: dependencies ... Signed-off-by: dependabot[bot] * Format * Fix new clippy lints --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Matthias --- Cargo.lock | 94 ++++++++++++------------ examples/builder/Cargo.toml | 4 +- examples/collect_links/Cargo.toml | 4 +- examples/collect_links/collect_links.rs | 1 - lychee-bin/Cargo.toml | 10 +-- lychee-bin/src/main.rs | 4 +- lychee-lib/Cargo.toml | 14 ++-- lychee-lib/src/client.rs | 4 +- lychee-lib/src/collector.rs | 27 ++++--- lychee-lib/src/extract/mod.rs | 2 +- lychee-lib/src/types/input.rs | 13 ++-- lychee-lib/src/types/uri/github.rs | 2 +- lychee-lib/src/utils/fragment_checker.rs | 2 +- lychee-lib/src/utils/path.rs | 8 +- 14 files changed, 93 insertions(+), 96 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b8d9993..d4c8e09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -49,16 +49,15 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] @@ -88,9 +87,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -457,7 +456,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" dependencies = [ "memchr", - "regex-automata 0.3.6", + "regex-automata 0.3.8", "serde", ] @@ -623,20 +622,19 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.23" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03aef18ddf7d879c15ce20f04826ef8418101c7e528014c3eeea13321047dca3" +checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.23" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ce6fffb678c9b80a70b6b6de0aad31df727623a70fd9a842c30cd573e2fa98" +checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08" dependencies = [ "anstream", "anstyle", @@ -646,9 +644,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" dependencies = [ "heck", "proc-macro2", @@ -825,7 +823,7 @@ dependencies = [ [[package]] name = "criterion" version = "0.5.1" -source = "git+https://github.com/bheisler/criterion.rs#4c19e913b84e6a7e4a8470cb0f766796886ed891" +source = "git+https://github.com/bheisler/criterion.rs#180f4b48964a1fe6bdd7c49cf6d197071bee2e9b" dependencies = [ "anes", "cast", @@ -850,7 +848,7 @@ dependencies = [ [[package]] name = "criterion-plot" version = "0.5.0" -source = "git+https://github.com/bheisler/criterion.rs#4c19e913b84e6a7e4a8470cb0f766796886ed891" +source = "git+https://github.com/bheisler/criterion.rs#180f4b48964a1fe6bdd7c49cf6d197071bee2e9b" dependencies = [ "cast", "itertools", @@ -1026,9 +1024,9 @@ dependencies = [ [[package]] name = "dashmap" -version = "5.5.1" +version = "5.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd72493923899c6f10c641bdbdeddc7183d6396641d99c1a0d1597f37f92e28" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", "hashbrown 0.14.0", @@ -2222,9 +2220,9 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "memoffset" @@ -2373,9 +2371,9 @@ dependencies = [ [[package]] name = "octocrab" -version = "0.29.3" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170c527fe1bf1d045e1f69a10dfd9b192327d53728b2c3481cf95b9dc2b42998" +checksum = "bbed1b1298bc70dd4ae89fd44dd7c13f0a1c80a506d731eb1b939f14f5e367de" dependencies = [ "arc-swap", "async-trait", @@ -2463,9 +2461,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.91" +version = "0.9.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" +checksum = "db7e971c2c2bba161b2d2fdf37080177eff520b3bc044787c7f1f5f9e78d869b" dependencies = [ "cc", "libc", @@ -2961,14 +2959,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.3" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.6", - "regex-syntax 0.7.4", + "regex-automata 0.3.8", + "regex-syntax 0.7.5", ] [[package]] @@ -2982,13 +2980,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax 0.7.5", ] [[package]] @@ -2999,15 +2997,15 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "reqwest" -version = "0.11.19" +version = "0.11.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20b9b67e2ca7dd9e9f9285b759de30ff538aab981abaaf7bc9bd90b84a0126c3" +checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" dependencies = [ "async-compression", "base64 0.21.2", @@ -3251,18 +3249,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.185" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be9b6f69f1dfd54c3b568ffa45c310d6973a5e5148fd40cf515acaf38cf5bc31" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.185" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc59dfdcbad1437773485e0367fea4b090a2e0a16d9ffc46af47764536a298ec" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", @@ -3649,18 +3647,18 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", @@ -4054,18 +4052,18 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "typed-builder" -version = "0.15.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe83c85a85875e8c4cb9ce4a890f05b23d38cd0d47647db7895d3d2a79566d2" +checksum = "6605aaa56cce0947127ffa0675a8a1b181f87773364390174de60a86ab9085f1" dependencies = [ "typed-builder-macro", ] [[package]] name = "typed-builder-macro" -version = "0.15.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29a3151c41d0b13e3d011f98adc24434560ef06673a155a6c7f66b9879eecce2" +checksum = "2a6a6884f6a890a012adcc20ce498f30ebdc70fb1ea242c333cc5f435b0b3871" dependencies = [ "proc-macro2", "quote", @@ -4128,9 +4126,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna 0.4.0", diff --git a/examples/builder/Cargo.toml b/examples/builder/Cargo.toml index 049b72f..810af42 100644 --- a/examples/builder/Cargo.toml +++ b/examples/builder/Cargo.toml @@ -10,9 +10,9 @@ path = "builder.rs" [dependencies] lychee-lib = { path = "../../lychee-lib", version = "0.13.0", default-features = false } tokio = { version = "1.32.0", features = ["full"] } -regex = "1.9.3" +regex = "1.9.5" http = "0.2.9" -reqwest = { version = "0.11.19", default-features = false, features = ["gzip"] } +reqwest = { version = "0.11.20", default-features = false, features = ["gzip"] } [features] email-check = ["lychee-lib/email-check"] diff --git a/examples/collect_links/Cargo.toml b/examples/collect_links/Cargo.toml index 8e6c83c..5f88b4f 100644 --- a/examples/collect_links/Cargo.toml +++ b/examples/collect_links/Cargo.toml @@ -10,10 +10,10 @@ path = "collect_links.rs" [dependencies] lychee-lib = { path = "../../lychee-lib", version = "0.13.0", default-features = false } tokio = { version = "1.32.0", features = ["full"] } -regex = "1.9.3" +regex = "1.9.5" http = "0.2.9" tokio-stream = "0.1.14" -reqwest = { version = "0.11.19", default-features = false, features = ["gzip"] } +reqwest = { version = "0.11.20", default-features = false, features = ["gzip"] } [features] email-check = ["lychee-lib/email-check"] diff --git a/examples/collect_links/collect_links.rs b/examples/collect_links/collect_links.rs index 9ac803c..d6c4662 100644 --- a/examples/collect_links/collect_links.rs +++ b/examples/collect_links/collect_links.rs @@ -26,7 +26,6 @@ async fn main() -> Result<()> { .skip_missing_inputs(false) // don't skip missing inputs? (default=false) .use_html5ever(false) // use html5ever for parsing? (default=false) .collect_links(inputs) // base url or directory - .await .collect::>>() .await?; diff --git a/lychee-bin/Cargo.toml b/lychee-bin/Cargo.toml index 0c8249c..fc42e57 100644 --- a/lychee-bin/Cargo.toml +++ b/lychee-bin/Cargo.toml @@ -21,11 +21,11 @@ lychee-lib = { path = "../lychee-lib", version = "0.13.0", default-features = fa anyhow = "1.0.75" assert-json-diff = "2.0.2" -clap = { version = "4.3.23", features = ["env", "derive"] } +clap = { version = "4.4.2", features = ["env", "derive"] } console = "0.15.7" const_format = "0.2.31" csv = "1.2.2" -dashmap = { version = "5.5.1", features = ["serde"] } +dashmap = { version = "5.5.3", features = ["serde"] } env_logger = "0.10.0" futures = "0.3.28" headers = "0.3.8" @@ -35,10 +35,10 @@ humantime-serde = "1.1.1" indicatif = "0.17.6" log = "0.4.20" once_cell = "1.18.0" -openssl-sys = { version = "0.9.91", optional = true } +openssl-sys = { version = "0.9.92", optional = true } pad = "0.1.6" -regex = "1.9.3" -reqwest = { version = "0.11.19", default-features = false, features = ["gzip", "json"] } +regex = "1.9.5" +reqwest = { version = "0.11.20", default-features = false, features = ["gzip", "json"] } reqwest_cookie_store = "0.6.0" # Make build work on Apple Silicon. # See https://github.com/briansmith/ring/issues/1163 diff --git a/lychee-bin/src/main.rs b/lychee-bin/src/main.rs index d056adb..233c235 100644 --- a/lychee-bin/src/main.rs +++ b/lychee-bin/src/main.rs @@ -298,7 +298,7 @@ async fn run(opts: &LycheeOptions) -> Result { .use_html5ever(std::env::var("LYCHEE_USE_HTML5EVER").map_or(false, |x| x == "1")); if opts.config.dump_inputs { - let sources = collector.collect_sources(inputs).await; + let sources = collector.collect_sources(inputs); let exit_code = commands::dump_inputs(sources, opts.config.output.as_ref()).await?; return Ok(exit_code as i32); @@ -310,7 +310,7 @@ async fn run(opts: &LycheeOptions) -> Result { collector }; - let requests = collector.collect_links(inputs).await; + let requests = collector.collect_links(inputs); let cache = load_cache(&opts.config).unwrap_or_default(); let cache = Arc::new(cache); diff --git a/lychee-lib/Cargo.toml b/lychee-lib/Cargo.toml index 91adecd..8f59931 100644 --- a/lychee-lib/Cargo.toml +++ b/lychee-lib/Cargo.toml @@ -32,16 +32,16 @@ ip_network = "0.4.1" jwalk = "0.8.1" linkify = "0.10.0" log = "0.4.20" -octocrab = "0.29.3" +octocrab = "0.30.1" once_cell = "1.18.0" -openssl-sys = { version = "0.9.91", optional = true } +openssl-sys = { version = "0.9.92", optional = true } path-clean = "1.0.1" percent-encoding = "2.3.0" pulldown-cmark = "0.9.3" -regex = "1.9.3" +regex = "1.9.5" # Use trust-dns to avoid lookup failures on high concurrency # https://github.com/seanmonstar/reqwest/issues/296 -reqwest = { version = "0.11.19", default-features = false, features = ["gzip", "trust-dns", "cookies"] } +reqwest = { version = "0.11.20", default-features = false, features = ["gzip", "trust-dns", "cookies"] } reqwest_cookie_store = "0.6.0" # Make build work on Apple Silicon. # See https://github.com/briansmith/ring/issues/1163 @@ -52,10 +52,10 @@ secrecy = "0.8.0" serde = { version = "1.0.185", features = ["derive"] } serde_with = "3.3.0" shellexpand = "3.1.0" -thiserror = "1.0.47" +thiserror = "1.0.48" tokio = { version = "1.32.0", features = ["full"] } -typed-builder = "0.15.2" -url = { version = "2.4.0", features = ["serde"] } +typed-builder = "0.16.0" +url = { version = "2.4.1", features = ["serde"] } [dependencies.par-stream] version = "0.10.2" diff --git a/lychee-lib/src/client.rs b/lychee-lib/src/client.rs index 6793f46..0377dbb 100644 --- a/lychee-lib/src/client.rs +++ b/lychee-lib/src/client.rs @@ -621,7 +621,9 @@ impl Client { /// A better approach would be to download the file through the API or /// clone the repo, but we chose the pragmatic approach. async fn check_github(&self, uri: GithubUri) -> Status { - let Some(client) = &self.github_client else { return ErrorKind::MissingGitHubToken.into() }; + let Some(client) = &self.github_client else { + return ErrorKind::MissingGitHubToken.into(); + }; let repo = match client.repos(&uri.owner, &uri.repo).get().await { Ok(repo) => repo, Err(e) => return ErrorKind::GithubRequest(e).into(), diff --git a/lychee-lib/src/collector.rs b/lychee-lib/src/collector.rs index 9d94eb1..eb029fe 100644 --- a/lychee-lib/src/collector.rs +++ b/lychee-lib/src/collector.rs @@ -2,9 +2,10 @@ use crate::{ basic_auth::BasicAuthExtractor, extract::Extractor, types::uri::raw::RawUri, utils::request, Base, Input, Request, Result, }; +use futures::TryStreamExt; use futures::{ stream::{self, Stream}, - StreamExt, TryStreamExt, + StreamExt, }; use par_stream::ParStreamExt; @@ -65,9 +66,9 @@ impl Collector { /// Collect all sources from a list of [`Input`]s. For further details, /// see also [`Input::get_sources`](crate::Input#method.get_sources). - pub async fn collect_sources(self, inputs: Vec) -> impl Stream> { + pub fn collect_sources(self, inputs: Vec) -> impl Stream> { stream::iter(inputs) - .par_then_unordered(None, move |input| async move { input.get_sources().await }) + .par_then_unordered(None, move |input| async move { input.get_sources() }) .flatten() } @@ -78,16 +79,14 @@ impl Collector { /// # Errors /// /// Will return `Err` if links cannot be extracted from an input - pub async fn collect_links(self, inputs: Vec) -> impl Stream> { + pub fn collect_links(self, inputs: Vec) -> impl Stream> { let skip_missing_inputs = self.skip_missing_inputs; - let contents = stream::iter(inputs) - .par_then_unordered(None, move |input| async move { - input.get_contents(skip_missing_inputs).await - }) - .flatten(); - let base = self.base; - contents + stream::iter(inputs) + .par_then_unordered(None, move |input| async move { + input.get_contents(skip_missing_inputs) + }) + .flatten() .par_then_unordered(None, move |content| { // send to parallel worker let base = base.clone(); @@ -123,7 +122,7 @@ mod tests { // Helper function to run the collector on the given inputs async fn collect(inputs: Vec, base: Option) -> HashSet { - let responses = Collector::new(base).collect_links(inputs).await; + let responses = Collector::new(base).collect_links(inputs); responses.map(|r| r.unwrap().uri).collect().await } @@ -140,7 +139,7 @@ mod tests { let file_path = temp_dir.path().join("README"); let _file = File::create(&file_path).unwrap(); let input = Input::new(&file_path.as_path().display().to_string(), None, true, None)?; - let contents: Vec<_> = input.get_contents(true).await.collect::>().await; + let contents: Vec<_> = input.get_contents(true).collect::>().await; assert_eq!(contents.len(), 1); assert_eq!(contents[0].as_ref().unwrap().file_type, FileType::Plaintext); @@ -150,7 +149,7 @@ mod tests { #[tokio::test] async fn test_url_without_extension_is_html() -> Result<()> { let input = Input::new("https://example.com/", None, true, None)?; - let contents: Vec<_> = input.get_contents(true).await.collect::>().await; + let contents: Vec<_> = input.get_contents(true).collect::>().await; assert_eq!(contents.len(), 1); assert_eq!(contents[0].as_ref().unwrap().file_type, FileType::Html); diff --git a/lychee-lib/src/extract/mod.rs b/lychee-lib/src/extract/mod.rs index d9675ec..3cbd14e 100644 --- a/lychee-lib/src/extract/mod.rs +++ b/lychee-lib/src/extract/mod.rs @@ -162,7 +162,7 @@ mod tests { #[test] fn test_md_escape() { - let input = r#"http://msdn.microsoft.com/library/ie/ms535874\(v=vs.85\).aspx"#; + let input = r"http://msdn.microsoft.com/library/ie/ms535874\(v=vs.85\).aspx"; let links: Vec<_> = find_links(input).collect(); let expected = "http://msdn.microsoft.com/library/ie/ms535874(v=vs.85).aspx)"; diff --git a/lychee-lib/src/types/input.rs b/lychee-lib/src/types/input.rs index 2db32e4..f2ba5f9 100644 --- a/lychee-lib/src/types/input.rs +++ b/lychee-lib/src/types/input.rs @@ -180,10 +180,7 @@ impl Input { /// Returns an error if the contents can not be retrieved /// because of an underlying I/O error (e.g. an error while making a /// network request or retrieving the contents from the file system) - pub async fn get_contents( - self, - skip_missing: bool, - ) -> impl Stream> { + pub fn get_contents(self, skip_missing: bool) -> impl Stream> { try_stream! { match self.source { InputSource::RemoteUrl(ref url) => { @@ -198,7 +195,7 @@ impl Input { ref pattern, ignore_case, } => { - for await content in self.glob_contents(pattern, ignore_case).await { + for await content in self.glob_contents(pattern, ignore_case) { let content = content?; yield content; } @@ -271,7 +268,7 @@ impl Input { /// # Errors /// /// Returns an error if the globbing fails with the expanded pattern. - pub async fn get_sources(self) -> impl Stream> { + pub fn get_sources(self) -> impl Stream> { try_stream! { match self.source { InputSource::RemoteUrl(url) => yield url.to_string(), @@ -315,7 +312,7 @@ impl Input { Ok(input_content) } - async fn glob_contents( + fn glob_contents( &self, pattern: &str, ignore_case: bool, @@ -352,7 +349,7 @@ impl Input { /// Check if the given path was excluded from link checking fn is_excluded_path(&self, path: &PathBuf) -> bool { let Some(excluded_paths) = &self.excluded_paths else { - return false + return false; }; is_excluded_path(excluded_paths, path) } diff --git a/lychee-lib/src/types/uri/github.rs b/lychee-lib/src/types/uri/github.rs index 750e417..68ba3d9 100644 --- a/lychee-lib/src/types/uri/github.rs +++ b/lychee-lib/src/types/uri/github.rs @@ -66,7 +66,7 @@ impl GithubUri { debug_assert!(!uri.is_mail(), "Should only be called on a Website type!"); let Some(domain) = uri.domain() else { - return Err(ErrorKind::InvalidGithubUrl(uri.to_string())) + return Err(ErrorKind::InvalidGithubUrl(uri.to_string())); }; if !matches!( diff --git a/lychee-lib/src/utils/fragment_checker.rs b/lychee-lib/src/utils/fragment_checker.rs index 39e034e..6b49cf7 100644 --- a/lychee-lib/src/utils/fragment_checker.rs +++ b/lychee-lib/src/utils/fragment_checker.rs @@ -44,7 +44,7 @@ impl FragmentChecker { /// In all other cases, returns true. pub(crate) async fn check(&self, path: &Path, url: &Url) -> Result { let Some(fragment) = url.fragment() else { - return Ok(true) + return Ok(true); }; let url_without_frag = Self::remove_fragment(url.clone()); diff --git a/lychee-lib/src/utils/path.rs b/lychee-lib/src/utils/path.rs index b03b016..bb4847e 100644 --- a/lychee-lib/src/utils/path.rs +++ b/lychee-lib/src/utils/path.rs @@ -45,7 +45,7 @@ pub(crate) fn resolve(src: &Path, dst: &Path, base: &Option) -> Result { // Find `dst` in the parent directory of `src` let Some(parent) = src.parent() else { - return Err(ErrorKind::InvalidFile(relative.to_path_buf())) + return Err(ErrorKind::InvalidFile(relative.to_path_buf())); }; parent.join(relative) } @@ -53,12 +53,14 @@ pub(crate) fn resolve(src: &Path, dst: &Path, base: &Option) -> Result