mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-23 04:55:09 +00:00
Remove unnecessary LibCST usage in key-in-dict (#6727)
## Summary We're using LibCST to ensure that we return the full parenthesized range of an expression, for display purposes. We can just use `parenthesized_range` which is more efficient and removes one LibCST dependency. ## Test Plan `cargo test`
This commit is contained in:
parent
f017555d53
commit
2405536d03
7 changed files with 92 additions and 76 deletions
|
@ -339,7 +339,9 @@ impl FormatRule<Suite, PyFormatContext<'_>> for FormatSuite {
|
|||
pub(crate) fn contains_only_an_ellipsis(body: &[Stmt], comments: &Comments) -> bool {
|
||||
match body {
|
||||
[Stmt::Expr(ast::StmtExpr { value, .. })] => {
|
||||
let [node] = body else { return false; };
|
||||
let [node] = body else {
|
||||
return false;
|
||||
};
|
||||
matches!(
|
||||
value.as_ref(),
|
||||
Expr::Constant(ast::ExprConstant {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue