Apply async unsafe swap in generated code
diff --git a/src/gen/visit.rs b/src/gen/visit.rs
index 3e43914..62288c6 100644
--- a/src/gen/visit.rs
+++ b/src/gen/visit.rs
@@ -2200,10 +2200,10 @@
if let Some(ref it) = _i.constness {
tokens_helper(_visitor, &it.span)
};
- if let Some(ref it) = _i.unsafety {
+ if let Some(ref it) = _i.asyncness {
tokens_helper(_visitor, &it.span)
};
- if let Some(ref it) = _i.asyncness {
+ if let Some(ref it) = _i.unsafety {
tokens_helper(_visitor, &it.span)
};
if let Some(ref it) = _i.abi {
@@ -2583,10 +2583,10 @@
if let Some(ref it) = _i.constness {
tokens_helper(_visitor, &it.span)
};
- if let Some(ref it) = _i.unsafety {
+ if let Some(ref it) = _i.asyncness {
tokens_helper(_visitor, &it.span)
};
- if let Some(ref it) = _i.asyncness {
+ if let Some(ref it) = _i.unsafety {
tokens_helper(_visitor, &it.span)
};
if let Some(ref it) = _i.abi {
diff --git a/src/gen/visit_mut.rs b/src/gen/visit_mut.rs
index 55bae33..dbb29c4 100644
--- a/src/gen/visit_mut.rs
+++ b/src/gen/visit_mut.rs
@@ -2158,10 +2158,10 @@
if let Some(ref mut it) = _i.constness {
tokens_helper(_visitor, &mut it.span)
};
- if let Some(ref mut it) = _i.unsafety {
+ if let Some(ref mut it) = _i.asyncness {
tokens_helper(_visitor, &mut it.span)
};
- if let Some(ref mut it) = _i.asyncness {
+ if let Some(ref mut it) = _i.unsafety {
tokens_helper(_visitor, &mut it.span)
};
if let Some(ref mut it) = _i.abi {
@@ -2526,10 +2526,10 @@
if let Some(ref mut it) = _i.constness {
tokens_helper(_visitor, &mut it.span)
};
- if let Some(ref mut it) = _i.unsafety {
+ if let Some(ref mut it) = _i.asyncness {
tokens_helper(_visitor, &mut it.span)
};
- if let Some(ref mut it) = _i.asyncness {
+ if let Some(ref mut it) = _i.unsafety {
tokens_helper(_visitor, &mut it.span)
};
if let Some(ref mut it) = _i.abi {
diff --git a/tests/debug/gen.rs b/tests/debug/gen.rs
index 7ac0679..f055126 100644
--- a/tests/debug/gen.rs
+++ b/tests/debug/gen.rs
@@ -2862,18 +2862,6 @@
}
formatter.field("constness", Print::ref_cast(val));
}
- if let Some(val) = &_val.unsafety {
- #[derive(RefCast)]
- #[repr(transparent)]
- struct Print(syn::token::Unsafe);
- impl Debug for Print {
- fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
- formatter.write_str("Some")?;
- Ok(())
- }
- }
- formatter.field("unsafety", Print::ref_cast(val));
- }
if let Some(val) = &_val.asyncness {
#[derive(RefCast)]
#[repr(transparent)]
@@ -2886,6 +2874,18 @@
}
formatter.field("asyncness", Print::ref_cast(val));
}
+ if let Some(val) = &_val.unsafety {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Unsafe);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("unsafety", Print::ref_cast(val));
+ }
if let Some(val) = &_val.abi {
#[derive(RefCast)]
#[repr(transparent)]
@@ -3342,18 +3342,6 @@
}
formatter.field("constness", Print::ref_cast(val));
}
- if let Some(val) = &_val.unsafety {
- #[derive(RefCast)]
- #[repr(transparent)]
- struct Print(syn::token::Unsafe);
- impl Debug for Print {
- fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
- formatter.write_str("Some")?;
- Ok(())
- }
- }
- formatter.field("unsafety", Print::ref_cast(val));
- }
if let Some(val) = &_val.asyncness {
#[derive(RefCast)]
#[repr(transparent)]
@@ -3366,6 +3354,18 @@
}
formatter.field("asyncness", Print::ref_cast(val));
}
+ if let Some(val) = &_val.unsafety {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Unsafe);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("unsafety", Print::ref_cast(val));
+ }
if let Some(val) = &_val.abi {
#[derive(RefCast)]
#[repr(transparent)]
@@ -4031,18 +4031,6 @@
}
formatter.field("constness", Print::ref_cast(val));
}
- if let Some(val) = &_val.unsafety {
- #[derive(RefCast)]
- #[repr(transparent)]
- struct Print(syn::token::Unsafe);
- impl Debug for Print {
- fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
- formatter.write_str("Some")?;
- Ok(())
- }
- }
- formatter.field("unsafety", Print::ref_cast(val));
- }
if let Some(val) = &_val.asyncness {
#[derive(RefCast)]
#[repr(transparent)]
@@ -4055,6 +4043,18 @@
}
formatter.field("asyncness", Print::ref_cast(val));
}
+ if let Some(val) = &_val.unsafety {
+ #[derive(RefCast)]
+ #[repr(transparent)]
+ struct Print(syn::token::Unsafe);
+ impl Debug for Print {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("Some")?;
+ Ok(())
+ }
+ }
+ formatter.field("unsafety", Print::ref_cast(val));
+ }
if let Some(val) = &_val.abi {
#[derive(RefCast)]
#[repr(transparent)]