mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-28 15:33:50 +00:00
Remove unused parser modes
<!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary This PR removes the `Interactive` and `FunctionType` parser modes that are unused by ruff <!-- What's the purpose of the change? What does it do, and why? --> ## Test Plan `cargo test` <!-- How was it tested? -->
This commit is contained in:
parent
7c7231db2e
commit
f45e8645d7
15 changed files with 15156 additions and 15587 deletions
|
@ -25,6 +25,7 @@ use crate::{
|
|||
Mode, Parse,
|
||||
};
|
||||
use ruff_python_ast as ast;
|
||||
use ruff_python_ast::ModModule;
|
||||
|
||||
/// Parse a full Python program usually consisting of multiple lines.
|
||||
///
|
||||
|
@ -48,10 +49,7 @@ use ruff_python_ast as ast;
|
|||
/// ```
|
||||
#[deprecated = "Use ruff_python_ast::Suite::parse from ruff_python_parser::Parse trait."]
|
||||
pub fn parse_program(source: &str, source_path: &str) -> Result<ast::Suite, ParseError> {
|
||||
parse(source, Mode::Module, source_path).map(|top| match top {
|
||||
ast::Mod::Module(ast::ModModule { body, .. }) => body,
|
||||
_ => unreachable!(),
|
||||
})
|
||||
ModModule::parse(source, source_path).map(|module| module.body)
|
||||
}
|
||||
|
||||
/// Parses a single Python expression.
|
||||
|
@ -718,7 +716,6 @@ except* OSError as e:
|
|||
|
||||
assert!(parse(source, Mode::Expression, "<embedded>").is_ok());
|
||||
assert!(parse(source, Mode::Module, "<embedded>").is_ok());
|
||||
assert!(parse(source, Mode::Interactive, "<embedded>").is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue