Skip to content

Commit

Permalink
Fix PYI034's import_self too
Browse files Browse the repository at this point in the history
  • Loading branch information
InSyncWithFoo committed Nov 11, 2024
1 parent 3adf072 commit fe2a777
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,7 @@ fn replace_custom_typevar_with_self(
}

match replace_typevar_usages_with_self(parameters, typevar_name) {
Ok(mut edits) => {
all_edits.append(&mut edits)
}
Ok(mut edits) => all_edits.append(&mut edits),
Err(mut edits) => {
fix_applicability = Applicability::Unsafe;
all_edits.append(&mut edits)
Expand Down Expand Up @@ -332,7 +330,9 @@ fn import_self(checker: &Checker, return_range: TextRange) -> Option<Edit> {
let request = ImportRequest::import_from(source_module, "Self");

let position = return_range.start();
let (edit, ..) = importer.get_or_import_symbol(&request, position, semantic).ok()?;
let (edit, ..) = importer
.get_or_import_symbol(&request, position, semantic)
.ok()?;

Some(edit)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,9 @@ fn add_diagnostic(
let (importer, semantic) = (checker.importer(), checker.semantic());
let request = ImportRequest::import_from(source_module, "Self");

let Ok((edit, ..)) = importer.get_or_import_symbol(&request, range.start(), semantic)
else {
return None;
};
let (edit, ..) = importer
.get_or_import_symbol(&request, range.start(), semantic)
.ok()?;

Some(edit)
}
Expand Down

0 comments on commit fe2a777

Please sign in to comment.