diff options
Diffstat (limited to 'crates/hir_expand')
-rw-r--r-- | crates/hir_expand/src/builtin_macro.rs | 6 | ||||
-rw-r--r-- | crates/hir_expand/src/input.rs | 2 | ||||
-rw-r--r-- | crates/hir_expand/src/proc_macro.rs | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir_expand/src/builtin_macro.rs b/crates/hir_expand/src/builtin_macro.rs index 0b310ba2f..51572226e 100644 --- a/crates/hir_expand/src/builtin_macro.rs +++ b/crates/hir_expand/src/builtin_macro.rs | |||
@@ -354,7 +354,7 @@ fn concat_expand( | |||
354 | // concat works with string and char literals, so remove any quotes. | 354 | // concat works with string and char literals, so remove any quotes. |
355 | // It also works with integer, float and boolean literals, so just use the rest | 355 | // It also works with integer, float and boolean literals, so just use the rest |
356 | // as-is. | 356 | // as-is. |
357 | let component = unquote_str(&it).unwrap_or_else(|| it.text.to_string()); | 357 | let component = unquote_str(it).unwrap_or_else(|| it.text.to_string()); |
358 | text.push_str(&component); | 358 | text.push_str(&component); |
359 | } | 359 | } |
360 | // handle boolean literals | 360 | // handle boolean literals |
@@ -417,7 +417,7 @@ fn parse_string(tt: &tt::Subtree) -> Result<String, mbe::ExpandError> { | |||
417 | tt.token_trees | 417 | tt.token_trees |
418 | .get(0) | 418 | .get(0) |
419 | .and_then(|tt| match tt { | 419 | .and_then(|tt| match tt { |
420 | tt::TokenTree::Leaf(tt::Leaf::Literal(it)) => unquote_str(&it), | 420 | tt::TokenTree::Leaf(tt::Leaf::Literal(it)) => unquote_str(it), |
421 | _ => None, | 421 | _ => None, |
422 | }) | 422 | }) |
423 | .ok_or_else(|| mbe::ExpandError::ConversionError) | 423 | .ok_or_else(|| mbe::ExpandError::ConversionError) |
@@ -561,7 +561,7 @@ mod tests { | |||
561 | use syntax::ast::NameOwner; | 561 | use syntax::ast::NameOwner; |
562 | 562 | ||
563 | fn expand_builtin_macro(ra_fixture: &str) -> String { | 563 | fn expand_builtin_macro(ra_fixture: &str) -> String { |
564 | let (db, file_id) = TestDB::with_single_file(&ra_fixture); | 564 | let (db, file_id) = TestDB::with_single_file(ra_fixture); |
565 | let parsed = db.parse(file_id); | 565 | let parsed = db.parse(file_id); |
566 | let mut macro_rules: Vec<_> = | 566 | let mut macro_rules: Vec<_> = |
567 | parsed.syntax_node().descendants().filter_map(ast::MacroRules::cast).collect(); | 567 | parsed.syntax_node().descendants().filter_map(ast::MacroRules::cast).collect(); |
diff --git a/crates/hir_expand/src/input.rs b/crates/hir_expand/src/input.rs index 82dc7f326..bc3ecc593 100644 --- a/crates/hir_expand/src/input.rs +++ b/crates/hir_expand/src/input.rs | |||
@@ -78,7 +78,7 @@ mod tests { | |||
78 | use super::*; | 78 | use super::*; |
79 | 79 | ||
80 | fn test_remove_derives_up_to(attr: usize, ra_fixture: &str, expect: Expect) { | 80 | fn test_remove_derives_up_to(attr: usize, ra_fixture: &str, expect: Expect) { |
81 | let (db, file_id) = TestDB::with_single_file(&ra_fixture); | 81 | let (db, file_id) = TestDB::with_single_file(ra_fixture); |
82 | let parsed = db.parse(file_id); | 82 | let parsed = db.parse(file_id); |
83 | 83 | ||
84 | let mut items: Vec<_> = | 84 | let mut items: Vec<_> = |
diff --git a/crates/hir_expand/src/proc_macro.rs b/crates/hir_expand/src/proc_macro.rs index dbe1b446e..3ad2d3bf7 100644 --- a/crates/hir_expand/src/proc_macro.rs +++ b/crates/hir_expand/src/proc_macro.rs | |||
@@ -51,7 +51,7 @@ impl ProcMacroExpander { | |||
51 | // Proc macros have access to the environment variables of the invoking crate. | 51 | // Proc macros have access to the environment variables of the invoking crate. |
52 | let env = &krate_graph[calling_crate].env; | 52 | let env = &krate_graph[calling_crate].env; |
53 | 53 | ||
54 | proc_macro.expander.expand(&tt, attr_arg, &env).map_err(mbe::ExpandError::from) | 54 | proc_macro.expander.expand(tt, attr_arg, env).map_err(mbe::ExpandError::from) |
55 | } | 55 | } |
56 | None => Err(mbe::ExpandError::UnresolvedProcMacro), | 56 | None => Err(mbe::ExpandError::UnresolvedProcMacro), |
57 | } | 57 | } |