Run cargo and clippy fix

This commit is contained in:
Julian Mutter 2024-02-11 09:38:42 +01:00
parent 42b7d422a8
commit 17f2985bb7
2 changed files with 9 additions and 12 deletions

View File

@ -1,14 +1,11 @@
use std::path::{Path, PathBuf};
use strum::{EnumMessage, IntoEnumIterator};
use strum_macros::{EnumDiscriminants, EnumIter, EnumString};
use chrono::{DateTime, NaiveDateTime, Utc};
use sqlx::{sqlite::SqliteRow, Row, SqlitePool};
use crate::{
database::Database,
sheet::{I64DateTime, Pdf, Sheet, SheetKind, SheetKindDiscriminants},
};
use chrono::{DateTime, Utc};
use sqlx::{sqlite::SqliteRow, Row};
use std::path::{Path, PathBuf};
use strum::IntoEnumIterator;
pub async fn insert_file_as_orphan(
database: &Database,
@ -53,12 +50,12 @@ pub async fn update_sheet_path(database: &Database, sheet: &Sheet) -> sqlx::Resu
// TODO: when updating book or sheet of book, update all
let sheet_kind = SheetKindDiscriminants::from(&sheet.kind);
let table = sheet_kind.get_database_table_name();
return sqlx::query(&format!("UPDATE {} SET path = $1 WHERE id = $2", table))
sqlx::query(&format!("UPDATE {} SET path = $1 WHERE id = $2", table))
.bind(sheet.pdf.path.to_str().unwrap().to_string())
.bind(sheet.id)
.execute(&database.connection)
.await
.map(|_| ());
.map(|_| ())
}
pub async fn update_sheet_last_opened(database: &Database, sheet: &Sheet) -> sqlx::Result<()> {
@ -117,8 +114,8 @@ fn parse_kind_from_row(kind: SheetKindDiscriminants, row: SqliteRow) -> sqlx::Re
fn sheet_ids_from_string(s: String) -> Vec<i64> {
s.trim()
.split(",")
.map(|s| i64::from_str_radix(s, 10).unwrap())
.split(',')
.map(|s| s.parse::<i64>().unwrap())
.collect()
}

View File

@ -1,4 +1,4 @@
use std::{cmp::Ordering, path::Path};
use gtk::prelude::*;
use relm4::prelude::*;