Misc. small tweaks from perusing modules (#9383)

This commit is contained in:
Charlie Marsh 2024-01-03 13:30:25 -04:00 committed by GitHub
parent 7b6baff734
commit 0e202718fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 5 deletions

View file

@ -1,7 +1,9 @@
use crate::{ElifElseClause, Expr, Stmt, StmtIf};
use std::iter;
use ruff_python_trivia::{SimpleTokenKind, SimpleTokenizer};
use ruff_text_size::{Ranged, TextRange};
use std::iter;
use crate::{ElifElseClause, Expr, Stmt, StmtIf};
/// Return the `Range` of the first `Elif` or `Else` token in an `If` statement.
pub fn elif_else_range(clause: &ElifElseClause, contents: &str) -> Option<TextRange> {
@ -17,11 +19,12 @@ pub enum BranchKind {
Elif,
}
#[derive(Debug)]
pub struct IfElifBranch<'a> {
pub kind: BranchKind,
pub test: &'a Expr,
pub body: &'a [Stmt],
pub range: TextRange,
range: TextRange,
}
impl Ranged for IfElifBranch<'_> {