Skip to content

Commit

Permalink
Fix warnings from clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
gwennlbh committed Jan 5, 2025
1 parent 07048c8 commit 82782cb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
8 changes: 4 additions & 4 deletions lychee-bin/src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ async fn response_receive_task(
formatter: Box<dyn ResponseFormatter>,
mut stats: ResponseStats,
) -> Result<(Option<ProgressBar>, ResponseStats)> {
let mut i = 0;
// let mut i = 0;
while let Some(response) = recv_resp.recv().await {
i = i + 1;
// i += 1;
// println!(
// "starting response #{} out of {}",
// i,
Expand All @@ -219,7 +219,7 @@ async fn response_receive_task(
&verbose,
)?;

for uri in response.body().subsequent_uris.iter() {
for uri in &response.body().subsequent_uris {
let request = Request::try_from(uri.clone())?;
req_send
.send(Ok(request))
Expand All @@ -235,7 +235,7 @@ async fn response_receive_task(
remaining_requests.fetch_sub(1, Ordering::Relaxed);
let remaining_now = remaining_requests.load(Ordering::Relaxed);
// println!("remaining requests: {}", remaining_now);
if remaining_now <= 0 {
if remaining_now == 0 {
break;
}

Expand Down
8 changes: 4 additions & 4 deletions lychee-lib/src/checker/website.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl WebsiteChecker {
.collect();
// println!("recursing {}: found {:?}", response_url, links.clone());

return (status, links);
(status, links)
}
}
}
Expand Down Expand Up @@ -174,13 +174,13 @@ impl WebsiteChecker {
.check_website_inner(&uri.to_https()?, &default_chain)
.await;

if !status.is_success() {
if status.is_success() {
Ok((Status::Ok(code), new_uris))
} else {
Ok((
Status::Error(ErrorKind::InsecureURL(uri.to_https()?)),
vec![],
))
} else {
Ok((Status::Ok(code), new_uris))
}
}
s => Ok(s),
Expand Down
4 changes: 3 additions & 1 deletion lychee-lib/src/types/basic_auth/credentials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ pub struct BasicAuthCredentials {

impl BasicAuthCredentials {
/// Create a new [`BasicAuthCredentials`] instance.
pub fn new(username: String, password: String) -> Self {
#[must_use]
pub const fn new(username: String, password: String) -> Self {
Self {
username,
password,
Expand All @@ -62,6 +63,7 @@ impl Hash for BasicAuthCredentials {
impl FromStr for BasicAuthCredentials {
type Err = BasicAuthCredentialsParseError;

#[must_use]
fn from_str(credentials: &str) -> Result<Self, Self::Err> {
let parts: Vec<_> = credentials.trim().split(':').collect();

Expand Down
1 change: 1 addition & 0 deletions lychee-lib/src/types/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ impl Input {
}

/// Construct a new `Input` source from a raw string that represents the contents of the input (website, file, etc.)
#[must_use]
pub fn raw_string(s: &str, file_type_hint: Option<FileType>) -> Self {
Self {
source: InputSource::String(s.to_owned()),
Expand Down

0 comments on commit 82782cb

Please sign in to comment.