Skip to content

Commit da7b958

Browse files
Redovo1red
andauthored
[flake8-type-checking] Clarify import cycle wording for TC001/TC002/TC003 (#24322)
Co-authored-by: red <red@reddeMacBook-Pro.local>
1 parent a0356f1 commit da7b958

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

crates/ruff_linter/src/rules/flake8_type_checking/rules/typing_only_runtime_import.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ use crate::{Fix, FixAvailability, Violation};
2323
/// aren't defined in a type-checking block.
2424
///
2525
/// ## Why is this bad?
26-
/// Unused imports add a performance overhead at runtime, and risk creating
27-
/// import cycles. If an import is _only_ used in typing-only contexts, it can
28-
/// instead be imported conditionally under an `if TYPE_CHECKING:` block to
29-
/// minimize runtime overhead.
26+
/// Imports that are only used for type annotations add a performance overhead
27+
/// at runtime. For first-party imports, they can also contribute to import
28+
/// cycles. If an import is _only_ used in typing-only contexts, it can instead
29+
/// be imported conditionally under an `if TYPE_CHECKING:` block to minimize
30+
/// runtime overhead.
3031
///
3132
/// If [`lint.flake8-type-checking.quote-annotations`] is set to `true`,
3233
/// annotations will be wrapped in quotes if doing so would enable the
@@ -107,8 +108,8 @@ impl Violation for TypingOnlyFirstPartyImport {
107108
/// aren't defined in a type-checking block.
108109
///
109110
/// ## Why is this bad?
110-
/// Unused imports add a performance overhead at runtime, and risk creating
111-
/// import cycles. If an import is _only_ used in typing-only contexts, it can
111+
/// Imports that are only used for type annotations add a performance overhead
112+
/// at runtime. If an import is _only_ used in typing-only contexts, it can
112113
/// instead be imported conditionally under an `if TYPE_CHECKING:` block to
113114
/// minimize runtime overhead.
114115
///
@@ -190,8 +191,8 @@ impl Violation for TypingOnlyThirdPartyImport {
190191
/// annotations, but aren't defined in a type-checking block.
191192
///
192193
/// ## Why is this bad?
193-
/// Unused imports add a performance overhead at runtime, and risk creating
194-
/// import cycles. If an import is _only_ used in typing-only contexts, it can
194+
/// Imports that are only used for type annotations add a performance overhead
195+
/// at runtime. If an import is _only_ used in typing-only contexts, it can
195196
/// instead be imported conditionally under an `if TYPE_CHECKING:` block to
196197
/// minimize runtime overhead.
197198
///

0 commit comments

Comments
 (0)