Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Glyphack committed Jan 15, 2025
1 parent e0da73a commit cf342b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ruff_db::source::source_text;
use ruff_python_ast::str::raw_contents;
use ruff_python_ast::{self as ast, ModExpression};
use ruff_python_parser::{parse_string_annotation, Parsed};
use ruff_python_parser::Parsed;
use ruff_text_size::Ranged;

use crate::declare_lint;
Expand Down Expand Up @@ -153,7 +153,8 @@ pub(crate) fn parse_string_annotation(
} else if raw_contents(node_text)
.is_some_and(|raw_contents| raw_contents == string_literal.as_str())
{
let parsed = parse_string_annotation(source.as_str(), string_literal);
let parsed =
ruff_python_parser::parse_string_annotation(source.as_str(), string_literal);
match parsed {
Ok(parsed) => return Some(parsed),
Err(parse_error) => context.report_lint(
Expand Down
6 changes: 1 addition & 5 deletions crates/ruff_python_parser/src/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1317,11 +1317,7 @@ impl<'src> Lexer<'src> {
// First of all, we need all nestings to be finished.
// For Mode::ParenthesizedExpression we start with nesting level 1.
// So we check if we end with that level.
let init_nesting = if self.mode == Mode::ParenthesizedExpression {
1
} else {
0
};
let init_nesting = u32::from(self.mode == Mode::ParenthesizedExpression);

if self.nesting > init_nesting {
// Reset the nesting to avoid going into infinite loop.
Expand Down

0 comments on commit cf342b5

Please sign in to comment.