// FIXME: There is a minor inconsistency here. For lines that start with ##, we
// have no easy way of removing a potential single space after the hashes, which
// is done in the single # case. This inconsistency seems okay, if non-ideal. In
// order to fix it we'd have to iterate to find the first non-# character, and
// then reallocate to remove it; which would make us return a String.
There is a minor inconsistency here. For lines that start with ##, we
have no easy way of removing a potential single space after the hashes, which
is done in the single # case. This inconsistency seems okay, if non-ideal. In
order to fix it we'd have to iterate to find the first non-# character, and
then reallocate to remove it; which would make us return a String.
There is a minor inconsistency here . For lines that start with ## we have no easy way of removing a potential single space after the hashes which is done in the single # case . This inconsistency seems okay if non - ideal . In order to fix it we ' d have to iterate to find the first non - # character and then reallocate to remove it ; which would make us return a String .
fn map_line(s: &str) -> Line {
    let trimmed = s.trim();
    if trimmed.starts_with("##") {
        Line::Shown(Cow::Owned(s.replacen("##", "#", 1)))
    } else if trimmed.starts_with("# ") {
        // # text
        Line::Hidden(&trimmed[2..])
    } else if trimmed == "#" {
        // We cannot handle '#text' because it could be #[attr].
        Line::Hidden("")
    } else {
        Line::Shown(Cow::Borrowed(s))
    }
}
fn map_line ( s : & str ) -> Line { let trimmed = s . trim ( ) ; if trimmed . starts_with ( " " ) { Line :: Shown ( Cow :: Owned ( s . replacen ( " " , " " , 1 ) ) ) } else if trimmed . starts_with ( " " ) { // # text Line :: Hidden ( & trimmed [ 2 .. ] ) } else if trimmed == " " { // We cannot handle '#text' because it could be #[attr]. Line :: Hidden ( " " ) } else { Line :: Shown ( Cow :: Borrowed ( s ) ) } }
FIXME: There is a minor inconsistency here.
FIXME : There is a minor inconsistency here .
s
&str