use shorthand constraint syntax and formatting

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-05 08:48:24 +00:00
parent a388c2e06e
commit 611f09829e

View file

@ -1,17 +1,11 @@
#[macro_export]
macro_rules! defer {
($body:block) => {
struct _Defer_<F>
where
F: FnMut(),
{
struct _Defer_<F: FnMut()> {
closure: F,
}
impl<F> Drop for _Defer_<F>
where
F: FnMut(),
{
impl<F: FnMut()> Drop for _Defer_<F> {
fn drop(&mut self) { (self.closure)(); }
}