Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Commit 0f2e295

Browse files
authored
impl Ranged for TextRange (#20)
This adds the missing implementation of `Ranged` for `TextRange` itself ```rust impl Ranged for TextRange { fn range(&self) -> TextRange { *self } } ``` This allows e.g. using `has_comments` with arbitrary ranges instead of just a node. It also adds .venv to the .gitignore
1 parent c174bbf commit 0f2e295

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ __pycache__
99
.*sw*
1010
.vscode
1111
.idea/
12+
.venv/
1213

1314
flame-graph.html
1415
flame.txt

ast/src/ranged.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ pub trait Ranged {
1414
}
1515
}
1616

17+
impl Ranged for TextRange {
18+
fn range(&self) -> TextRange {
19+
*self
20+
}
21+
}
22+
1723
impl<T> Ranged for &T
1824
where
1925
T: Ranged,

0 commit comments

Comments
 (0)