aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/doc_links.rs2
-rw-r--r--crates/ide/src/goto_definition.rs2
-rw-r--r--crates/ide/src/lib.rs2
-rw-r--r--crates/ide/src/references/rename.rs6
-rw-r--r--crates/ide/src/view_hir.rs2
5 files changed, 8 insertions, 6 deletions
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs
index f94adec9b..7bdd3cca3 100644
--- a/crates/ide/src/doc_links.rs
+++ b/crates/ide/src/doc_links.rs
@@ -232,7 +232,7 @@ fn rewrite_intra_doc_link(
232 let items = t.items(db); 232 let items = t.items(db);
233 if let Some(field_or_assoc_item) = items.iter().find_map(|assoc_item| { 233 if let Some(field_or_assoc_item) = items.iter().find_map(|assoc_item| {
234 if let Some(name) = assoc_item.name(db) { 234 if let Some(name) = assoc_item.name(db) {
235 if link.to_string() == format!("{}::{}", canonical_path, name) { 235 if *link == format!("{}::{}", canonical_path, name) {
236 return Some(FieldOrAssocItem::AssocItem(*assoc_item)); 236 return Some(FieldOrAssocItem::AssocItem(*assoc_item));
237 } 237 }
238 } 238 }
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs
index e86ae2a18..abed1969e 100644
--- a/crates/ide/src/goto_definition.rs
+++ b/crates/ide/src/goto_definition.rs
@@ -31,7 +31,7 @@ pub(crate) fn goto_definition(
31 let original_token = pick_best(file.token_at_offset(position.offset))?; 31 let original_token = pick_best(file.token_at_offset(position.offset))?;
32 let token = sema.descend_into_macros(original_token.clone()); 32 let token = sema.descend_into_macros(original_token.clone());
33 let parent = token.parent(); 33 let parent = token.parent();
34 if let Some(comment) = ast::Comment::cast(token.clone()) { 34 if let Some(comment) = ast::Comment::cast(token) {
35 let nav = def_for_doc_comment(&sema, position, &comment)?.try_to_nav(db)?; 35 let nav = def_for_doc_comment(&sema, position, &comment)?.try_to_nav(db)?;
36 return Some(RangeInfo::new(original_token.text_range(), vec![nav])); 36 return Some(RangeInfo::new(original_token.text_range(), vec![nav]));
37 } 37 }
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs
index 89e7bef7d..a2c8db505 100644
--- a/crates/ide/src/lib.rs
+++ b/crates/ide/src/lib.rs
@@ -95,7 +95,7 @@ pub use ide_db::{
95 }, 95 },
96 call_info::CallInfo, 96 call_info::CallInfo,
97 label::Label, 97 label::Label,
98 line_index::{LineCol, LineIndex}, 98 line_index::{LineCol, LineColUtf16, LineIndex},
99 search::{ReferenceAccess, SearchScope}, 99 search::{ReferenceAccess, SearchScope},
100 source_change::{FileSystemEdit, SourceChange}, 100 source_change::{FileSystemEdit, SourceChange},
101 symbol_index::Query, 101 symbol_index::Query,
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs
index 08f16b54d..a4b320227 100644
--- a/crates/ide/src/references/rename.rs
+++ b/crates/ide/src/references/rename.rs
@@ -342,8 +342,10 @@ fn rename_to_self(sema: &Semantics<RootDatabase>, local: hir::Local) -> RenameRe
342 342
343 // FIXME: reimplement this on the hir instead 343 // FIXME: reimplement this on the hir instead
344 // as of the time of this writing params in hir don't keep their names 344 // as of the time of this writing params in hir don't keep their names
345 let fn_ast = 345 let fn_ast = fn_def
346 fn_def.source(sema.db).ok_or(format_err!("Cannot rename non-param local to self"))?.value; 346 .source(sema.db)
347 .ok_or_else(|| format_err!("Cannot rename non-param local to self"))?
348 .value;
347 349
348 let first_param_range = fn_ast 350 let first_param_range = fn_ast
349 .param_list() 351 .param_list()
diff --git a/crates/ide/src/view_hir.rs b/crates/ide/src/view_hir.rs
index cfcfb7cfb..f8f3fae3d 100644
--- a/crates/ide/src/view_hir.rs
+++ b/crates/ide/src/view_hir.rs
@@ -11,7 +11,7 @@ use syntax::{algo::find_node_at_offset, ast, AstNode};
11// | VS Code | **Rust Analyzer: View Hir** 11// | VS Code | **Rust Analyzer: View Hir**
12// |=== 12// |===
13pub(crate) fn view_hir(db: &RootDatabase, position: FilePosition) -> String { 13pub(crate) fn view_hir(db: &RootDatabase, position: FilePosition) -> String {
14 body_hir(db, position).unwrap_or("Not inside a function body".to_string()) 14 body_hir(db, position).unwrap_or_else(|| "Not inside a function body".to_string())
15} 15}
16 16
17fn body_hir(db: &RootDatabase, position: FilePosition) -> Option<String> { 17fn body_hir(db: &RootDatabase, position: FilePosition) -> Option<String> {