pub fn trim_trailing_whitespaces(text: &str) -> String {
    text.lines()
        .map(|line| line.trim_end())
        .collect::<Vec<_>>()
        .join("\n")
        .trim_end()
        .to_string()
}
/// Trim trailing whitespaces from every line of text and trailing newlines.
Trim trailing whitespaces from every line of text and trailing newlines.
Trim trailing whitespaces from every line of text and trailing newlines .
pub fn trim_trailing_whitespaces(text: &str) -> String {
    text.lines()
        .map(|line| line.trim_end())
        .collect::<Vec<_>>()
        .join("\n")
        .trim_end()
        .to_string()
}
pub fn trim_trailing_whitespaces ( text : & str ) -> String { text . lines ( ) . map ( | line | line . trim_end ( ) ) . collect :: < Vec < _ > > ( ) . join ( " \n " ) . trim_end ( ) . to_string ( ) }
Trim trailing whitespaces from every line of text and trailing newlines.
Trim trailing whitespaces from every line of text and trailing newlines .
text
&str
text
&str