chiark / gitweb /
tidy rental
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 27 Sep 2020 11:35:55 +0000 (12:35 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 27 Sep 2020 11:35:55 +0000 (12:35 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/imports.rs
src/shapelib.rs

index f70e8fed693c31f18584953e7308190295e72639..1c4ae85bf39b0f3e545356414c80e2af172042af 100644 (file)
@@ -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::*;
index 73ad3c7b3668df6bb0e5d2016236983cfc4dcec8..44cedf3145620d5bf1d5762759fd4253f2c86191 100644 (file)
@@ -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<RwLockReadGuard<'static, Registry>, Contents> {
+pub fn libs_lookup(libname: &str)
+                   -> RentRef<RwLockReadGuard<'static, Registry>,
+                              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::<SpecError,_>(|e:rental::RentalError<_,_>|e.0)?
+  })).map_err(|e|e.0)?
 }
 
 impl ItemSpec {