浏览代码

don't panic if the formatting of the span is different than expected

Evan Almloff 2 年之前
父节点
当前提交
33af22638e
共有 1 个文件被更改,包括 2 次插入5 次删除
  1. 2 5
      packages/rsx/src/lib.rs

+ 2 - 5
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 ),* };