Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mre committed Jun 14, 2024
1 parent ebaf3ed commit ad70052
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 23 deletions.
3 changes: 1 addition & 2 deletions lychee-bin/src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,9 @@ fn get_failed_urls(stats: &mut ResponseStats) -> Vec<(InputSource, Url)> {

#[cfg(test)]
mod tests {
use crate::formatters;
use crate::{formatters::get_response_formatter, options};
use log::info;
use lychee_lib::{CacheStatus, ClientBuilder, InputSource, ResponseBody, Uri};
use lychee_lib::{CacheStatus, ClientBuilder, InputSource, Uri};

use super::*;

Expand Down
6 changes: 3 additions & 3 deletions lychee-bin/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use secrecy::{ExposeSecret, SecretString};
use serde::Deserialize;
use std::path::Path;
use std::{fs, path::PathBuf, str::FromStr, time::Duration};
use strum::{Display, EnumIter, EnumString, EnumVariantNames, VariantNames};
use strum::{Display, EnumIter, EnumString, VariantNames};

pub(crate) const LYCHEE_IGNORE_FILE: &str = ".lycheeignore";
pub(crate) const LYCHEE_CACHE_FILE: &str = ".lycheecache";
Expand Down Expand Up @@ -46,7 +46,7 @@ const TIMEOUT_STR: &str = concatcp!(DEFAULT_TIMEOUT_SECS);
const RETRY_WAIT_TIME_STR: &str = concatcp!(DEFAULT_RETRY_WAIT_TIME_SECS);

/// The format to use for the final status report
#[derive(Debug, Deserialize, Default, Clone, Display, EnumIter, EnumVariantNames)]
#[derive(Debug, Deserialize, Default, Clone, Display, EnumIter, VariantNames)]
#[non_exhaustive]
#[strum(serialize_all = "snake_case")]
pub(crate) enum StatsFormat {
Expand Down Expand Up @@ -77,7 +77,7 @@ impl FromStr for StatsFormat {
///
/// This decides over whether to use color,
/// emojis, or plain text for the output.
#[derive(Debug, Deserialize, Default, Clone, Display, EnumIter, EnumString, EnumVariantNames)]
#[derive(Debug, Deserialize, Default, Clone, Display, EnumIter, EnumString, VariantNames)]
#[non_exhaustive]
pub(crate) enum OutputMode {
#[serde(rename = "plain")]
Expand Down
28 changes: 10 additions & 18 deletions lychee-lib/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ impl Client {
let status = match uri.scheme() {
_ if uri.is_file() => self.check_file(uri).await,
_ if uri.is_mail() => self.check_mail(uri).await,
_ if uri.is_tel() => self.check_tel(uri).await,
_ if uri.is_tel() => Status::Excluded,
_ => self.check_website(uri, default_chain).await?,
};

Expand Down Expand Up @@ -700,6 +700,15 @@ impl Client {
}
}

/// Check a mail address, or equivalently a `mailto` URI.
///
/// This implementation simply excludes all email addresses.
#[cfg(not(all(feature = "email-check", feature = "native-tls")))]
#[allow(clippy::unused_async)]
pub async fn check_mail(&self, _uri: &Uri) -> Status {
Status::Excluded
}

/// Check a mail address, or equivalently a `mailto` URI.
///
/// URIs may contain query parameters (e.g. `contact@example.com?subject="Hello"`),
Expand All @@ -717,23 +726,6 @@ impl Client {
Status::Ok(StatusCode::OK)
}
}

/// Check a mail address, or equivalently a `mailto` URI.
///
/// This implementation simply excludes all email addresses.
#[cfg(not(all(feature = "email-check", feature = "native-tls")))]
#[allow(clippy::unused_async)]
pub async fn check_mail(&self, _uri: &Uri) -> Status {
Status::Excluded
}

/// Check a tel
///
/// This implementation simply excludes all tel.
#[allow(clippy::unused_async)]
pub async fn check_tel(&self, _uri: &Uri) -> Status {
Status::Excluded
}
}

// Check if the given `Url` would cause `reqwest` to panic.
Expand Down

0 comments on commit ad70052

Please sign in to comment.