* wip: remove comment support from autofmt * fix: some edge cases around autoformatting * fix: revert readme * fix: failing test
18 lines
334 B
Rust
18 lines
334 B
Rust
pub fn find_bracket_end(contents: &str) -> Option<usize> {
|
|
let mut depth = 0;
|
|
|
|
for (i, c) in contents.chars().enumerate() {
|
|
if c == '{' {
|
|
depth += 1;
|
|
} else if c == '}' {
|
|
depth -= 1;
|
|
|
|
if depth == 0 {
|
|
return Some(i);
|
|
}
|
|
}
|
|
}
|
|
|
|
None
|
|
}
|