mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:38:25 +00:00
Remove unused lexical error types (#11145)
This commit is contained in:
parent
f428bd5052
commit
4738e19974
1 changed files with 0 additions and 46 deletions
|
@ -1398,9 +1398,6 @@ impl std::fmt::Display for LexicalError {
|
||||||
/// Represents the different types of errors that can occur during lexing.
|
/// Represents the different types of errors that can occur during lexing.
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum LexicalErrorType {
|
pub enum LexicalErrorType {
|
||||||
/// A duplicate argument was found in a function definition.
|
|
||||||
DuplicateArgumentError(Box<str>),
|
|
||||||
|
|
||||||
// TODO: Can probably be removed, the places it is used seem to be able
|
// TODO: Can probably be removed, the places it is used seem to be able
|
||||||
// to use the `UnicodeError` variant instead.
|
// to use the `UnicodeError` variant instead.
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -1413,23 +1410,8 @@ pub enum LexicalErrorType {
|
||||||
MissingUnicodeLbrace,
|
MissingUnicodeLbrace,
|
||||||
/// Missing the `}` for unicode escape sequence.
|
/// Missing the `}` for unicode escape sequence.
|
||||||
MissingUnicodeRbrace,
|
MissingUnicodeRbrace,
|
||||||
/// The nesting of brackets/braces/parentheses is not balanced.
|
|
||||||
NestingError,
|
|
||||||
/// The indentation is not consistent.
|
/// The indentation is not consistent.
|
||||||
IndentationError,
|
IndentationError,
|
||||||
/// Inconsistent use of tabs and spaces.
|
|
||||||
TabError,
|
|
||||||
/// Encountered a tab after a space.
|
|
||||||
TabsAfterSpaces,
|
|
||||||
/// A non-default argument follows a default argument.
|
|
||||||
DefaultArgumentError,
|
|
||||||
|
|
||||||
/// A positional argument follows a keyword argument.
|
|
||||||
PositionalArgumentError,
|
|
||||||
/// An iterable argument unpacking `*args` follows keyword argument unpacking `**kwargs`.
|
|
||||||
UnpackedArgumentError,
|
|
||||||
/// A keyword argument was repeated.
|
|
||||||
DuplicateKeywordArgumentError(Box<str>),
|
|
||||||
/// An unrecognized token was encountered.
|
/// An unrecognized token was encountered.
|
||||||
UnrecognizedToken { tok: char },
|
UnrecognizedToken { tok: char },
|
||||||
/// An f-string error containing the [`FStringErrorType`].
|
/// An f-string error containing the [`FStringErrorType`].
|
||||||
|
@ -1440,8 +1422,6 @@ pub enum LexicalErrorType {
|
||||||
LineContinuationError,
|
LineContinuationError,
|
||||||
/// An unexpected end of file was encountered.
|
/// An unexpected end of file was encountered.
|
||||||
Eof,
|
Eof,
|
||||||
/// Occurs when a syntactically invalid assignment was encountered.
|
|
||||||
AssignmentError,
|
|
||||||
/// An unexpected error occurred.
|
/// An unexpected error occurred.
|
||||||
OtherError(Box<str>),
|
OtherError(Box<str>),
|
||||||
}
|
}
|
||||||
|
@ -1457,34 +1437,9 @@ impl std::fmt::Display for LexicalErrorType {
|
||||||
write!(f, "bytes can only contain ASCII literal characters")
|
write!(f, "bytes can only contain ASCII literal characters")
|
||||||
}
|
}
|
||||||
LexicalErrorType::UnicodeError => write!(f, "Got unexpected unicode"),
|
LexicalErrorType::UnicodeError => write!(f, "Got unexpected unicode"),
|
||||||
LexicalErrorType::NestingError => write!(f, "Got unexpected nesting"),
|
|
||||||
LexicalErrorType::IndentationError => {
|
LexicalErrorType::IndentationError => {
|
||||||
write!(f, "unindent does not match any outer indentation level")
|
write!(f, "unindent does not match any outer indentation level")
|
||||||
}
|
}
|
||||||
LexicalErrorType::TabError => {
|
|
||||||
write!(f, "inconsistent use of tabs and spaces in indentation")
|
|
||||||
}
|
|
||||||
LexicalErrorType::TabsAfterSpaces => {
|
|
||||||
write!(f, "Tabs not allowed as part of indentation after spaces")
|
|
||||||
}
|
|
||||||
LexicalErrorType::DefaultArgumentError => {
|
|
||||||
write!(f, "non-default argument follows default argument")
|
|
||||||
}
|
|
||||||
LexicalErrorType::DuplicateArgumentError(arg_name) => {
|
|
||||||
write!(f, "duplicate argument '{arg_name}' in function definition")
|
|
||||||
}
|
|
||||||
LexicalErrorType::DuplicateKeywordArgumentError(arg_name) => {
|
|
||||||
write!(f, "keyword argument repeated: {arg_name}")
|
|
||||||
}
|
|
||||||
LexicalErrorType::PositionalArgumentError => {
|
|
||||||
write!(f, "positional argument follows keyword argument")
|
|
||||||
}
|
|
||||||
LexicalErrorType::UnpackedArgumentError => {
|
|
||||||
write!(
|
|
||||||
f,
|
|
||||||
"iterable argument unpacking follows keyword argument unpacking"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
LexicalErrorType::UnrecognizedToken { tok } => {
|
LexicalErrorType::UnrecognizedToken { tok } => {
|
||||||
write!(f, "Got unexpected token {tok}")
|
write!(f, "Got unexpected token {tok}")
|
||||||
}
|
}
|
||||||
|
@ -1492,7 +1447,6 @@ impl std::fmt::Display for LexicalErrorType {
|
||||||
write!(f, "unexpected character after line continuation character")
|
write!(f, "unexpected character after line continuation character")
|
||||||
}
|
}
|
||||||
LexicalErrorType::Eof => write!(f, "unexpected EOF while parsing"),
|
LexicalErrorType::Eof => write!(f, "unexpected EOF while parsing"),
|
||||||
LexicalErrorType::AssignmentError => write!(f, "invalid assignment target"),
|
|
||||||
LexicalErrorType::OtherError(msg) => write!(f, "{msg}"),
|
LexicalErrorType::OtherError(msg) => write!(f, "{msg}"),
|
||||||
LexicalErrorType::UnclosedStringError => {
|
LexicalErrorType::UnclosedStringError => {
|
||||||
write!(f, "missing closing quote in string literal")
|
write!(f, "missing closing quote in string literal")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue