From 5db663d61fb8b006e3b84ef3bcc9cddbe94e5f49 Mon Sep 17 00:00:00 2001 From: Alan Du Date: Tue, 16 Oct 2018 11:45:10 -0400 Subject: Clippy lint: single-character string constant --- crates/ra_analysis/src/imp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index f1403cb5d..9b0d935af 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -388,7 +388,7 @@ impl AnalysisImpl { .text() .slice(range_search) .to_string() - .matches(",") + .matches(',') .count(); // If we have a method call eat the first param since it's just self. -- cgit v1.2.3 From 2268a2f8c6557301ecdcaeb4074331a0bd37dccd Mon Sep 17 00:00:00 2001 From: Alan Du Date: Wed, 17 Oct 2018 19:15:22 -0400 Subject: Silence clippy::derive_hash_xor_eq Manually implement PartialEq --- crates/ra_analysis/src/db.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/db.rs b/crates/ra_analysis/src/db.rs index 042dde1ac..99d40a269 100644 --- a/crates/ra_analysis/src/db.rs +++ b/crates/ra_analysis/src/db.rs @@ -76,12 +76,18 @@ salsa::query_group! { } } -#[derive(Default, Debug, PartialEq, Eq)] +#[derive(Default, Debug, Eq)] pub(crate) struct FileSet { pub(crate) files: FxHashSet, pub(crate) resolver: FileResolverImp, } +impl PartialEq for FileSet { + fn eq(&self, other: &FileSet) -> bool { + self.files == other.files && self.resolver == other.resolver + } +} + impl Hash for FileSet { fn hash(&self, hasher: &mut H) { let mut files = self.files.iter().cloned().collect::>(); -- cgit v1.2.3 From 2ae9dfa812ccf18867373f77a106161378a6d91d Mon Sep 17 00:00:00 2001 From: Alan Du Date: Tue, 16 Oct 2018 13:31:16 -0400 Subject: clippy: Fix new_ret_no_self --- crates/ra_analysis/src/descriptors.rs | 2 +- crates/ra_analysis/src/imp.rs | 2 +- crates/ra_analysis/src/job.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/descriptors.rs b/crates/ra_analysis/src/descriptors.rs index 6f26f9935..f64fcee16 100644 --- a/crates/ra_analysis/src/descriptors.rs +++ b/crates/ra_analysis/src/descriptors.rs @@ -233,7 +233,7 @@ pub struct FnDescriptor { } impl FnDescriptor { - pub fn new(node: ast::FnDef) -> Option { + pub fn new_opt(node: ast::FnDef) -> Option { let name = node.name()?.text().to_string(); // Strip the body out for the label. diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 9b0d935af..1c16852b8 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -362,7 +362,7 @@ impl AnalysisImpl { for (_, fs) in file_symbols { if fs.kind == FN_DEF { if let Some(fn_def) = find_node_at_offset(syntax, fs.node_range.start()) { - if let Some(descriptor) = FnDescriptor::new(fn_def) { + if let Some(descriptor) = FnDescriptor::new_opt(fn_def) { // If we have a calling expression let's find which argument we are on let mut current_parameter = None; diff --git a/crates/ra_analysis/src/job.rs b/crates/ra_analysis/src/job.rs index 2871f9839..57215c862 100644 --- a/crates/ra_analysis/src/job.rs +++ b/crates/ra_analysis/src/job.rs @@ -11,7 +11,7 @@ pub struct JobToken { } impl JobHandle { - pub fn new() -> (JobHandle, JobToken) { + pub fn new_pair() -> (JobHandle, JobToken) { let (sender_alive, receiver_alive) = bounded(0); let (sender_canceled, receiver_canceled) = bounded(0); let token = JobToken { -- cgit v1.2.3 From bc774fe6cf9948bd554e3fb5b51398b9328e0f4e Mon Sep 17 00:00:00 2001 From: Alan Du Date: Tue, 16 Oct 2018 13:39:46 -0400 Subject: clippy: needless_lifetimes --- crates/ra_analysis/src/descriptors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/descriptors.rs b/crates/ra_analysis/src/descriptors.rs index f64fcee16..98429326c 100644 --- a/crates/ra_analysis/src/descriptors.rs +++ b/crates/ra_analysis/src/descriptors.rs @@ -21,7 +21,7 @@ impl ModuleDescriptor { } } -fn modules<'a>(root: ast::Root<'a>) -> impl Iterator)> { +fn modules(root: ast::Root<'_>) -> impl Iterator)> { root.modules().filter_map(|module| { let name = module.name()?.text(); if !module.has_semi() { -- cgit v1.2.3 From a5da770ec60a73abcc5350f25146be973540063f Mon Sep 17 00:00:00 2001 From: Alan Du Date: Wed, 17 Oct 2018 19:25:37 -0400 Subject: Fix function calls --- crates/ra_analysis/src/descriptors.rs | 3 +-- crates/ra_analysis/src/imp.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/descriptors.rs b/crates/ra_analysis/src/descriptors.rs index 98429326c..dced99b07 100644 --- a/crates/ra_analysis/src/descriptors.rs +++ b/crates/ra_analysis/src/descriptors.rs @@ -183,8 +183,7 @@ impl Link { root: ast::Root<'a>, ) -> ast::Module<'a> { modules(root) - .filter(|(name, _)| name == &tree.link(self).name) - .next() + .find(|(name, _)| name == &tree.link(self).name) .unwrap() .1 } diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 1c16852b8..b4faf0b5b 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -393,7 +393,7 @@ impl AnalysisImpl { // If we have a method call eat the first param since it's just self. if has_self { - commas = commas + 1; + commas += 1; } current_parameter = Some(commas); -- cgit v1.2.3 From 0857c22f263ff18418f939b57a7a2ab3f8aac2c1 Mon Sep 17 00:00:00 2001 From: Alan Du Date: Sat, 20 Oct 2018 12:29:25 -0400 Subject: Revert "clippy: Fix new_ret_no_self" This reverts commit 2ae9dfa812ccf18867373f77a106161378a6d91d. --- crates/ra_analysis/src/descriptors.rs | 2 +- crates/ra_analysis/src/imp.rs | 2 +- crates/ra_analysis/src/job.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/descriptors.rs b/crates/ra_analysis/src/descriptors.rs index dced99b07..3fca3e581 100644 --- a/crates/ra_analysis/src/descriptors.rs +++ b/crates/ra_analysis/src/descriptors.rs @@ -232,7 +232,7 @@ pub struct FnDescriptor { } impl FnDescriptor { - pub fn new_opt(node: ast::FnDef) -> Option { + pub fn new(node: ast::FnDef) -> Option { let name = node.name()?.text().to_string(); // Strip the body out for the label. diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index b4faf0b5b..2ed6694ba 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -362,7 +362,7 @@ impl AnalysisImpl { for (_, fs) in file_symbols { if fs.kind == FN_DEF { if let Some(fn_def) = find_node_at_offset(syntax, fs.node_range.start()) { - if let Some(descriptor) = FnDescriptor::new_opt(fn_def) { + if let Some(descriptor) = FnDescriptor::new(fn_def) { // If we have a calling expression let's find which argument we are on let mut current_parameter = None; diff --git a/crates/ra_analysis/src/job.rs b/crates/ra_analysis/src/job.rs index 57215c862..2871f9839 100644 --- a/crates/ra_analysis/src/job.rs +++ b/crates/ra_analysis/src/job.rs @@ -11,7 +11,7 @@ pub struct JobToken { } impl JobHandle { - pub fn new_pair() -> (JobHandle, JobToken) { + pub fn new() -> (JobHandle, JobToken) { let (sender_alive, receiver_alive) = bounded(0); let (sender_canceled, receiver_canceled) = bounded(0); let token = JobToken { -- cgit v1.2.3