summaryrefslogtreecommitdiff
path: root/mingling_macros
diff options
context:
space:
mode:
Diffstat (limited to 'mingling_macros')
-rw-r--r--mingling_macros/src/renderer.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/mingling_macros/src/renderer.rs b/mingling_macros/src/renderer.rs
index 4edac88..f700cbf 100644
--- a/mingling_macros/src/renderer.rs
+++ b/mingling_macros/src/renderer.rs
@@ -112,7 +112,9 @@ pub fn renderer_attr(item: TokenStream) -> TokenStream {
#[cfg(feature = "general_renderer")]
let general_renderer_entry = quote! {
Self::#previous_type => {
- let raw = any.restore::<#previous_type>().unwrap();
+ // SAFETY: Only types that match will enter this branch for forced conversion,
+ // and `AnyOutput::new` ensures the type implements serde::Serialize
+ let raw = unsafe { any.restore::<#previous_type>().unwrap_unchecked() };
let mut r = ::mingling::RenderResult::default();
::mingling::GeneralRenderer::render(&raw, setting, &mut r)?;
Ok(r)