mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-03 07:04:53 +00:00
Remove Parse
trait (#6235)
This commit is contained in:
parent
83fe103d6e
commit
debfca3a11
25 changed files with 235 additions and 1420 deletions
|
@ -1,5 +1,4 @@
|
|||
use ruff_python_ast::Stmt;
|
||||
use ruff_python_parser::{Parse, ParseError};
|
||||
use ruff_python_parser::{parse_suite, ParseError};
|
||||
use ruff_text_size::{TextRange, TextSize};
|
||||
|
||||
use ruff_python_ast::identifier;
|
||||
|
@ -13,8 +12,9 @@ else:
|
|||
pass
|
||||
"#
|
||||
.trim();
|
||||
let stmt = Stmt::parse(contents, "<filename>")?;
|
||||
let range = identifier::else_(&stmt, contents).unwrap();
|
||||
let stmts = parse_suite(contents, "<filename>")?;
|
||||
let stmt = stmts.first().unwrap();
|
||||
let range = identifier::else_(stmt, contents).unwrap();
|
||||
assert_eq!(&contents[range], "else");
|
||||
assert_eq!(
|
||||
range,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue