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_export]
macro_rules! defer { macro_rules! defer {
($body:block) => { ($body:block) => {
struct _Defer_<F> struct _Defer_<F: FnMut()> {
where
F: FnMut(),
{
closure: F, closure: F,
} }
impl<F> Drop for _Defer_<F> impl<F: FnMut()> Drop for _Defer_<F> {
where
F: FnMut(),
{
fn drop(&mut self) { (self.closure)(); } fn drop(&mut self) { (self.closure)(); }
} }