mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-08 20:58:05 +00:00
Remove less used parser dependencies (#11718)
## Summary This PR removes the following dependencies from the `ruff_python_parser` crate: * `anyhow` (moved to dev dependencies) * `is-macro` * `itertools` The main motivation is that they aren't used much. Additionally, it updates the return type of `parse_type_annotation` to use a more specific `ParseError` instead of the generic `anyhow::Error`. ## Test Plan `cargo insta test`
This commit is contained in:
parent
f4e23d2dff
commit
a58bde6958
5 changed files with 20 additions and 20 deletions
|
@ -73,7 +73,6 @@ pub use crate::token::TokenKind;
|
|||
|
||||
use crate::parser::Parser;
|
||||
|
||||
use itertools::Itertools;
|
||||
use ruff_python_ast::{Expr, Mod, ModExpression, ModModule, PySourceType, Suite};
|
||||
use ruff_python_trivia::CommentRanges;
|
||||
use ruff_text_size::{Ranged, TextRange, TextSize};
|
||||
|
@ -388,9 +387,8 @@ impl Tokens {
|
|||
let end = *self.first_unknown_or_len.get_or_init(|| {
|
||||
self.raw
|
||||
.iter()
|
||||
.find_position(|token| token.kind() == TokenKind::Unknown)
|
||||
.map(|(idx, _)| idx)
|
||||
.unwrap_or_else(|| self.raw.len())
|
||||
.position(|token| token.kind() == TokenKind::Unknown)
|
||||
.unwrap_or(self.raw.len())
|
||||
});
|
||||
&self.raw[..end]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue