From d2d69e71840e46537a5a49bd06a890e604b32b99 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 17 Apr 2022 18:40:31 +0100 Subject: [PATCH] hidden: style: Make get take &I and remove some pointles borrow calls Signed-off-by: Ian Jackson --- src/hidden.rs | 4 +--- src/occultilks.rs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/hidden.rs b/src/hidden.rs index c9761cf5..cacef9a1 100644 --- a/src/hidden.rs +++ b/src/hidden.rs @@ -408,8 +408,7 @@ impl IPiece { None => Right({ let occilk = self.occilk.as_ref() .ok_or_else(|| internal_logic_error(format!( - "occulted non-occultable {:?}", self)))? - .borrow(); + "occulted non-occultable {:?}", self)))?; let occ_data = ioccults.ilks.get(occilk) .ok_or_else(|| internal_logic_error(format!( "occulted ilk vanished {:?} {:?}", self, occilk)))?; @@ -698,7 +697,6 @@ fn recalculate_occultation_general< if_chain!{ if occ.notches.is_empty(); if let Some(ilk) = wants!( ipc.occilk.as_ref() ); - let ilk = ilk.borrow(); if let Some(ilk) = wants!( ioccults.ilks.get(ilk) ); if let Some(bbox) = want!( Ok = ilk.p_occ.bbox_approx() ); if let Some(size) = want!( Ok = bbox.br() - bbox.tl(), ?(bbox) ); diff --git a/src/occultilks.rs b/src/occultilks.rs index f9d6ccd7..f7ac81a7 100644 --- a/src/occultilks.rs +++ b/src/occultilks.rs @@ -39,7 +39,7 @@ pub struct Data { impl OccultIlks { #[throws(as Option)] - pub fn get>(&self, id: I) -> &V { + pub fn get>(&self, id: &I) -> &V { &self.table.get(*id.borrow())?.v } -- 2.30.2