From e5b857ca8e01981f61ecd4001c834adc8066ed8f Mon Sep 17 00:00:00 2001 From: Keming Date: Fri, 11 Apr 2025 19:57:20 +0800 Subject: [PATCH] fix: replace once_cell to make cargo clippy happy Signed-off-by: Keming --- Cargo.lock | 2 -- lychee-bin/Cargo.toml | 2 +- lychee-bin/src/archive/wayback/mod.rs | 6 +++--- lychee-bin/src/commands/check.rs | 2 +- lychee-bin/src/formatters/color.rs | 23 ++++++++++++--------- lychee-bin/src/formatters/response/color.rs | 2 +- lychee-bin/src/formatters/stats/compact.rs | 4 ++-- lychee-bin/src/stats.rs | 2 +- lychee-lib/Cargo.toml | 2 +- lychee-lib/src/client.rs | 2 +- lychee-lib/src/extract/markdown.rs | 2 +- lychee-lib/src/filter/mod.rs | 21 ++++++++++--------- lychee-lib/src/quirks/mod.rs | 16 +++++++------- lychee-lib/src/types/accept/range.rs | 10 ++++----- lychee-lib/src/types/input.rs | 2 +- lychee-lib/src/types/status.rs | 9 +++----- lychee-lib/src/types/uri/github.rs | 6 +++--- lychee-lib/src/types/uri/valid.rs | 4 ++-- lychee-lib/src/utils/fragment_checker.rs | 2 +- lychee-lib/src/utils/path.rs | 6 +++--- lychee-lib/src/utils/url.rs | 4 ++-- 21 files changed, 64 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a5ac06eeb6..97c8b86517 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2534,7 +2534,6 @@ dependencies = [ "indicatif", "log", "lychee-lib", - "once_cell", "openssl-sys", "pad", "predicates", @@ -2582,7 +2581,6 @@ dependencies = [ "linkify", "log", "octocrab", - "once_cell", "openssl-sys", "par-stream", "path-clean", diff --git a/lychee-bin/Cargo.toml b/lychee-bin/Cargo.toml index c406433a0e..231145a107 100644 --- a/lychee-bin/Cargo.toml +++ b/lychee-bin/Cargo.toml @@ -10,6 +10,7 @@ license = "Apache-2.0 OR MIT" repository = "https://github.com/lycheeverse/lychee" readme = "../README.md" version.workspace = true +rust-version = "1.83.0" [dependencies] # NOTE: We need to specify the version of lychee-lib here because crates.io @@ -31,7 +32,6 @@ humantime = "2.2.0" humantime-serde = "1.1.1" indicatif = "0.17.11" log = "0.4.27" -once_cell = "1.21.3" openssl-sys = { version = "0.9.106", optional = true } pad = "0.1.6" regex = "1.11.1" diff --git a/lychee-bin/src/archive/wayback/mod.rs b/lychee-bin/src/archive/wayback/mod.rs index 3dfec70bd2..f818e7b306 100644 --- a/lychee-bin/src/archive/wayback/mod.rs +++ b/lychee-bin/src/archive/wayback/mod.rs @@ -1,13 +1,13 @@ use std::time::Duration; -use once_cell::sync::Lazy; use serde::de::Error as SerdeError; use serde::{Deserialize, Deserializer}; +use std::sync::LazyLock; use http::StatusCode; use reqwest::{Client, Error, Url}; -static WAYBACK_URL: Lazy = - Lazy::new(|| Url::parse("https://archive.org/wayback/available").unwrap()); +static WAYBACK_URL: LazyLock = + LazyLock::new(|| Url::parse("https://archive.org/wayback/available").unwrap()); pub(crate) async fn get_wayback_link(url: &Url, timeout: Duration) -> Result, Error> { let mut archive_url: Url = WAYBACK_URL.clone(); diff --git a/lychee-bin/src/commands/check.rs b/lychee-bin/src/commands/check.rs index 641c762a46..4cb47468c1 100644 --- a/lychee-bin/src/commands/check.rs +++ b/lychee-bin/src/commands/check.rs @@ -183,7 +183,7 @@ where if let Some(pb) = &bar { pb.inc_length(1); pb.set_message(request.to_string()); - }; + } send_req .send(Ok(request)) .await diff --git a/lychee-bin/src/formatters/color.rs b/lychee-bin/src/formatters/color.rs index eaa9929c27..4797d52988 100644 --- a/lychee-bin/src/formatters/color.rs +++ b/lychee-bin/src/formatters/color.rs @@ -2,20 +2,23 @@ use console::Style; use log::Level; -use once_cell::sync::Lazy; +use std::sync::LazyLock; -pub(crate) static NORMAL: Lazy