Run cargo and clippy fix
This commit is contained in:
parent
42b7d422a8
commit
17f2985bb7
@ -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::{
|
use crate::{
|
||||||
database::Database,
|
database::Database,
|
||||||
sheet::{I64DateTime, Pdf, Sheet, SheetKind, SheetKindDiscriminants},
|
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(
|
pub async fn insert_file_as_orphan(
|
||||||
database: &Database,
|
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
|
// TODO: when updating book or sheet of book, update all
|
||||||
let sheet_kind = SheetKindDiscriminants::from(&sheet.kind);
|
let sheet_kind = SheetKindDiscriminants::from(&sheet.kind);
|
||||||
let table = sheet_kind.get_database_table_name();
|
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.pdf.path.to_str().unwrap().to_string())
|
||||||
.bind(sheet.id)
|
.bind(sheet.id)
|
||||||
.execute(&database.connection)
|
.execute(&database.connection)
|
||||||
.await
|
.await
|
||||||
.map(|_| ());
|
.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn update_sheet_last_opened(database: &Database, sheet: &Sheet) -> sqlx::Result<()> {
|
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> {
|
fn sheet_ids_from_string(s: String) -> Vec<i64> {
|
||||||
s.trim()
|
s.trim()
|
||||||
.split(",")
|
.split(',')
|
||||||
.map(|s| i64::from_str_radix(s, 10).unwrap())
|
.map(|s| s.parse::<i64>().unwrap())
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use std::{cmp::Ordering, path::Path};
|
|
||||||
|
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
use relm4::prelude::*;
|
use relm4::prelude::*;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user