Fix clippy warnings
This commit is contained in:
parent
e3adc35221
commit
467a98af43
2 changed files with 3 additions and 8 deletions
|
@ -22,7 +22,7 @@ mod period_format {
|
||||||
use chrono::NaiveTime;
|
use chrono::NaiveTime;
|
||||||
use serde::{self, Deserialize, Deserializer, Serializer};
|
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>
|
pub fn serialize<S>(time: &NaiveTime, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
|
@ -64,7 +64,7 @@ impl FromSql<Binary, Sqlite> for Periods {
|
||||||
let start_val_h: u32 = blob[i - 3] as u32;
|
let start_val_h: u32 = blob[i - 3] as u32;
|
||||||
let start_val_m: u32 = blob[i - 2] 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_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 {
|
vec.push(Period {
|
||||||
start: NaiveTime::from_hms(start_val_h, start_val_m, 0),
|
start: NaiveTime::from_hms(start_val_h, start_val_m, 0),
|
||||||
end: NaiveTime::from_hms(end_val_h, end_val_m, 0),
|
end: NaiveTime::from_hms(end_val_h, end_val_m, 0),
|
||||||
|
|
|
@ -125,14 +125,9 @@ pub fn set_schedule_tags(schedule: &Schedule, new_tags: &[String]) -> Result<(),
|
||||||
.load::<Tag>(&connection)
|
.load::<Tag>(&connection)
|
||||||
.expect("Error loading tags");
|
.expect("Error loading tags");
|
||||||
|
|
||||||
let database_tags_str: Vec<String> = database_tags
|
|
||||||
.iter()
|
|
||||||
.map(|tag_db| tag_db.tag.clone())
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
// create missing tags
|
// create missing tags
|
||||||
for new_tag in new_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"));
|
database_tags.push(create_tag(new_tag).expect("Error inserting tag"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue