Skip to content

Commit 82782cb

Browse files
committed
Fix warnings from clippy
1 parent 07048c8 commit 82782cb

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

lychee-bin/src/commands/check.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ async fn response_receive_task(
203203
formatter: Box<dyn ResponseFormatter>,
204204
mut stats: ResponseStats,
205205
) -> Result<(Option<ProgressBar>, ResponseStats)> {
206-
let mut i = 0;
206+
// let mut i = 0;
207207
while let Some(response) = recv_resp.recv().await {
208-
i = i + 1;
208+
// i += 1;
209209
// println!(
210210
// "starting response #{} out of {}",
211211
// i,
@@ -219,7 +219,7 @@ async fn response_receive_task(
219219
&verbose,
220220
)?;
221221

222-
for uri in response.body().subsequent_uris.iter() {
222+
for uri in &response.body().subsequent_uris {
223223
let request = Request::try_from(uri.clone())?;
224224
req_send
225225
.send(Ok(request))
@@ -235,7 +235,7 @@ async fn response_receive_task(
235235
remaining_requests.fetch_sub(1, Ordering::Relaxed);
236236
let remaining_now = remaining_requests.load(Ordering::Relaxed);
237237
// println!("remaining requests: {}", remaining_now);
238-
if remaining_now <= 0 {
238+
if remaining_now == 0 {
239239
break;
240240
}
241241

lychee-lib/src/checker/website.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl WebsiteChecker {
140140
.collect();
141141
// println!("recursing {}: found {:?}", response_url, links.clone());
142142

143-
return (status, links);
143+
(status, links)
144144
}
145145
}
146146
}
@@ -174,13 +174,13 @@ impl WebsiteChecker {
174174
.check_website_inner(&uri.to_https()?, &default_chain)
175175
.await;
176176

177-
if !status.is_success() {
177+
if status.is_success() {
178+
Ok((Status::Ok(code), new_uris))
179+
} else {
178180
Ok((
179181
Status::Error(ErrorKind::InsecureURL(uri.to_https()?)),
180182
vec![],
181183
))
182-
} else {
183-
Ok((Status::Ok(code), new_uris))
184184
}
185185
}
186186
s => Ok(s),

lychee-lib/src/types/basic_auth/credentials.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ pub struct BasicAuthCredentials {
4343

4444
impl BasicAuthCredentials {
4545
/// Create a new [`BasicAuthCredentials`] instance.
46-
pub fn new(username: String, password: String) -> Self {
46+
#[must_use]
47+
pub const fn new(username: String, password: String) -> Self {
4748
Self {
4849
username,
4950
password,
@@ -62,6 +63,7 @@ impl Hash for BasicAuthCredentials {
6263
impl FromStr for BasicAuthCredentials {
6364
type Err = BasicAuthCredentialsParseError;
6465

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

lychee-lib/src/types/input.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ impl Input {
198198
}
199199

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

0 commit comments

Comments
 (0)