pub fn into_chunk(self) -> crate::CheckableChunk {
        let n = self.len();
        let mut source_mapping = indexmap::IndexMap::with_capacity(n);
        let mut content = String::with_capacity(n * 120);
        if n > 0 {
            // cursor operates on characters
            let mut cursor = 0usize;
            // for use with `Range`
            let mut start; // inclusive
            let mut end; // exclusive
            let mut it = self.literals.iter();
            let mut next = it.next();
            while let Some(literal) = next {
                start = cursor;
                cursor += literal.len_in_chars();
                end = cursor;

                let span = literal.span();
                let range = Range { start, end };

                // TODO this does not hold anymore for `#[doc=foo!(..)]`.
                // TODO where the span is covering `foo!()`, but the
                // TODO rendered length is 0.
                if literal.variant() != CommentVariant::MacroDocEqMacro {
                    if let Some(span_len) = span.one_line_len() {
                        assert_eq!(range.len(), span_len);
                    }
                }
                // keep zero length values too, to guarantee continuity
                source_mapping.insert(range, span);
                content.push_str(literal.as_str());
                // the newline is _not_ covered by a span, after all it's inserted by us!
                next = it.next();
                if next.is_some() {
                    // for the last, skip the newline
                    content.push('\n');
                    cursor += 1;
                }
            }
        }
        // all literals in a set have the same variant, so lets take the first one
        let variant = if let Some(literal) = self.literals.first() {
            literal.variant()
        } else {
            crate::CommentVariant::Unknown
        };
        CheckableChunk::from_string(content, source_mapping, variant)
    }
Convert to a checkable chunk.

Creates the map from content ranges to source spans.
doc-chunks/src/literalset.rs