4658: Fix problem with format string tokenization r=matklad a=ruabmbua

Fixed by just not handling closing curlybrace escaping.

Closes https://github.com/rust-analyzer/rust-analyzer/issues/4637

Co-authored-by: Roland Ruckerbauer <roland.rucky@gmail.com>
This commit is contained in:
bors[bot] 2020-06-02 12:13:02 +00:00 committed by GitHub
commit fe6508bd78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 5 deletions

View file

@ -418,14 +418,9 @@ pub trait HasFormatSpecifier: AstToken {
let mut cloned = chars.clone().take(2);
let first = cloned.next().and_then(|next| next.1.as_ref().ok()).copied();
let second = cloned.next().and_then(|next| next.1.as_ref().ok()).copied();
if first != Some('}') {
continue;
}
if second == Some('}') {
// Escaped format end specifier, `}}`
continue;
}
skip_char_and_emit(&mut chars, FormatSpecifier::Close, &mut callback);
}
_ => {