chore: use safe span split
This commit is contained in:
1 parent
0dce3e03c8
commit
c9e13984e3
1 file changed
+4
-5
@@ -114,11 +114,10 @@ impl<'a> ToTokens for TemplateRenderer<'a> {
|
||||
};
|
||||
|
||||
let spndbg = format!("{:?}", self.roots[0].span());
|
||||
let root_col = if spndbg.len() >= 9 {
|
||||
spndbg[9..].split("..").next().unwrap()
|
||||
} else {
|
||||
""
|
||||
};
|
||||
let root_col = spndbg
|
||||
.rsplit_once("..")
|
||||
.and_then(|(_, after)| after.split_once(')').map(|(before, _)| before))
|
||||
.unwrap_or_default();
|
||||
|
||||
let root_printer = self.roots.iter().enumerate().map(|(idx, root)| {
|
||||
context.current_path.push(idx as u8);
|
||||
|
||||
Reference in new issue
Block a user