use shorthand constraint syntax and formatting
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -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)(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user