aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/references.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-01-13 17:06:19 +0000
committerGitHub <[email protected]>2020-01-13 17:06:19 +0000
commit7ea7de338f1c8ad1e89600e04570f03c2688c0c0 (patch)
treeebd05b4c0f0d91eda62d2767780646f95835270b /crates/ra_ide/src/references.rs
parent27abd4a1a57bba47c717cb55e4719d69f2c5eb5c (diff)
parentc5c5f4260b4ab1a03d2d3f7a616202369adc9ade (diff)
Merge #2825
2825: Some clippy lints r=matklad a=kjeremy Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/references.rs')
-rw-r--r--crates/ra_ide/src/references.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs
index 4e52e0e7b..2c753dade 100644
--- a/crates/ra_ide/src/references.rs
+++ b/crates/ra_ide/src/references.rs
@@ -166,7 +166,7 @@ pub(crate) fn find_all_refs(
166 Some(RangeInfo::new(range, ReferenceSearchResult { declaration, references })) 166 Some(RangeInfo::new(range, ReferenceSearchResult { declaration, references }))
167} 167}
168 168
169fn find_name<'a>( 169fn find_name(
170 db: &RootDatabase, 170 db: &RootDatabase,
171 syntax: &SyntaxNode, 171 syntax: &SyntaxNode,
172 position: FilePosition, 172 position: FilePosition,
@@ -253,13 +253,10 @@ fn decl_access(
253 let stmt = find_node_at_offset::<ast::LetStmt>(syntax, range.start())?; 253 let stmt = find_node_at_offset::<ast::LetStmt>(syntax, range.start())?;
254 if let Some(_) = stmt.initializer() { 254 if let Some(_) = stmt.initializer() {
255 let pat = stmt.pat()?; 255 let pat = stmt.pat()?;
256 match pat { 256 if let ast::Pat::BindPat(it) = pat {
257 ast::Pat::BindPat(it) => { 257 if it.name()?.text().as_str() == name {
258 if it.name()?.text().as_str() == name { 258 return Some(ReferenceAccess::Write);
259 return Some(ReferenceAccess::Write);
260 }
261 } 259 }
262 _ => {}
263 } 260 }
264 } 261 }
265 262
@@ -286,7 +283,7 @@ fn reference_access(kind: &NameKind, name_ref: &ast::NameRef) -> Option<Referenc
286 } 283 }
287 } 284 }
288 } 285 }
289 return Some(ReferenceAccess::Read); 286 Some(ReferenceAccess::Read)
290 }, 287 },
291 _ => {None} 288 _ => {None}
292 } 289 }