From: Ian Jackson Date: Sun, 27 Sep 2020 11:35:55 +0000 (+0100) Subject: tidy rental X-Git-Tag: otter-0.2.0~861 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=252411579aae7a058c4042f35a2b33bc861a0156;p=otter.git tidy rental Signed-off-by: Ian Jackson --- diff --git a/src/imports.rs b/src/imports.rs index f70e8fed..1c4ae85b 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -90,6 +90,9 @@ pub use delegate::delegate; pub use itertools::Itertools; +pub use rental::RentalError; +pub use rental::common::RentRef; + pub use ordered_float::OrderedFloat; pub use crate::global::*; diff --git a/src/shapelib.rs b/src/shapelib.rs index 73ad3c7b..44cedf31 100644 --- a/src/shapelib.rs +++ b/src/shapelib.rs @@ -186,14 +186,14 @@ impl Piece for Item { fn itemname(&self) -> &str { &self.itemname } } -use rental::common::RentRef; - #[throws(SpecError)] -pub fn libs_lookup(libname: &str) -> RentRef, Contents> { +pub fn libs_lookup(libname: &str) + -> RentRef, + Contents> { let libs = GLOBAL.shapelibs.read().unwrap(); - RentRef::try_new(libs,|libs|Ok({ + RentRef::try_new(libs,|libs| Ok::<_,SpecError>({ libs.get(libname).ok_or(SE::LibraryNotFound)? - })).map_err::(|e:rental::RentalError<_,_>|e.0)? + })).map_err(|e|e.0)? } impl ItemSpec {