Determine the indentation used for members inside the class body. Looks at the line after the opening brace to detect the indent.
(content: &str, body_start: usize)
| 577 | /// Determine the indentation used for members inside the class body. |
| 578 | /// Looks at the line after the opening brace to detect the indent. |
| 579 | fn detect_member_indent(content: &str, body_start: usize) -> String { |
| 580 | // Find the first newline after the opening brace. |
| 581 | if let Some(nl_pos) = content[body_start..].find('\n') { |
| 582 | let line_start = body_start + nl_pos + 1; |
| 583 | let rest = &content[line_start..]; |
| 584 | let indent_len = rest.chars().take_while(|c| *c == ' ' || *c == '\t').count(); |
| 585 | if indent_len > 0 { |
| 586 | return rest[..indent_len].to_string(); |
| 587 | } |
| 588 | } |
| 589 | // Fallback: 4 spaces. |
| 590 | " ".to_string() |
| 591 | } |
| 592 | |
| 593 | // ─── Code action ──────────────────────────────────────────────────────────── |
| 594 |
no test coverage detected