mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 21:28:51 +00:00
Add a check
This commit is contained in:
parent
b9c5d23f69
commit
86b968ba94
1 changed files with 3 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
//! Conversions between [`SyntaxNode`] and [`tt::TokenTree`].
|
//! Conversions between [`SyntaxNode`] and [`tt::TokenTree`].
|
||||||
|
|
||||||
use rustc_hash::{FxHashMap, FxHashSet};
|
use rustc_hash::{FxHashMap, FxHashSet};
|
||||||
use stdx::non_empty_vec::NonEmptyVec;
|
use stdx::{non_empty_vec::NonEmptyVec, always};
|
||||||
use syntax::{
|
use syntax::{
|
||||||
ast::{self, make::tokens::doc_comment},
|
ast::{self, make::tokens::doc_comment},
|
||||||
AstToken, Parse, PreorderWithTokens, SmolStr, SyntaxElement, SyntaxKind,
|
AstToken, Parse, PreorderWithTokens, SmolStr, SyntaxElement, SyntaxKind,
|
||||||
|
@ -30,6 +30,8 @@ pub fn syntax_node_to_token_tree_censored(
|
||||||
let mut c = Convertor::new(node, global_offset, replace, append);
|
let mut c = Convertor::new(node, global_offset, replace, append);
|
||||||
let subtree = convert_tokens(&mut c);
|
let subtree = convert_tokens(&mut c);
|
||||||
c.id_alloc.map.shrink_to_fit();
|
c.id_alloc.map.shrink_to_fit();
|
||||||
|
always!(c.replace.is_empty());
|
||||||
|
always!(c.append.is_empty());
|
||||||
(subtree, c.id_alloc.map)
|
(subtree, c.id_alloc.map)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue