From 33af22638e5dfecc86bef3007cd183039ab214e6 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Fri, 23 Dec 2022 17:23:46 -0600 Subject: [PATCH] don't panic if the formatting of the span is different than expected --- packages/rsx/src/lib.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/rsx/src/lib.rs b/packages/rsx/src/lib.rs index c43c382a0..a30225a00 100644 --- a/packages/rsx/src/lib.rs +++ b/packages/rsx/src/lib.rs @@ -190,11 +190,8 @@ impl<'a, Ctx: HotReloadingContext> ToTokens for TemplateRenderer<'a, Ctx> { let spndbg = format!("{:?}", self.roots[0].span()); let root_col = spndbg .rsplit_once("..") - .unwrap() - .1 - .split_once(')') - .unwrap() - .0; + .and_then(|(_, after)| after.split_once(')').map(|(before, _)| before)) + .unwrap_or_default(); // Render and release the mutable borrow on context let roots = quote! { #( #root_printer ),* };