hellux/jotdown

Avoid unsafe in PrePass::new

Closed this issue · 0 comments

hellux commented

We currently have an unsafe block when performing the prepass:

// SAFETY: used_ids is dropped before the id_auto strings in headings. even if
// the strings move due to headings reallocating, the string data on the heap
// will not move
used_ids.insert(unsafe {
    std::mem::transmute::<&str, &'static str>(id_auto.as_ref())
});

I don't think it is causing any problems but it would be good to get rid of it.