Skip to content

Commit c81560c

Browse files
committed
fix: Do not require all rename definitions to be renameable
1 parent 971c393 commit c81560c

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

crates/ide/src/rename.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,8 @@ pub(crate) fn prepare_rename(
3535
let syntax = source_file.syntax();
3636

3737
let res = find_definitions(&sema, syntax, position, &Name::new_symbol_root(sym::underscore))?
38-
.map(|(frange, kind, def, _, _)| {
39-
// ensure all ranges are valid
40-
41-
if def.range_for_rename(&sema).is_none() {
42-
bail!("No references found at position")
43-
}
44-
38+
.filter(|(_, _, def, _, _)| def.range_for_rename(&sema).is_some())
39+
.map(|(frange, kind, _, _, _)| {
4540
always!(
4641
frange.range.contains_inclusive(position.offset)
4742
&& frange.file_id == position.file_id

0 commit comments

Comments
 (0)