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:
Micha Reiser 2023-08-01 13:10:07 +02:00 committed by GitHub
parent 7c7231db2e
commit f45e8645d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 15156 additions and 15587 deletions

View file

@ -10,9 +10,7 @@ use std::fmt::Debug;
#[derive(Clone, Debug, PartialEq, is_macro::Is)]
pub enum Mod {
Module(ModModule),
Interactive(ModInteractive),
Expression(ModExpression),
FunctionType(ModFunctionType),
}
/// See also [Module](https://docs.python.org/3/library/ast.html#ast.Module)
@ -28,19 +26,6 @@ impl From<ModModule> for Mod {
}
}
/// See also [Interactive](https://docs.python.org/3/library/ast.html#ast.Interactive)
#[derive(Clone, Debug, PartialEq)]
pub struct ModInteractive {
pub range: TextRange,
pub body: Vec<Stmt>,
}
impl From<ModInteractive> for Mod {
fn from(payload: ModInteractive) -> Self {
Mod::Interactive(payload)
}
}
/// See also [Expression](https://docs.python.org/3/library/ast.html#ast.Expression)
#[derive(Clone, Debug, PartialEq)]
pub struct ModExpression {
@ -54,20 +39,6 @@ impl From<ModExpression> for Mod {
}
}
/// See also [FunctionType](https://docs.python.org/3/library/ast.html#ast.FunctionType)
#[derive(Clone, Debug, PartialEq)]
pub struct ModFunctionType {
pub range: TextRange,
pub argtypes: Vec<Expr>,
pub returns: Box<Expr>,
}
impl From<ModFunctionType> for Mod {
fn from(payload: ModFunctionType) -> Self {
Mod::FunctionType(payload)
}
}
/// See also [stmt](https://docs.python.org/3/library/ast.html#ast.stmt)
#[derive(Clone, Debug, PartialEq, is_macro::Is)]
pub enum Stmt {
@ -2474,28 +2445,16 @@ impl Ranged for crate::nodes::ModModule {
self.range
}
}
impl Ranged for crate::nodes::ModInteractive {
fn range(&self) -> TextRange {
self.range
}
}
impl Ranged for crate::nodes::ModExpression {
fn range(&self) -> TextRange {
self.range
}
}
impl Ranged for crate::nodes::ModFunctionType {
fn range(&self) -> TextRange {
self.range
}
}
impl Ranged for crate::Mod {
fn range(&self) -> TextRange {
match self {
Self::Module(node) => node.range(),
Self::Interactive(node) => node.range(),
Self::Expression(node) => node.range(),
Self::FunctionType(node) => node.range(),
}
}
}
@ -3017,5 +2976,5 @@ mod size_assertions {
assert_eq_size!(Expr, [u8; 80]);
assert_eq_size!(Constant, [u8; 32]);
assert_eq_size!(Pattern, [u8; 96]);
assert_eq_size!(Mod, [u8; 48]);
assert_eq_size!(Mod, [u8; 32]);
}