aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-10-22 22:14:38 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-10-22 22:14:38 +0100
commit27694abd9473c53cee4549dfe5ef5d28d0c01bed (patch)
tree6f51587dc28fc8fe28c0971a810541421ea2d829 /crates/ra_analysis
parent5a64b9a811554473e65db7e7ae515079ca48c70b (diff)
parentdc9ce8ff7494f641c7102785cdef95489f2fc3d6 (diff)
Merge #138
138: Fix some clippy lints r=matklad a=alanhdu I went ahead and fixed all the clippy lints (there were a couple I thought would be better unfixed and added `cfg` statements to allow them) and also re-enabled clippy and rustfmt in CI. They were disabled with `no time to explain, disable clippy checks`, so hopefully this won't go against whatever the reason at the time was :laughing:. One question about the CI though: right now, it's an allowed failure that runs against the latest nightly each time. Would it be better to pin it to a specific nightly (or use the `beta` versions) to lower the churn? Co-authored-by: Alan Du <[email protected]>
Diffstat (limited to 'crates/ra_analysis')
-rw-r--r--crates/ra_analysis/src/db.rs8
-rw-r--r--crates/ra_analysis/src/descriptors.rs5
-rw-r--r--crates/ra_analysis/src/imp.rs4
3 files changed, 11 insertions, 6 deletions
diff --git a/crates/ra_analysis/src/db.rs b/crates/ra_analysis/src/db.rs
index 09d74b9e7..956cbe162 100644
--- a/crates/ra_analysis/src/db.rs
+++ b/crates/ra_analysis/src/db.rs
@@ -87,12 +87,18 @@ salsa::query_group! {
87 } 87 }
88} 88}
89 89
90#[derive(Default, Debug, PartialEq, Eq)] 90#[derive(Default, Debug, Eq)]
91pub(crate) struct FileSet { 91pub(crate) struct FileSet {
92 pub(crate) files: FxHashSet<FileId>, 92 pub(crate) files: FxHashSet<FileId>,
93 pub(crate) resolver: FileResolverImp, 93 pub(crate) resolver: FileResolverImp,
94} 94}
95 95
96impl PartialEq for FileSet {
97 fn eq(&self, other: &FileSet) -> bool {
98 self.files == other.files && self.resolver == other.resolver
99 }
100}
101
96impl Hash for FileSet { 102impl Hash for FileSet {
97 fn hash<H: Hasher>(&self, hasher: &mut H) { 103 fn hash<H: Hasher>(&self, hasher: &mut H) {
98 let mut files = self.files.iter().cloned().collect::<Vec<_>>(); 104 let mut files = self.files.iter().cloned().collect::<Vec<_>>();
diff --git a/crates/ra_analysis/src/descriptors.rs b/crates/ra_analysis/src/descriptors.rs
index 310bf1585..92da26493 100644
--- a/crates/ra_analysis/src/descriptors.rs
+++ b/crates/ra_analysis/src/descriptors.rs
@@ -22,7 +22,7 @@ impl ModuleDescriptor {
22 } 22 }
23} 23}
24 24
25fn modules<'a>(root: ast::Root<'a>) -> impl Iterator<Item = (SmolStr, ast::Module<'a>)> { 25fn modules(root: ast::Root<'_>) -> impl Iterator<Item = (SmolStr, ast::Module<'_>)> {
26 root.modules().filter_map(|module| { 26 root.modules().filter_map(|module| {
27 let name = module.name()?.text(); 27 let name = module.name()?.text();
28 if !module.has_semi() { 28 if !module.has_semi() {
@@ -184,8 +184,7 @@ impl Link {
184 root: ast::Root<'a>, 184 root: ast::Root<'a>,
185 ) -> ast::Module<'a> { 185 ) -> ast::Module<'a> {
186 modules(root) 186 modules(root)
187 .filter(|(name, _)| name == &tree.link(self).name) 187 .find(|(name, _)| name == &tree.link(self).name)
188 .next()
189 .unwrap() 188 .unwrap()
190 .1 189 .1
191 } 190 }
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs
index 32e9bb6d7..196627539 100644
--- a/crates/ra_analysis/src/imp.rs
+++ b/crates/ra_analysis/src/imp.rs
@@ -426,12 +426,12 @@ impl AnalysisImpl {
426 .text() 426 .text()
427 .slice(range_search) 427 .slice(range_search)
428 .to_string() 428 .to_string()
429 .matches(",") 429 .matches(',')
430 .count(); 430 .count();
431 431
432 // If we have a method call eat the first param since it's just self. 432 // If we have a method call eat the first param since it's just self.
433 if has_self { 433 if has_self {
434 commas = commas + 1; 434 commas += 1;
435 } 435 }
436 436
437 current_parameter = Some(commas); 437 current_parameter = Some(commas);