Merge pull request #674 from Ms2ger/start

Use starts_with to avoid panics.
This commit is contained in:
Marcus Klaas de Vries 2015-12-04 16:37:59 +01:00
commit 22353ca8c7

View File

@ -69,7 +69,7 @@ pub fn visit_block(&mut self, b: &ast::Block) {
// 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 {