mirror of
https://github.com/astral-sh/ruff
synced 2026-01-09 07:34:06 -05:00
Implement Ranged on more structs (#6639)
## Summary I noticed some inconsistencies around uses of `.range.start()`, structs that have a `TextRange` field but don't implement `Ranged`, etc. ## Test Plan `cargo test`
This commit is contained in:
@@ -24,6 +24,12 @@ pub struct IfElifBranch<'a> {
|
||||
pub range: TextRange,
|
||||
}
|
||||
|
||||
impl Ranged for IfElifBranch<'_> {
|
||||
fn range(&self) -> TextRange {
|
||||
self.range
|
||||
}
|
||||
}
|
||||
|
||||
pub fn if_elif_branches(stmt_if: &StmtIf) -> impl Iterator<Item = IfElifBranch> {
|
||||
iter::once(IfElifBranch {
|
||||
kind: BranchKind::If,
|
||||
|
||||
Reference in New Issue
Block a user