Use starts_with to avoid panics.
This commit is contained in:
parent
34737529db
commit
1ed36a3a6b
1 changed files with 1 additions and 1 deletions
|
@ -69,7 +69,7 @@ impl<'a> FmtVisitor<'a> {
|
|||
|
||||
// Check if this block has braces.
|
||||
let snippet = self.snippet(b.span);
|
||||
let has_braces = &snippet[..1] == "{" || &snippet[..6] == "unsafe";
|
||||
let has_braces = snippet.starts_with("{") || snippet.starts_with("unsafe");
|
||||
let brace_compensation = if has_braces {
|
||||
BytePos(1)
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue