diff options
author | Kirill Bulatov <[email protected]> | 2020-02-18 13:32:19 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-02-18 14:12:37 +0000 |
commit | eceaf94f1936436e33ae235ca65bf2a6d4f77da5 (patch) | |
tree | 83d42e6f014f80b84f9193e6b5c7c1e2aded9fa7 /crates/ra_hir_expand/src | |
parent | b8ddcb0652f3ec8683023afc1e1f5166d6a712f4 (diff) |
More manual clippy fixes
Diffstat (limited to 'crates/ra_hir_expand/src')
-rw-r--r-- | crates/ra_hir_expand/src/builtin_macro.rs | 11 | ||||
-rw-r--r-- | crates/ra_hir_expand/src/quote.rs | 5 |
2 files changed, 6 insertions, 10 deletions
diff --git a/crates/ra_hir_expand/src/builtin_macro.rs b/crates/ra_hir_expand/src/builtin_macro.rs index 4adaa9b07..f2bb0bddb 100644 --- a/crates/ra_hir_expand/src/builtin_macro.rs +++ b/crates/ra_hir_expand/src/builtin_macro.rs | |||
@@ -155,14 +155,11 @@ fn compile_error_expand( | |||
155 | tt: &tt::Subtree, | 155 | tt: &tt::Subtree, |
156 | ) -> Result<tt::Subtree, mbe::ExpandError> { | 156 | ) -> Result<tt::Subtree, mbe::ExpandError> { |
157 | if tt.count() == 1 { | 157 | if tt.count() == 1 { |
158 | match &tt.token_trees[0] { | 158 | if let tt::TokenTree::Leaf(tt::Leaf::Literal(it)) = &tt.token_trees[0] { |
159 | tt::TokenTree::Leaf(tt::Leaf::Literal(it)) => { | 159 | let s = it.text.as_str(); |
160 | let s = it.text.as_str(); | 160 | if s.contains('"') { |
161 | if s.contains('"') { | 161 | return Ok(quote! { loop { #it }}); |
162 | return Ok(quote! { loop { #it }}); | ||
163 | } | ||
164 | } | 162 | } |
165 | _ => {} | ||
166 | }; | 163 | }; |
167 | } | 164 | } |
168 | 165 | ||
diff --git a/crates/ra_hir_expand/src/quote.rs b/crates/ra_hir_expand/src/quote.rs index b54e00b68..57e7eebf9 100644 --- a/crates/ra_hir_expand/src/quote.rs +++ b/crates/ra_hir_expand/src/quote.rs | |||
@@ -15,14 +15,13 @@ macro_rules! __quote { | |||
15 | ( @SUBTREE $delim:ident $($tt:tt)* ) => { | 15 | ( @SUBTREE $delim:ident $($tt:tt)* ) => { |
16 | { | 16 | { |
17 | let children = $crate::__quote!($($tt)*); | 17 | let children = $crate::__quote!($($tt)*); |
18 | let subtree = tt::Subtree { | 18 | tt::Subtree { |
19 | delimiter: Some(tt::Delimiter { | 19 | delimiter: Some(tt::Delimiter { |
20 | kind: tt::DelimiterKind::$delim, | 20 | kind: tt::DelimiterKind::$delim, |
21 | id: tt::TokenId::unspecified(), | 21 | id: tt::TokenId::unspecified(), |
22 | }), | 22 | }), |
23 | token_trees: $crate::quote::IntoTt::to_tokens(children), | 23 | token_trees: $crate::quote::IntoTt::to_tokens(children), |
24 | }; | 24 | } |
25 | subtree | ||
26 | } | 25 | } |
27 | }; | 26 | }; |
28 | 27 | ||