fn indent_first_line(fixture: &str) -> String {
    if fixture.is_empty() {
        return String::new();
    }
    let mut lines = fixture.lines();
    let first_line = lines.next().unwrap();
    if first_line.contains("//-") {
        let rest = lines.collect::<Vec<_>>().join("\n");
        let fixed_margin = fixture_margin(&rest);
        let fixed_indent = fixed_margin - indent_len(first_line);
        format!("\n{}{}\n{}", " ".repeat(fixed_indent), first_line, rest)
    } else {
        fixture.to_owned()
    }
}
/// Adjusts the indentation of the first line to the minimum indentation of the rest of the lines.
/// This allows fixtures to start off in a different indentation, e.g. to align the first line with
/// the other lines visually:
/// ```
/// let fixture = "//- /lib.rs
///                mod foo;
///                //- /foo.rs
///                fn bar() {}
/// ";
/// assert_eq!(fixture_margin(fixture),
/// "               //- /lib.rs
///                mod foo;
///                //- /foo.rs
///                fn bar() {}
/// ")
/// ```
Adjusts the indentation of the first line to the minimum indentation of the rest of the lines.
This allows fixtures to start off in a different indentation, e.g.
Adjusts the indentation of the first line to the minimum indentation of the rest of the lines . This allows fixtures to start off in a different indentation e . g .
fn indent_first_line(fixture: &str) -> String {
    if fixture.is_empty() {
        return String::new();
    }
    let mut lines = fixture.lines();
    let first_line = lines.next().unwrap();
    if first_line.contains("//-") {
        let rest = lines.collect::<Vec<_>>().join("\n");
        let fixed_margin = fixture_margin(&rest);
        let fixed_indent = fixed_margin - indent_len(first_line);
        format!("\n{}{}\n{}", " ".repeat(fixed_indent), first_line, rest)
    } else {
        fixture.to_owned()
    }
}
fn indent_first_line ( fixture : & str ) -> String { if fixture . is_empty ( ) { return String :: new ( ) ; } let mut lines = fixture . lines ( ) ; let first_line = lines . next ( ) . unwrap ( ) ; if first_line . contains ( " " ) { let rest = lines . collect :: < Vec < _ > > ( ) . join ( " \n " ) ; let fixed_margin = fixture_margin ( & rest ) ; let fixed_indent = fixed_margin - indent_len ( first_line ) ; format ! ( " \n \n " " " repeat ( fixed_indent ) first_line rest ) } else { fixture . to_owned ( ) } }
Adjusts the indentation of the first line to the minimum indentation of the rest of the lines.
Adjusts the indentation of the first line to the minimum indentation of the rest of the lines .
fixture
&str
fixture
&str