From 6d5d82e412dea19ea48eecc6f7d5a4aa223a9599 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 20 Jul 2019 12:48:24 +0300 Subject: move debug_dump to fmt::Debug --- crates/ra_mbe/src/tests.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_mbe') diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs index 38a31109d..9151b6ecd 100644 --- a/crates/ra_mbe/src/tests.rs +++ b/crates/ra_mbe/src/tests.rs @@ -412,7 +412,7 @@ fn test_expand_to_item_list() { let expansion = expand(&rules, "structs!(Foo, Bar);"); let tree = token_tree_to_macro_items(&expansion).unwrap().tree(); assert_eq!( - tree.syntax().debug_dump().trim(), + format!("{:#?}", tree.syntax()).trim(), r#" MACRO_ITEMS@[0; 40) STRUCT_DEF@[0; 20) @@ -531,7 +531,7 @@ fn test_tt_to_stmts() { let stmts = token_tree_to_macro_stmts(&expanded).unwrap().tree(); assert_eq!( - stmts.syntax().debug_dump().trim(), + format!("{:#?}", stmts.syntax()).trim(), r#"MACRO_STMTS@[0; 15) LET_STMT@[0; 7) LET_KW@[0; 3) "let" @@ -669,7 +669,7 @@ fn test_expr_order() { ); assert_eq!( - expand_to_items(&rules, "foo! { 1 + 1 }").syntax().debug_dump().trim(), + format!("{:#?}", expand_to_items(&rules, "foo! { 1 + 1 }").syntax()).trim(), r#"MACRO_ITEMS@[0; 15) FN_DEF@[0; 15) FN_KW@[0; 2) "fn" @@ -1013,7 +1013,7 @@ fn test_vec() { ); assert_eq!( - expand_to_expr(&rules, r#"vec![1u32,2];"#).syntax().debug_dump().trim(), + format!("{:#?}", expand_to_expr(&rules, r#"vec![1u32,2];"#).syntax()).trim(), r#"BLOCK_EXPR@[0; 45) BLOCK@[0; 45) L_CURLY@[0; 1) "{" -- cgit v1.2.3 From f3bdbec1b68fa0e20f0b7b6c6ef64e1507970b0d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 20 Jul 2019 12:58:27 +0300 Subject: rename range -> text_range --- crates/ra_mbe/src/syntax_bridge.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_mbe') diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs index 64ed6a517..7ff0fc472 100644 --- a/crates/ra_mbe/src/syntax_bridge.rs +++ b/crates/ra_mbe/src/syntax_bridge.rs @@ -19,7 +19,7 @@ pub struct TokenMap { pub fn ast_to_token_tree(ast: &ast::TokenTree) -> Option<(tt::Subtree, TokenMap)> { let mut token_map = TokenMap::default(); let node = ast.syntax(); - let tt = convert_tt(&mut token_map, node.range().start(), node)?; + let tt = convert_tt(&mut token_map, node.text_range().start(), node)?; Some((tt, token_map)) } @@ -27,7 +27,7 @@ pub fn ast_to_token_tree(ast: &ast::TokenTree) -> Option<(tt::Subtree, TokenMap) /// will consume). pub fn syntax_node_to_token_tree(node: &SyntaxNode) -> Option<(tt::Subtree, TokenMap)> { let mut token_map = TokenMap::default(); - let tt = convert_tt(&mut token_map, node.range().start(), node)?; + let tt = convert_tt(&mut token_map, node.text_range().start(), node)?; Some((tt, token_map)) } @@ -229,7 +229,7 @@ fn convert_tt( || token.kind() == IDENT || token.kind() == LIFETIME { - let relative_range = token.range() - global_offset; + let relative_range = token.text_range() - global_offset; let id = token_map.alloc(relative_range); let text = token.text().clone(); tt::Leaf::from(tt::Ident { text, id }).into() -- cgit v1.2.3