Use starts_with to avoid panics.

This commit is contained in:
Ms2ger 2015-12-04 16:10:14 +01:00
parent 34737529db
commit 1ed36a3a6b

View file

@ -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 {