mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
Use matches!
for CallPath
comparisons (#5099)
## Summary This PR consistently uses `matches! for static `CallPath` comparisons. In some cases, we can significantly reduce the number of cases or checks. ## Test Plan `cargo test `
This commit is contained in:
parent
bae183b823
commit
56476dfd61
67 changed files with 251 additions and 220 deletions
|
@ -58,7 +58,7 @@ pub fn exc_info<'a>(keywords: &'a [Keyword], semantic: &SemanticModel) -> Option
|
|||
// Ex) `logging.error("...", exc_info=sys.exc_info())`
|
||||
if let Expr::Call(ast::ExprCall { func, .. }) = &exc_info.value {
|
||||
if semantic.resolve_call_path(func).map_or(false, |call_path| {
|
||||
call_path.as_slice() == ["sys", "exc_info"]
|
||||
matches!(call_path.as_slice(), ["sys", "exc_info"])
|
||||
}) {
|
||||
return Some(exc_info);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue