mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 12:29:28 +00:00

## Summary The `SemanticModel` currently stores the "body" of a given `Suite`, along with the current statement index. This is used to support "next sibling" queries, but we only use this in exactly one place -- the rule that simplifies constructs like this to `any` or `all`: ```python for x in y: if x == 0: return True return False ``` Instead of tracking the state, we can just do a (slightly more expensive) traversal, by finding the node within its parent and returning the next node in the body. Note that we'll only have to do this extremely rarely -- namely, for functions that contain something like: ```python for x in y: if x == 0: return True ```
22 lines
393 B
Rust
22 lines
393 B
Rust
pub mod all;
|
|
pub mod call_path;
|
|
pub mod cast;
|
|
pub mod comparable;
|
|
pub mod docstrings;
|
|
pub mod function;
|
|
pub mod hashable;
|
|
pub mod helpers;
|
|
pub mod identifier;
|
|
pub mod imports;
|
|
pub mod node;
|
|
pub mod relocate;
|
|
pub mod source_code;
|
|
pub mod statement_visitor;
|
|
pub mod stmt_if;
|
|
pub mod str;
|
|
pub mod token_kind;
|
|
pub mod traversal;
|
|
pub mod types;
|
|
pub mod typing;
|
|
pub mod visitor;
|
|
pub mod whitespace;
|