Skip to content

Commit a6d269f

Browse files
Apply dict.get fix before ternary rewrite (#4944)
1 parent f17282d commit a6d269f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/ruff/src/autofix/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ fn cmp_fix(rule1: Rule, rule2: Rule, fix1: &Fix, fix2: &Fix) -> std::cmp::Orderi
110110
// Apply `EndsInPeriod` fixes before `NewLineAfterLastParagraph` fixes.
111111
(Rule::EndsInPeriod, Rule::NewLineAfterLastParagraph) => std::cmp::Ordering::Less,
112112
(Rule::NewLineAfterLastParagraph, Rule::EndsInPeriod) => std::cmp::Ordering::Greater,
113+
// Apply `IfElseBlockInsteadOfDictGet` fixes before `IfElseBlockInsteadOfIfExp` fixes.
114+
(Rule::IfElseBlockInsteadOfDictGet, Rule::IfElseBlockInsteadOfIfExp) => {
115+
std::cmp::Ordering::Less
116+
}
117+
(Rule::IfElseBlockInsteadOfIfExp, Rule::IfElseBlockInsteadOfDictGet) => {
118+
std::cmp::Ordering::Greater
119+
}
113120
_ => std::cmp::Ordering::Equal,
114121
})
115122
}

0 commit comments

Comments
 (0)