Skip to content

Commit 0a3acf1

Browse files
committed
fix!: return lock_scope closure
1 parent 456fee4 commit 0a3acf1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,21 @@ mod extended;
3636
pub mod pointer_like;
3737
mod ref_once;
3838

39+
pub use extended::Extender;
3940
pub use extended::func::legacy::{ExtendedFn, ExtendedFnMut, ExtendedFnOnce};
4041
pub use extended::func::{extend_fn_mut_unchecked, extend_fn_once_unchecked, extend_fn_unchecked};
4142
pub use extended::future::extend_future_unchecked;
4243
pub use extended::future::legacy::ExtendedFuture;
43-
pub use extended::Extender;
4444
pub use ref_once::RefOnce;
4545

46-
pub fn lock_scope<'env, F, T>(scope: F)
46+
pub fn lock_scope<'env, F, T>(scope: F) -> T
4747
where
4848
F: for<'scope> FnOnce(&'scope Extender<'scope, 'env>) -> T,
4949
{
5050
let rw_lock = RwLock::new(());
5151
let extender = Extender::new(&rw_lock);
52-
let guard = extender.guard();
53-
scope(&extender);
54-
drop(guard);
52+
let _guard = extender.guard();
53+
scope(&extender)
5554
}
5655

5756
// TODO: zero case test

0 commit comments

Comments
 (0)