diff options
Diffstat (limited to 'crates/ra_hir_expand/src/builtin_macro.rs')
-rw-r--r-- | crates/ra_hir_expand/src/builtin_macro.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_hir_expand/src/builtin_macro.rs b/crates/ra_hir_expand/src/builtin_macro.rs index 3da137f2e..e0fef613d 100644 --- a/crates/ra_hir_expand/src/builtin_macro.rs +++ b/crates/ra_hir_expand/src/builtin_macro.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | use crate::db::AstDatabase; | 2 | use crate::db::AstDatabase; |
3 | use crate::{ | 3 | use crate::{ |
4 | ast::{self, AstToken, HasStringValue}, | 4 | ast::{self, AstToken, HasStringValue}, |
5 | name, AstId, CrateId, MacroDefId, MacroDefKind, TextUnit, | 5 | name, AstId, CrateId, MacroDefId, MacroDefKind, TextSize, |
6 | }; | 6 | }; |
7 | 7 | ||
8 | use crate::{quote, EagerMacroId, LazyMacroId, MacroCallId}; | 8 | use crate::{quote, EagerMacroId, LazyMacroId, MacroCallId}; |
@@ -127,7 +127,7 @@ fn stringify_expand( | |||
127 | let arg = loc.kind.arg(db).ok_or_else(|| mbe::ExpandError::UnexpectedToken)?; | 127 | let arg = loc.kind.arg(db).ok_or_else(|| mbe::ExpandError::UnexpectedToken)?; |
128 | let macro_args = arg; | 128 | let macro_args = arg; |
129 | let text = macro_args.text(); | 129 | let text = macro_args.text(); |
130 | let without_parens = TextUnit::of_char('(')..text.len() - TextUnit::of_char(')'); | 130 | let without_parens = TextSize::of('(')..text.len() - TextSize::of(')'); |
131 | text.slice(without_parens).to_string() | 131 | text.slice(without_parens).to_string() |
132 | }; | 132 | }; |
133 | 133 | ||
@@ -358,7 +358,7 @@ fn env_expand( | |||
358 | // However, we cannot use an empty string here, because for | 358 | // However, we cannot use an empty string here, because for |
359 | // `include!(concat!(env!("OUT_DIR"), "/foo.rs"))` will become | 359 | // `include!(concat!(env!("OUT_DIR"), "/foo.rs"))` will become |
360 | // `include!("foo.rs"), which might go to infinite loop | 360 | // `include!("foo.rs"), which might go to infinite loop |
361 | let s = get_env_inner(db, arg_id, &key).unwrap_or("__RA_UNIMPLEMENTATED__".to_string()); | 361 | let s = get_env_inner(db, arg_id, &key).unwrap_or_else(|| "__RA_UNIMPLEMENTATED__".to_string()); |
362 | let expanded = quote! { #s }; | 362 | let expanded = quote! { #s }; |
363 | 363 | ||
364 | Ok((expanded, FragmentKind::Expr)) | 364 | Ok((expanded, FragmentKind::Expr)) |