From f9b5e0d2191447e5c1e92056377893a21ab4bf17 Mon Sep 17 00:00:00 2001 From: Young-Flash Date: Sat, 20 Jan 2024 14:43:42 +0800 Subject: [PATCH] minor: use `reference.range` to get original range --- .../src/handlers/extract_struct_from_enum_variant.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs index dde2b497fb..81a639e0b9 100644 --- a/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs @@ -414,9 +414,8 @@ fn reference_to_node( reference.name.as_name_ref()?.syntax().parent().and_then(ast::PathSegment::cast)?; // filter out the reference in marco - let s_range = segment.syntax().text_range(); - let origin_range = sema.original_range(segment.syntax()).range; - if s_range != origin_range { + let segment_range = segment.syntax().text_range(); + if segment_range != reference.range { return None; }