Skip to content

Commit

Permalink
ci(test.yml): fix clippy issues and update workflow to use fixed vers…
Browse files Browse the repository at this point in the history
…ion of cargo-nextest
  • Loading branch information
josueBarretogit committed Dec 26, 2024
1 parent 8701c99 commit 8d71961
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 16 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
run: cargo build --release --verbose

- name: install cargo nextest
run: cargo install cargo-nextest
run: cargo install cargo-nextest@0.9.82

- name: test
run: cargo nextest run --no-fail-fast
Expand All @@ -84,5 +84,9 @@ jobs:
with:
use-flakehub: false

- name: install_dependencies
run: sudo apt install libdbus-1-dev pkg-config


- name: Build default package
run: nix build
4 changes: 2 additions & 2 deletions src/backend/tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub async fn update_reading_progress(
manga_title: SearchTerm,
chapter_number: u32,
volume_number: Option<u32>,
tracker: impl MangaTracker + Send,
tracker: impl MangaTracker,
) -> Result<(), Box<dyn Error>> {
let response = tracker.search_manga_by_title(manga_title).await?;
if let Some(manga) = response {
Expand All @@ -53,7 +53,7 @@ pub async fn update_reading_progress(
pub fn track_manga<T, F>(tracker: Option<T>, manga_title: String, chapter_number: u32, volume_number: Option<u32>, on_error: F)
where
T: MangaTracker,
F: Fn(String) -> () + Send + 'static,
F: Fn(String) + Send + 'static,
{
if let Some(tracker) = tracker {
tokio::spawn(async move {
Expand Down
4 changes: 2 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ impl CliArgs {

self.save_anilist_credentials(
AnilistCredentialsProvided {
access_token: &access_token,
client_id: &client_id,
access_token,
client_id,
},
storage,
)?;
Expand Down
4 changes: 0 additions & 4 deletions src/common.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
use std::collections::HashMap;
use std::error::Error;
use std::fmt::Display;

use manga_tui::SearchTerm;
use ratatui::layout::Rect;
use ratatui_image::protocol::Protocol;
use strum::{Display, EnumIter};

use crate::backend::filter::Languages;
use crate::backend::tracker::{MangaTracker, MarkAsRead};

#[derive(Default, Clone, Debug, PartialEq)]
pub struct Author {
pub id: String,
Expand Down
5 changes: 2 additions & 3 deletions src/view/pages/manga.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::error::Error;
use std::future::Future;
use std::io::Cursor;
use std::u32;

use crossterm::event::{KeyCode, KeyEvent, MouseEvent, MouseEventKind};
use image::io::Reader;
Expand Down Expand Up @@ -867,7 +866,7 @@ impl<T: MangaTracker> MangaPage<T> {
// This conversion is needed so that we take into account chapters
// like 1.2, 10.1 etc
number.parse::<f64>().unwrap_or(0.0) as u32,
volume_number.map(|vol| vol.parse().ok()).flatten(),
volume_number.and_then(|vol| vol.parse().ok()),
move |error| {
write_to_error_log(
format_error_message_tracking_reading_history(
Expand Down Expand Up @@ -1214,7 +1213,7 @@ impl<T: MangaTracker> MangaPage<T> {
},
MangaPageEvents::ReadSuccesful(chapter_to_read, manga_to_read) => {
self.state = PageState::DisplayingChapters;
let volume = chapter_to_read.clone().volume_number.map(|vol| vol.parse::<u32>().ok()).flatten();
let volume = chapter_to_read.clone().volume_number.and_then(|vol| vol.parse::<u32>().ok());
self.track_manga(self.manga_tracker.clone(), self.manga.title.clone(), chapter_to_read.number as u32, volume);

self.local_event_tx.send(MangaPageEvents::CheckChapterStatus).ok();
Expand Down
1 change: 0 additions & 1 deletion src/view/pages/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,6 @@ mod test {
use self::mpsc::unbounded_channel;
use super::*;
use crate::backend::database::{ChapterToBookmark, Database};
use crate::common::format_error_message_tracking_reading_history;
use crate::global::test_utils::TrackerTest;
use crate::view::widgets::press_key;

Expand Down
3 changes: 0 additions & 3 deletions src/view/tasks/manga.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::path::{Path, PathBuf};
use std::thread::sleep;
use std::time::{Duration, Instant};

use manga_tui::SearchTerm;
use reqwest::Url;
use tokio::sync::mpsc::UnboundedSender;

Expand All @@ -17,8 +16,6 @@ use crate::backend::fetch::ApiClient;
#[cfg(not(test))]
use crate::backend::fetch::MangadexClient;
use crate::backend::filter::Languages;
use crate::backend::tracker::anilist::MarkMangaAsReadQuery;
use crate::backend::tracker::{MangaTracker, MarkAsRead};
use crate::config::{DownloadType, ImageQuality, MangaTuiConfig};
use crate::view::app::MangaToRead;
use crate::view::pages::manga::{ChapterOrder, MangaPageEvents};
Expand Down

0 comments on commit 8d71961

Please sign in to comment.