Fix clippy warnings

This commit is contained in:
Tobias Reisinger 2022-07-17 21:01:32 +02:00
parent e3adc35221
commit 467a98af43
2 changed files with 3 additions and 8 deletions

View file

@ -22,7 +22,7 @@ mod period_format {
use chrono::NaiveTime;
use serde::{self, Deserialize, Deserializer, Serializer};
const FORMAT: &'static str = "%H:%M";
const FORMAT: &str = "%H:%M";
pub fn serialize<S>(time: &NaiveTime, serializer: S) -> Result<S::Ok, S::Error>
where
@ -64,7 +64,7 @@ impl FromSql<Binary, Sqlite> for Periods {
let start_val_h: u32 = blob[i - 3] as u32;
let start_val_m: u32 = blob[i - 2] as u32;
let end_val_h: u32 = blob[i - 1] as u32;
let end_val_m: u32 = blob[i - 0] as u32;
let end_val_m: u32 = blob[i] as u32;
vec.push(Period {
start: NaiveTime::from_hms(start_val_h, start_val_m, 0),
end: NaiveTime::from_hms(end_val_h, end_val_m, 0),

View file

@ -125,14 +125,9 @@ pub fn set_schedule_tags(schedule: &Schedule, new_tags: &[String]) -> Result<(),
.load::<Tag>(&connection)
.expect("Error loading tags");
let database_tags_str: Vec<String> = database_tags
.iter()
.map(|tag_db| tag_db.tag.clone())
.collect();
// create missing tags
for new_tag in new_tags {
if !database_tags_str.contains(new_tag) {
if !database_tags.iter().any(|tab_db| tab_db.tag.eq(new_tag)) {
database_tags.push(create_tag(new_tag).expect("Error inserting tag"));
}
}