diff --git a/src/cache.rs b/src/cache.rs index 02db660..fc2ef4a 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -187,8 +187,8 @@ impl CalDavSource for Cache { ) } - async fn get_calendar(&self, id: CalendarId) -> Option>> { - self.data.calendars.get(&id).map(|arc| arc.clone()) + async fn get_calendar(&self, id: &CalendarId) -> Option>> { + self.data.calendars.get(id).map(|arc| arc.clone()) } } diff --git a/src/client.rs b/src/client.rs index ae110f7..1dee51d 100644 --- a/src/client.rs +++ b/src/client.rs @@ -220,11 +220,11 @@ impl CalDavSource for Client { } - async fn get_calendar(&self, id: CalendarId) -> Option>> { + async fn get_calendar(&self, id: &CalendarId) -> Option>> { self.cached_replies.lock().unwrap() .calendars .as_ref() - .and_then(|cals| cals.get(&id)) + .and_then(|cals| cals.get(id)) .map(|cal| cal.clone()) } } diff --git a/src/provider.rs b/src/provider.rs index 3fcbdcc..bcedd1d 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -68,7 +68,7 @@ where 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 { + let cal_local = match self.local.get_calendar(&id).await { None => { log::error!("TODO: implement here"); continue; diff --git a/src/traits.rs b/src/traits.rs index 674f0b8..9c5c9d6 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -15,7 +15,7 @@ pub trait CalDavSource { /// This function may trigger an update (that can be a long process, or that can even fail, e.g. in case of a remote server) async fn get_calendars(&self) -> Result>>, Box>; /// Returns the calendar matching the ID - async fn get_calendar(&self, id: CalendarId) -> Option>>; + async fn get_calendar(&self, id: &CalendarId) -> Option>>; } pub trait SyncSlave { diff --git a/tests/sync.rs b/tests/sync.rs index ba0ea02..1c44fe7 100644 --- a/tests/sync.rs +++ b/tests/sync.rs @@ -104,7 +104,7 @@ async fn populate_test_provider() -> Provider Provider