From 70557160f213e5da130cf6d8609d95834fd830fe Mon Sep 17 00:00:00 2001 From: daladim Date: Fri, 19 Mar 2021 00:08:16 +0100 Subject: [PATCH] Fixed warnings --- src/calendar/remote_calendar.rs | 8 ++++---- src/provider.rs | 8 +++++--- tests/sync.rs | 8 ++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/calendar/remote_calendar.rs b/src/calendar/remote_calendar.rs index 8dbb851..a009de0 100644 --- a/src/calendar/remote_calendar.rs +++ b/src/calendar/remote_calendar.rs @@ -34,7 +34,7 @@ impl PartialCalendar for RemoteCalendar { } /// Returns the items that have been last-modified after `since` - fn get_items_modified_since(&self, since: Option>, filter: Option) + fn get_items_modified_since(&self, _since: Option>, _filter: Option) -> HashMap { log::error!("Not implemented"); @@ -48,18 +48,18 @@ impl PartialCalendar for RemoteCalendar { } /// Returns a particular item - fn get_item_by_id_mut(&mut self, id: &ItemId) -> Option<&mut Item> { + fn get_item_by_id_mut(&mut self, _id: &ItemId) -> Option<&mut Item> { log::error!("Not implemented"); None } /// Add an item into this calendar - fn add_item(&mut self, item: Item) { + fn add_item(&mut self, _item: Item) { log::error!("Not implemented"); } /// Remove an item from this calendar - fn delete_item(&mut self, item_id: &ItemId) -> Result<(), Box> { + fn delete_item(&mut self, _item_id: &ItemId) -> Result<(), Box> { log::error!("Not implemented"); Ok(()) } diff --git a/src/provider.rs b/src/provider.rs index 7a047db..96a55da 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -1,7 +1,7 @@ //! This modules abstracts data sources and merges them in a single virtual one use std::error::Error; -use std::collections::{HashSet, HashMap}; +use std::collections::HashSet; use std::marker::PhantomData; use chrono::{DateTime, Utc}; @@ -65,7 +65,7 @@ where log::info!("Starting a sync. Last sync was at {:?}", last_sync); let cals_server = self.server.get_calendars().await?; - for (id, mut cal_server) in cals_server { + for (id, cal_server) in cals_server { let mut cal_server = cal_server.lock().unwrap(); let cal_local = match self.local.get_calendar(id).await { @@ -146,6 +146,8 @@ fn move_to_calendar(items: &mut Vec, calendar: &mut C) fn remove_from_calendar(ids: &Vec, calendar: &mut C) { for id in ids { log::info!(" Removing {:?} from local calendar", id); - calendar.delete_item(id); + if let Err(err) = calendar.delete_item(id) { + log::warn!("Unable to delete item {:?} from calendar: {}", id, err); + } } } diff --git a/tests/sync.rs b/tests/sync.rs index a9040c4..df70dfc 100644 --- a/tests/sync.rs +++ b/tests/sync.rs @@ -104,7 +104,7 @@ async fn populate_test_provider() -> Provider Provider Provider Provider