Skip to content

Commit

Permalink
clippy nursery
Browse files Browse the repository at this point in the history
  • Loading branch information
agourlay committed Feb 2, 2025
1 parent 5cbe7b6 commit 63b62ec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use reqwest::{Client, Proxy};
use std::time::Duration;

pub fn make_client(
user_agent: &Option<UserAgent>,
proxy: &Option<String>,
user_agent: Option<&UserAgent>,
proxy: Option<&String>,
redirect: bool,
connection_timeout_sec: usize,
accept_invalid_certs: bool,
Expand Down
4 changes: 2 additions & 2 deletions src/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub async fn download_link(
token: &CancellationToken,
pb_dl: &ProgressBar,
pb_manager: &ProgressBarManager,
accept_header: &Option<String>,
accept_header: Option<&String>,
) -> Result<String, DlmError> {
// select between stop signal and download
select! {
Expand All @@ -43,7 +43,7 @@ pub async fn download(
output_dir: &str,
pb_dl: &ProgressBar,
pb_manager: &ProgressBarManager,
accept_header: &Option<String>,
accept_header: Option<&String>,
) -> Result<String, DlmError> {
let file_link = FileLink::new(raw_link)?;
let (extension, filename_without_extension) = match file_link.extension {
Expand Down
14 changes: 7 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,30 @@ async fn main_result() -> Result<(), DlmError> {

// setup HTTP clients
let client = make_client(
&user_agent,
&proxy,
user_agent.as_ref(),
proxy.as_ref(),
true,
connection_timeout_secs,
accept_invalid_certs,
)?;
let c_ref = &client;
let client_no_redirect = make_client(
&user_agent,
&proxy,
user_agent.as_ref(),
proxy.as_ref(),
false,
connection_timeout_secs,
accept_invalid_certs,
)?;
let c_no_redirect_ref = &client_no_redirect;
let accept_ref = &accept;
let accept_ref = accept.as_ref();
// trim trailing slash if any
let od_ref = &output_dir
.strip_suffix('/')
.unwrap_or(&output_dir)
.to_string();

// setup progress bar manager
let pbm = ProgressBarManager::init(max_concurrent_downloads, nb_of_lines as u64).await;
let pbm = ProgressBarManager::init(max_concurrent_downloads, nb_of_lines).await;
let pbm_ref = &pbm;

// print startup info
Expand Down Expand Up @@ -186,7 +186,7 @@ async fn main_result() -> Result<(), DlmError> {
}
}

async fn count_non_empty_lines(input_file: &str) -> Result<i32, DlmError> {
async fn count_non_empty_lines(input_file: &str) -> Result<u64, DlmError> {
let file = tfs::File::open(input_file).await?;
let file_reader = tokio::io::BufReader::new(file);
let stream = LinesStream::new(file_reader.lines());
Expand Down

0 comments on commit 63b62ec

Please sign in to comment.