diff options
author | Edwin Cheng <[email protected]> | 2019-11-15 14:13:41 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-11-19 04:15:20 +0000 |
commit | f24bba74d02a14552693a8d4b11b74bb8ffa93db (patch) | |
tree | a6693415f28faeb320595284f7d9daf151912caf | |
parent | c24ee0990486b04723534f072d7a58e829bbd1bd (diff) |
Fixed a bug for string lit in quote
-rw-r--r-- | crates/ra_hir_expand/src/quote.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_hir_expand/src/quote.rs b/crates/ra_hir_expand/src/quote.rs index 35133d216..65a35e52f 100644 --- a/crates/ra_hir_expand/src/quote.rs +++ b/crates/ra_hir_expand/src/quote.rs | |||
@@ -172,12 +172,12 @@ impl_to_to_tokentrees! { | |||
172 | u32 => self { tt::Literal{text: self.to_string().into()} }; | 172 | u32 => self { tt::Literal{text: self.to_string().into()} }; |
173 | usize => self { tt::Literal{text: self.to_string().into()}}; | 173 | usize => self { tt::Literal{text: self.to_string().into()}}; |
174 | i32 => self { tt::Literal{text: self.to_string().into()}}; | 174 | i32 => self { tt::Literal{text: self.to_string().into()}}; |
175 | &str => self { tt::Literal{text: self.to_string().into()}}; | ||
176 | String => self { tt::Literal{text: self.into()}}; | ||
177 | tt::Leaf => self { self }; | 175 | tt::Leaf => self { self }; |
178 | tt::Literal => self { self }; | 176 | tt::Literal => self { self }; |
179 | tt::Ident => self { self }; | 177 | tt::Ident => self { self }; |
180 | tt::Punct => self { self } | 178 | tt::Punct => self { self }; |
179 | &str => self { tt::Literal{text: format!("{:?}", self.escape_default().to_string()).into()}}; | ||
180 | String => self { tt::Literal{text: format!("{:?}", self.escape_default().to_string()).into()}} | ||
181 | } | 181 | } |
182 | 182 | ||
183 | #[cfg(test)] | 183 | #[cfg(test)] |
@@ -200,7 +200,7 @@ mod tests { | |||
200 | let a = 20; | 200 | let a = 20; |
201 | assert_eq!(quote!(#a).to_string(), "20"); | 201 | assert_eq!(quote!(#a).to_string(), "20"); |
202 | let s: String = "hello".into(); | 202 | let s: String = "hello".into(); |
203 | assert_eq!(quote!(#s).to_string(), "hello"); | 203 | assert_eq!(quote!(#s).to_string(), "\"hello\""); |
204 | } | 204 | } |
205 | 205 | ||
206 | fn mk_ident(name: &str) -> tt::Ident { | 206 | fn mk_ident(name: &str) -> tt::Ident { |