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_derive.rs | 2 +- crates/ra_hir_expand/src/builtin_macro.rs | 4 ++-- crates/ra_hir_expand/src/quote.rs | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'crates/ra_hir_expand') diff --git a/crates/ra_hir_expand/src/builtin_derive.rs b/crates/ra_hir_expand/src/builtin_derive.rs index 62c60e336..d0e3eaf7e 100644 --- a/crates/ra_hir_expand/src/builtin_derive.rs +++ b/crates/ra_hir_expand/src/builtin_derive.rs @@ -235,7 +235,7 @@ mod tests { let (db, file_id) = TestDB::with_single_file(&s); let parsed = db.parse(file_id); let items: Vec<_> = - parsed.syntax_node().descendants().filter_map(|it| ast::ModuleItem::cast(it)).collect(); + parsed.syntax_node().descendants().filter_map(ast::ModuleItem::cast).collect(); let ast_id_map = db.ast_id_map(file_id.into()); 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()); diff --git a/crates/ra_hir_expand/src/quote.rs b/crates/ra_hir_expand/src/quote.rs index 4de219ce4..b54e00b68 100644 --- a/crates/ra_hir_expand/src/quote.rs +++ b/crates/ra_hir_expand/src/quote.rs @@ -259,8 +259,7 @@ mod tests { // } let struct_name = mk_ident("Foo"); let fields = [mk_ident("name"), mk_ident("id")]; - let fields = - fields.iter().map(|it| quote!(#it: self.#it.clone(), ).token_trees.clone()).flatten(); + let fields = fields.iter().map(|it| quote!(#it: self.#it.clone(), ).token_trees).flatten(); let list = tt::Subtree { delimiter: Some(tt::Delimiter { -- 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 ++++------- crates/ra_hir_expand/src/quote.rs | 5 ++--- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'crates/ra_hir_expand') 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 }}); } - _ => {} }; } 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 { ( @SUBTREE $delim:ident $($tt:tt)* ) => { { let children = $crate::__quote!($($tt)*); - let subtree = tt::Subtree { + tt::Subtree { delimiter: Some(tt::Delimiter { kind: tt::DelimiterKind::$delim, id: tt::TokenId::unspecified(), }), token_trees: $crate::quote::IntoTt::to_tokens(children), - }; - subtree + } } }; -- cgit v1.2.3 From f6816c253b96e8436f1156d6bd6b0942ee9fb4d3 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 18 Feb 2020 15:57:41 +0200 Subject: Update versions --- crates/ra_hir_expand/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_expand') diff --git a/crates/ra_hir_expand/Cargo.toml b/crates/ra_hir_expand/Cargo.toml index 3ae4376dc..d6e3c1f76 100644 --- a/crates/ra_hir_expand/Cargo.toml +++ b/crates/ra_hir_expand/Cargo.toml @@ -8,8 +8,8 @@ authors = ["rust-analyzer developers"] doctest = false [dependencies] -log = "0.4.5" -either = "1.5" +log = "0.4.8" +either = "1.5.3" ra_arena = { path = "../ra_arena" } ra_db = { path = "../ra_db" } -- cgit v1.2.3