mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
dead code
This commit is contained in:
parent
e9902b92ab
commit
c6d5c1c946
1 changed files with 1 additions and 22 deletions
|
@ -80,6 +80,7 @@ macro_rules! impl_fixture {
|
||||||
test_utils::assert_eq_text!(&expected.trim(), &actual.trim());
|
test_utils::assert_eq_text!(&expected.trim(), &actual.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
fn assert_expand_items(&self, invocation: &str, expected: &str) -> &$name {
|
fn assert_expand_items(&self, invocation: &str, expected: &str) -> &$name {
|
||||||
self.assert_expansion(ParserEntryPoint::Items, invocation, expected);
|
self.assert_expansion(ParserEntryPoint::Items, invocation, expected);
|
||||||
self
|
self
|
||||||
|
@ -140,12 +141,6 @@ pub(crate) fn parse_macro(ra_fixture: &str) -> MacroFixture {
|
||||||
MacroFixture { rules }
|
MacroFixture { rules }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn parse_macro2(ra_fixture: &str) -> MacroFixture2 {
|
|
||||||
let definition_tt = parse_macro_def_to_tt(ra_fixture);
|
|
||||||
let rules = MacroDef::parse(&definition_tt).unwrap();
|
|
||||||
MacroFixture2 { rules }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn parse_macro_error(ra_fixture: &str) -> ParseError {
|
pub(crate) fn parse_macro_error(ra_fixture: &str) -> ParseError {
|
||||||
let definition_tt = parse_macro_rules_to_tt(ra_fixture);
|
let definition_tt = parse_macro_rules_to_tt(ra_fixture);
|
||||||
|
|
||||||
|
@ -183,22 +178,6 @@ fn parse_macro_rules_to_tt(ra_fixture: &str) -> tt::Subtree {
|
||||||
definition_tt
|
definition_tt
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_macro_def_to_tt(ra_fixture: &str) -> tt::Subtree {
|
|
||||||
let source_file = ast::SourceFile::parse(ra_fixture).ok().unwrap();
|
|
||||||
let macro_definition =
|
|
||||||
source_file.syntax().descendants().find_map(ast::MacroDef::cast).unwrap();
|
|
||||||
|
|
||||||
let (definition_tt, _) = syntax_node_to_token_tree(macro_definition.body().unwrap().syntax());
|
|
||||||
|
|
||||||
let parsed =
|
|
||||||
parse_to_token_tree(&ra_fixture[macro_definition.body().unwrap().syntax().text_range()])
|
|
||||||
.unwrap()
|
|
||||||
.0;
|
|
||||||
assert_eq!(definition_tt, parsed);
|
|
||||||
|
|
||||||
definition_tt
|
|
||||||
}
|
|
||||||
|
|
||||||
fn debug_dump_ignore_spaces(node: &syntax::SyntaxNode) -> String {
|
fn debug_dump_ignore_spaces(node: &syntax::SyntaxNode) -> String {
|
||||||
let mut level = 0;
|
let mut level = 0;
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue