Skip to content

Commit ba8b09a

Browse files
author
UnboundVariable
committed
Code review feedback.
1 parent c981944 commit ba8b09a

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

crates/ty_ide/src/lib.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,23 +131,29 @@ pub enum ReferenceKind {
131131
/// includes information about whether the reference is a read or write operation.
132132
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
133133
pub struct ReferenceTarget {
134-
file: File,
135-
range: TextRange,
134+
file_range: FileRange,
136135
kind: ReferenceKind,
137136
}
138137

139138
impl ReferenceTarget {
140139
/// Creates a new `ReferenceTarget`.
141140
pub fn new(file: File, range: TextRange, kind: ReferenceKind) -> Self {
142-
Self { file, range, kind }
141+
Self {
142+
file_range: FileRange::new(file, range),
143+
kind,
144+
}
143145
}
144146

145147
pub fn file(&self) -> File {
146-
self.file
148+
self.file_range.file()
147149
}
148150

149151
pub fn range(&self) -> TextRange {
150-
self.range
152+
self.file_range.range()
153+
}
154+
155+
pub fn file_range(&self) -> FileRange {
156+
self.file_range
151157
}
152158

153159
pub fn kind(&self) -> ReferenceKind {

crates/ty_server/src/document/location.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl ToLink for NavigationTarget {
5656

5757
impl ToLink for ReferenceTarget {
5858
fn to_location(&self, db: &dyn Db, encoding: PositionEncoding) -> Option<Location> {
59-
FileRange::new(self.file(), self.range()).to_location(db, encoding)
59+
self.file_range().to_location(db, encoding)
6060
}
6161

6262
fn to_link(

0 commit comments

Comments
 (0)