Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
quambene committed Feb 27, 2024
1 parent 44d8eaa commit 3a90ff5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions src/bookmarks/bookmark_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,19 @@ where
.into_iter()
.filter(|bookmark| bookmark.action != Action::None)
.collect::<Vec<_>>();
let mut report = self.report.lock();
report.set_total(bookmarks.len());
{
let mut report = self.report.lock();
report.set_total(bookmarks.len());
}

let mut stream = stream::iter(bookmarks)
.map(|bookmark| self.execute_actions(bookmark))
.buffer_unordered(self.settings.max_concurrent_requests);

while let Some(item) = stream.next().await {
let mut report = self.report.lock();
report.increment_processed();

report.print_report();
report.print();

if let Err(err) = item {
match err {
Expand Down Expand Up @@ -119,7 +122,7 @@ where
std::io::stdout().flush().map_err(BogrepError::FlushFile)?;
}

report.print_summary();
self.report.lock().print_summary();

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/bookmarks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ impl ProcessReport {
Self::new(0, 0, 0, 0, 0, 0, dry_run)
}

pub fn print_report(&self) {
pub fn print(&self) {
print!("Processing bookmarks ({}/{})\r", self.processed, self.total);
}

Expand Down
4 changes: 2 additions & 2 deletions src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ pub mod tests {

let default_profile_file = default_profile_dir.join("Bookmarks");
let profile_file = profile_dir.join("Bookmarks");
File::create(&default_profile_file).unwrap();
File::create(&profile_file).unwrap();
File::create(default_profile_file).unwrap();
File::create(profile_file).unwrap();
}

fn create_chromium_dirs_linux(home_dir: &Path) {
Expand Down

0 comments on commit 3a90ff5

Please sign in to comment.