pub(crate) fn remove_tl_comments(contents: &str) -> String {
    let mut result = String::with_capacity(contents.len());
    let mut in_comment = false;

    contents.chars().enumerate().for_each(|(i, c)| {
        if contents[i..contents.len().min(i + 2)] == *"//" {
            in_comment = true;
        } else if in_comment && c == '\n' {
            in_comment = false;
        }

        if !in_comment {
            result.push(c);
        }
    });

    result.shrink_to_fit();
    result
}
/// Removes all single-line comments from the contents.
Removes all single-line comments from the contents.
Removes all single - line comments from the contents .
pub(crate) fn remove_tl_comments(contents: &str) -> String {
    let mut result = String::with_capacity(contents.len());
    let mut in_comment = false;
    contents.chars().enumerate().for_each(|(i, c)| {
        if contents[i..contents.len().min(i + 2)] == *"//" {
            in_comment = true;
        } else if in_comment && c == '\n' {
            in_comment = false;
        }
        if !in_comment {
            result.push(c);
        }
    });
    result.shrink_to_fit();
    result
}
pub ( crate ) fn remove_tl_comments ( contents : & str ) -> String { let mut result = String :: with_capacity ( contents . len ( ) ) ; let mut in_comment = false ; contents . chars ( ) . enumerate ( ) . for_each ( | ( i , c ) | { if contents [ i .. contents . len ( ) . min ( i + 2 ) ] == * " " { in_comment = true ; } else if in_comment && c == '\n' { in_comment = false ; } if ! in_comment { result . push ( c ) ; } } ) ; result . shrink_to_fit ( ) ; result }
Removes all single-line comments from the contents.
Removes all single - line comments from the contents .
contents
&str
contents
&str