Skip to content

Commit ec86e1e

Browse files
authored
Make clippy happy (#1681)
* make clippy happy
1 parent e185e90 commit ec86e1e

20 files changed

Lines changed: 65 additions & 68 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lychee-bin/src/archive/wayback/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
use std::sync::LazyLock;
12
use std::time::Duration;
23

3-
use once_cell::sync::Lazy;
44
use serde::de::Error as SerdeError;
55
use serde::{Deserialize, Deserializer};
66

77
use http::StatusCode;
88
use reqwest::{Client, Error, Url};
9-
static WAYBACK_URL: Lazy<Url> =
10-
Lazy::new(|| Url::parse("https://archive.org/wayback/available").unwrap());
9+
static WAYBACK_URL: LazyLock<Url> =
10+
LazyLock::new(|| Url::parse("https://archive.org/wayback/available").unwrap());
1111

1212
pub(crate) async fn get_wayback_link(url: &Url, timeout: Duration) -> Result<Option<Url>, Error> {
1313
let mut archive_url: Url = WAYBACK_URL.clone();

lychee-bin/src/commands/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ where
183183
if let Some(pb) = &bar {
184184
pb.inc_length(1);
185185
pb.set_message(request.to_string());
186-
};
186+
}
187187
send_req
188188
.send(Ok(request))
189189
.await

lychee-bin/src/formatters/color.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
//! Defines the colors used in the output of the CLI.
22
3+
use std::sync::LazyLock;
4+
35
use console::Style;
46
use log::Level;
5-
use once_cell::sync::Lazy;
67

7-
pub(crate) static NORMAL: Lazy<Style> = Lazy::new(Style::new);
8-
pub(crate) static DIM: Lazy<Style> = Lazy::new(|| Style::new().dim());
8+
pub(crate) static NORMAL: LazyLock<Style> = LazyLock::new(Style::new);
9+
pub(crate) static DIM: LazyLock<Style> = LazyLock::new(|| Style::new().dim());
910

10-
pub(crate) static GREEN: Lazy<Style> = Lazy::new(|| Style::new().color256(2).bold().bright());
11-
pub(crate) static BOLD_GREEN: Lazy<Style> = Lazy::new(|| Style::new().color256(82).bold().bright());
12-
pub(crate) static YELLOW: Lazy<Style> = Lazy::new(|| Style::new().yellow().bright());
13-
pub(crate) static BOLD_YELLOW: Lazy<Style> = Lazy::new(|| Style::new().yellow().bold().bright());
14-
pub(crate) static PINK: Lazy<Style> = Lazy::new(|| Style::new().color256(197));
15-
pub(crate) static BOLD_PINK: Lazy<Style> = Lazy::new(|| Style::new().color256(197).bold());
11+
pub(crate) static GREEN: LazyLock<Style> =
12+
LazyLock::new(|| Style::new().color256(2).bold().bright());
13+
pub(crate) static BOLD_GREEN: LazyLock<Style> =
14+
LazyLock::new(|| Style::new().color256(82).bold().bright());
15+
pub(crate) static YELLOW: LazyLock<Style> = LazyLock::new(|| Style::new().yellow().bright());
16+
pub(crate) static BOLD_YELLOW: LazyLock<Style> =
17+
LazyLock::new(|| Style::new().yellow().bold().bright());
18+
pub(crate) static PINK: LazyLock<Style> = LazyLock::new(|| Style::new().color256(197));
19+
pub(crate) static BOLD_PINK: LazyLock<Style> = LazyLock::new(|| Style::new().color256(197).bold());
1620

1721
// Used for debug log messages
18-
pub(crate) static BLUE: Lazy<Style> = Lazy::new(|| Style::new().blue().bright());
22+
pub(crate) static BLUE: LazyLock<Style> = LazyLock::new(|| Style::new().blue().bright());
1923

2024
// Write output using predefined colors
2125
macro_rules! color {

lychee-bin/src/formatters/response/color.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub(crate) struct ColorFormatter;
1313
impl ColorFormatter {
1414
/// Determine the color for formatted output based on the status of the
1515
/// response.
16-
fn status_color(status: &Status) -> &'static once_cell::sync::Lazy<console::Style> {
16+
fn status_color(status: &Status) -> &'static std::sync::LazyLock<console::Style> {
1717
match status {
1818
Status::Ok(_) | Status::Cached(CacheStatus::Ok(_)) => &GREEN,
1919
Status::Excluded

lychee-bin/src/formatters/stats/compact.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use anyhow::Result;
22
use console::Style;
3-
use once_cell::sync::Lazy;
43
use std::{
54
fmt::{self, Display},
5+
sync::LazyLock,
66
time::Duration,
77
};
88

@@ -89,7 +89,7 @@ fn write_if_any(
8989
value: usize,
9090
symbol: &str,
9191
text: &str,
92-
style: &Lazy<Style>,
92+
style: &LazyLock<Style>,
9393
f: &mut fmt::Formatter<'_>,
9494
) -> Result<(), fmt::Error> {
9595
if value > 0 {

lychee-bin/src/stats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl ResponseStats {
6565
///
6666
/// This function is used to update the counters (success, error, etc.)
6767
/// based on the given response status.
68-
pub(crate) fn increment_status_counters(&mut self, status: &Status) {
68+
pub(crate) const fn increment_status_counters(&mut self, status: &Status) {
6969
match status {
7070
Status::Ok(_) => self.successful += 1,
7171
Status::Error(_) => self.errors += 1,

lychee-lib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ip_network = "0.4.1"
3030
linkify = "0.10.0"
3131
log = "0.4.27"
3232
octocrab = "0.44.0"
33-
once_cell = "1.21.3"
33+
# once_cell = "1.21.3"
3434
openssl-sys = { version = "0.9.106", optional = true }
3535
path-clean = "1.0.1"
3636
percent-encoding = "2.3.1"

lychee-lib/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ impl ClientBuilder {
322322
"Found user-agent in headers: {}. Overriding it with {user_agent}.",
323323
prev_user_agent.to_str().unwrap_or("�"),
324324
);
325-
};
325+
}
326326

327327
headers.insert(
328328
header::TRANSFER_ENCODING,

lychee-lib/src/extract/markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub(crate) fn extract_markdown_fragments(input: &str) -> HashSet<String> {
167167
Event::Text(text) | Event::Code(text) => {
168168
if in_heading {
169169
heading_text.push_str(&text);
170-
};
170+
}
171171
}
172172

173173
// An HTML node

0 commit comments

Comments
 (0)