pub fn trim_raw_string_literal(text: impl AsRef<str>) -> String
Expand description

Turns a string that is likely to come from a raw string literal into something that is probably intended.

  • Strips the first newline if there is one
  • Removes any initial indentation

Example usecase:

do_something(r#"
     fn func() {
        // code
     }
"#)

Results in the string (with no leading newline):

fn func() {
    // code
}