Files
dioxus/packages/autofmt/src/util.rs
T
Jon Kelley 3a30b36f68 fix: some edge cases around autoformatting (#485)
* wip: remove comment support from autofmt

* fix: some edge cases around autoformatting

* fix: revert readme

* fix: failing test
2022-07-04 21:11:03 -04:00

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
}