From: Ian Jackson Date: Sun, 17 Apr 2022 17:40:31 +0000 (+0100) Subject: hidden: style: Make get take &I and remove some pointles borrow calls X-Git-Tag: otter-1.1.0~512 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=d2d69e71840e46537a5a49bd06a890e604b32b99;p=otter.git hidden: style: Make get take &I and remove some pointles borrow calls Signed-off-by: Ian Jackson --- 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 }