Make collect_call_path return an Option (#3849)

This commit is contained in:
Charlie Marsh 2023-04-01 22:29:32 -04:00 committed by GitHub
parent d822e08111
commit 08e5b3fa61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 158 additions and 138 deletions

View file

@ -4,6 +4,7 @@ use rustpython_parser::ast::{Expr, ExprKind, Location};
use ruff_python_stdlib::typing::{PEP_585_BUILTINS_ELIGIBLE, PEP_593_SUBSCRIPTS, SUBSCRIPTS};
use crate::call_path::{from_unqualified_name, CallPath};
use crate::context::Context;
use crate::relocate::relocate_expr;
use crate::source_code::Locator;
@ -47,7 +48,7 @@ pub fn match_annotated_subscript<'a>(
}
for module in typing_modules {
let module_call_path = module.split('.').collect::<Vec<_>>();
let module_call_path: CallPath = from_unqualified_name(module);
if call_path.starts_with(&module_call_path) {
for subscript in SUBSCRIPTS.iter() {
if call_path.last() == subscript.last() {