mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
one down
This commit is contained in:
parent
95199ac30b
commit
2e0610e64e
1 changed files with 4 additions and 3 deletions
|
@ -36,9 +36,10 @@ pub(crate) fn prepare_rename(
|
|||
let mut defs = find_definitions(&sema, syntax, position)?;
|
||||
|
||||
// TODO:
|
||||
// - empty case possible or already caught by `find_definitions`?
|
||||
// - is "just take the first" correct? If not, what do?
|
||||
let (name_like, _def) = defs.next().unwrap();
|
||||
// - is "No references found at position" the right error? (why does it not get caught by `find_definitions`... hmm)
|
||||
// - is "just take the first `name_like`" correct? If not, what do?
|
||||
let (name_like, _def) =
|
||||
defs.next().ok_or_else(|| format_err!("No references found at position"))?;
|
||||
let frange = sema.original_range(name_like.syntax());
|
||||
always!(frange.range.contains_inclusive(position.offset) && frange.file_id == position.file_id);
|
||||
Ok(RangeInfo::new(frange.range, ()))
|
||||
|
|
Loading…
Reference in a new issue