diff --git a/crates/ruff_linter/src/rules/flake8_pyi/rules/non_self_return_type.rs b/crates/ruff_linter/src/rules/flake8_pyi/rules/non_self_return_type.rs index d5d70b02500d8..a0b772e8b51e3 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/rules/non_self_return_type.rs +++ b/crates/ruff_linter/src/rules/flake8_pyi/rules/non_self_return_type.rs @@ -191,7 +191,7 @@ fn add_diagnostic( /// Return an [`Edit`] that imports `typing.Self` from `typing` or `typing_extensions`. fn import_self(checker: &Checker, range: TextRange) -> Option { let target_version = checker.settings.target_version.as_tuple(); - let source_module = if checker.source_type.is_stub() || target_version >= (3, 11) { + let source_module = if target_version >= (3, 11) { "typing" } else { "typing_extensions"