File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -36,9 +36,10 @@ pub(crate) fn prepare_rename(
36
36
let mut defs = find_definitions ( & sema, syntax, position) ?;
37
37
38
38
// TODO:
39
- // - empty case possible or already caught by `find_definitions`?
40
- // - is "just take the first" correct? If not, what do?
41
- let ( name_like, _def) = defs. next ( ) . unwrap ( ) ;
39
+ // - is "No references found at position" the right error? (why does it not get caught by `find_definitions`... hmm)
40
+ // - is "just take the first `name_like`" correct? If not, what do?
41
+ let ( name_like, _def) =
42
+ defs. next ( ) . ok_or_else ( || format_err ! ( "No references found at position" ) ) ?;
42
43
let frange = sema. original_range ( name_like. syntax ( ) ) ;
43
44
always ! ( frange. range. contains_inclusive( position. offset) && frange. file_id == position. file_id) ;
44
45
Ok ( RangeInfo :: new ( frange. range , ( ) ) )
You can’t perform that action at this time.
0 commit comments