mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 13:34:40 +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
|
@ -41,46 +41,6 @@ impl<'ast> IntoFormat<PyFormatContext<'ast>> for ast::ModModule {
|
|||
}
|
||||
}
|
||||
|
||||
impl FormatRule<ast::ModInteractive, PyFormatContext<'_>>
|
||||
for crate::module::mod_interactive::FormatModInteractive
|
||||
{
|
||||
#[inline]
|
||||
fn fmt(
|
||||
&self,
|
||||
node: &ast::ModInteractive,
|
||||
f: &mut Formatter<PyFormatContext<'_>>,
|
||||
) -> FormatResult<()> {
|
||||
FormatNodeRule::<ast::ModInteractive>::fmt(self, node, f)
|
||||
}
|
||||
}
|
||||
impl<'ast> AsFormat<PyFormatContext<'ast>> for ast::ModInteractive {
|
||||
type Format<'a> = FormatRefWithRule<
|
||||
'a,
|
||||
ast::ModInteractive,
|
||||
crate::module::mod_interactive::FormatModInteractive,
|
||||
PyFormatContext<'ast>,
|
||||
>;
|
||||
fn format(&self) -> Self::Format<'_> {
|
||||
FormatRefWithRule::new(
|
||||
self,
|
||||
crate::module::mod_interactive::FormatModInteractive::default(),
|
||||
)
|
||||
}
|
||||
}
|
||||
impl<'ast> IntoFormat<PyFormatContext<'ast>> for ast::ModInteractive {
|
||||
type Format = FormatOwnedWithRule<
|
||||
ast::ModInteractive,
|
||||
crate::module::mod_interactive::FormatModInteractive,
|
||||
PyFormatContext<'ast>,
|
||||
>;
|
||||
fn into_format(self) -> Self::Format {
|
||||
FormatOwnedWithRule::new(
|
||||
self,
|
||||
crate::module::mod_interactive::FormatModInteractive::default(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl FormatRule<ast::ModExpression, PyFormatContext<'_>>
|
||||
for crate::module::mod_expression::FormatModExpression
|
||||
{
|
||||
|
@ -121,46 +81,6 @@ impl<'ast> IntoFormat<PyFormatContext<'ast>> for ast::ModExpression {
|
|||
}
|
||||
}
|
||||
|
||||
impl FormatRule<ast::ModFunctionType, PyFormatContext<'_>>
|
||||
for crate::module::mod_function_type::FormatModFunctionType
|
||||
{
|
||||
#[inline]
|
||||
fn fmt(
|
||||
&self,
|
||||
node: &ast::ModFunctionType,
|
||||
f: &mut Formatter<PyFormatContext<'_>>,
|
||||
) -> FormatResult<()> {
|
||||
FormatNodeRule::<ast::ModFunctionType>::fmt(self, node, f)
|
||||
}
|
||||
}
|
||||
impl<'ast> AsFormat<PyFormatContext<'ast>> for ast::ModFunctionType {
|
||||
type Format<'a> = FormatRefWithRule<
|
||||
'a,
|
||||
ast::ModFunctionType,
|
||||
crate::module::mod_function_type::FormatModFunctionType,
|
||||
PyFormatContext<'ast>,
|
||||
>;
|
||||
fn format(&self) -> Self::Format<'_> {
|
||||
FormatRefWithRule::new(
|
||||
self,
|
||||
crate::module::mod_function_type::FormatModFunctionType::default(),
|
||||
)
|
||||
}
|
||||
}
|
||||
impl<'ast> IntoFormat<PyFormatContext<'ast>> for ast::ModFunctionType {
|
||||
type Format = FormatOwnedWithRule<
|
||||
ast::ModFunctionType,
|
||||
crate::module::mod_function_type::FormatModFunctionType,
|
||||
PyFormatContext<'ast>,
|
||||
>;
|
||||
fn into_format(self) -> Self::Format {
|
||||
FormatOwnedWithRule::new(
|
||||
self,
|
||||
crate::module::mod_function_type::FormatModFunctionType::default(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl FormatRule<ast::StmtFunctionDef, PyFormatContext<'_>>
|
||||
for crate::statement::stmt_function_def::FormatStmtFunctionDef
|
||||
{
|
||||
|
|
|
@ -4,8 +4,6 @@ use ruff_formatter::{Format, FormatOwnedWithRule, FormatRefWithRule, FormatResul
|
|||
use ruff_python_ast::Mod;
|
||||
|
||||
pub(crate) mod mod_expression;
|
||||
pub(crate) mod mod_function_type;
|
||||
pub(crate) mod mod_interactive;
|
||||
pub(crate) mod mod_module;
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -15,9 +13,7 @@ impl FormatRule<Mod, PyFormatContext<'_>> for FormatMod {
|
|||
fn fmt(&self, item: &Mod, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
match item {
|
||||
Mod::Module(x) => x.format().fmt(f),
|
||||
Mod::Interactive(x) => x.format().fmt(f),
|
||||
Mod::Expression(x) => x.format().fmt(f),
|
||||
Mod::FunctionType(x) => x.format().fmt(f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use ruff_python_ast::ModFunctionType;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatModFunctionType;
|
||||
|
||||
impl FormatNodeRule<ModFunctionType> for FormatModFunctionType {
|
||||
fn fmt_fields(&self, item: &ModFunctionType, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use ruff_python_ast::ModInteractive;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatModInteractive;
|
||||
|
||||
impl FormatNodeRule<ModInteractive> for FormatModInteractive {
|
||||
fn fmt_fields(&self, item: &ModInteractive, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue