mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-22 20:45:11 +00:00
Delete type-ignore node
<!-- 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 type ignore node from the AST because our parser doesn't support it, and just having it around is confusing. <!-- What's the purpose of the change? What does it do, and why? --> ## Test Plan `cargo build` <!-- How was it tested? -->
This commit is contained in:
parent
c6986ac95d
commit
4ad5903ef6
12 changed files with 13 additions and 391 deletions
|
@ -2657,46 +2657,6 @@ impl<'ast> IntoFormat<PyFormatContext<'ast>> for ast::PatternMatchOr {
|
|||
}
|
||||
}
|
||||
|
||||
impl FormatRule<ast::TypeIgnoreTypeIgnore, PyFormatContext<'_>>
|
||||
for crate::other::type_ignore_type_ignore::FormatTypeIgnoreTypeIgnore
|
||||
{
|
||||
#[inline]
|
||||
fn fmt(
|
||||
&self,
|
||||
node: &ast::TypeIgnoreTypeIgnore,
|
||||
f: &mut Formatter<PyFormatContext<'_>>,
|
||||
) -> FormatResult<()> {
|
||||
FormatNodeRule::<ast::TypeIgnoreTypeIgnore>::fmt(self, node, f)
|
||||
}
|
||||
}
|
||||
impl<'ast> AsFormat<PyFormatContext<'ast>> for ast::TypeIgnoreTypeIgnore {
|
||||
type Format<'a> = FormatRefWithRule<
|
||||
'a,
|
||||
ast::TypeIgnoreTypeIgnore,
|
||||
crate::other::type_ignore_type_ignore::FormatTypeIgnoreTypeIgnore,
|
||||
PyFormatContext<'ast>,
|
||||
>;
|
||||
fn format(&self) -> Self::Format<'_> {
|
||||
FormatRefWithRule::new(
|
||||
self,
|
||||
crate::other::type_ignore_type_ignore::FormatTypeIgnoreTypeIgnore::default(),
|
||||
)
|
||||
}
|
||||
}
|
||||
impl<'ast> IntoFormat<PyFormatContext<'ast>> for ast::TypeIgnoreTypeIgnore {
|
||||
type Format = FormatOwnedWithRule<
|
||||
ast::TypeIgnoreTypeIgnore,
|
||||
crate::other::type_ignore_type_ignore::FormatTypeIgnoreTypeIgnore,
|
||||
PyFormatContext<'ast>,
|
||||
>;
|
||||
fn into_format(self) -> Self::Format {
|
||||
FormatOwnedWithRule::new(
|
||||
self,
|
||||
crate::other::type_ignore_type_ignore::FormatTypeIgnoreTypeIgnore::default(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl FormatRule<ast::Comprehension, PyFormatContext<'_>>
|
||||
for crate::other::comprehension::FormatComprehension
|
||||
{
|
||||
|
|
|
@ -9,13 +9,7 @@ pub struct FormatModModule;
|
|||
|
||||
impl FormatNodeRule<ModModule> for FormatModModule {
|
||||
fn fmt_fields(&self, item: &ModModule, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
let ModModule {
|
||||
range: _,
|
||||
body,
|
||||
type_ignores,
|
||||
} = item;
|
||||
// https://docs.python.org/3/library/ast.html#ast-helpers
|
||||
debug_assert!(type_ignores.is_empty());
|
||||
let ModModule { range: _, body } = item;
|
||||
write!(
|
||||
f,
|
||||
[
|
||||
|
|
|
@ -9,5 +9,4 @@ pub(crate) mod except_handler_except_handler;
|
|||
pub(crate) mod identifier;
|
||||
pub(crate) mod keyword;
|
||||
pub(crate) mod match_case;
|
||||
pub(crate) mod type_ignore_type_ignore;
|
||||
pub(crate) mod with_item;
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use ruff_python_ast::TypeIgnoreTypeIgnore;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatTypeIgnoreTypeIgnore;
|
||||
|
||||
impl FormatNodeRule<TypeIgnoreTypeIgnore> for FormatTypeIgnoreTypeIgnore {
|
||||
fn fmt_fields(&self, item: &TypeIgnoreTypeIgnore, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue