From b8ddcb0652f3ec8683023afc1e1f5166d6a712f4 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 18 Feb 2020 14:53:02 +0200 Subject: Run cargo +nightly fix --clippy -Z unstable-options --- crates/ra_hir_expand/src/builtin_macro.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_expand/src/builtin_macro.rs') diff --git a/crates/ra_hir_expand/src/builtin_macro.rs b/crates/ra_hir_expand/src/builtin_macro.rs index f3f959ac6..4adaa9b07 100644 --- a/crates/ra_hir_expand/src/builtin_macro.rs +++ b/crates/ra_hir_expand/src/builtin_macro.rs @@ -158,7 +158,7 @@ fn compile_error_expand( match &tt.token_trees[0] { tt::TokenTree::Leaf(tt::Leaf::Literal(it)) => { let s = it.text.as_str(); - if s.contains(r#"""#) { + if s.contains('"') { return Ok(quote! { loop { #it }}); } } @@ -222,7 +222,7 @@ mod tests { let (db, file_id) = TestDB::with_single_file(&s); let parsed = db.parse(file_id); let macro_calls: Vec<_> = - parsed.syntax_node().descendants().filter_map(|it| ast::MacroCall::cast(it)).collect(); + parsed.syntax_node().descendants().filter_map(ast::MacroCall::cast).collect(); let ast_id_map = db.ast_id_map(file_id.into()); -- cgit v1.2.3 From eceaf94f1936436e33ae235ca65bf2a6d4f77da5 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 18 Feb 2020 15:32:19 +0200 Subject: More manual clippy fixes --- crates/ra_hir_expand/src/builtin_macro.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'crates/ra_hir_expand/src/builtin_macro.rs') 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( tt: &tt::Subtree, ) -> Result { if tt.count() == 1 { - match &tt.token_trees[0] { - tt::TokenTree::Leaf(tt::Leaf::Literal(it)) => { - let s = it.text.as_str(); - if s.contains('"') { - return Ok(quote! { loop { #it }}); - } + if let tt::TokenTree::Leaf(tt::Leaf::Literal(it)) = &tt.token_trees[0] { + let s = it.text.as_str(); + if s.contains('"') { + return Ok(quote! { loop { #it }}); } - _ => {} }; } -- cgit v1.2.3