@@ -38,6 +38,13 @@ use crate::{Fix, FixAvailability, Violation};
3838/// [`lint.flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
3939/// as such.
4040///
41+ /// If [`lint.future-annotations`] is set to `true`, `from __future__ import
42+ /// annotations` will be added if doing so would enable an import to be
43+ /// moved into an `if TYPE_CHECKING:` block. This takes precedence over the
44+ /// [`lint.flake8-type-checking.quote-annotations`] setting described above if
45+ /// both settings are enabled.
46+ ///
47+ ///
4148/// ## Example
4249/// ```python
4350/// from __future__ import annotations
@@ -63,14 +70,6 @@ use crate::{Fix, FixAvailability, Violation};
6370/// return len(sized)
6471/// ```
6572///
66- ///
67- /// ## Preview
68- /// If [`lint.future-annotations`] is set to `true`, `from __future__ import
69- /// annotations` will be added if doing so would enable an import to be moved into an `if
70- /// TYPE_CHECKING:` block. This takes precedence over the
71- /// [`lint.flake8-type-checking.quote-annotations`] setting described above if both settings are
72- /// enabled.
73- ///
7473/// ## Options
7574/// - `lint.flake8-type-checking.quote-annotations`
7675/// - `lint.flake8-type-checking.runtime-evaluated-base-classes`
@@ -122,6 +121,12 @@ impl Violation for TypingOnlyFirstPartyImport {
122121/// [`lint.flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
123122/// as such.
124123///
124+ /// If [`lint.future-annotations`] is set to `true`, `from __future__ import
125+ /// annotations` will be added if doing so would enable an import to be
126+ /// moved into an `if TYPE_CHECKING:` block. This takes precedence over the
127+ /// [`lint.flake8-type-checking.quote-annotations`] setting described above if
128+ /// both settings are enabled.
129+ ///
125130/// ## Example
126131/// ```python
127132/// from __future__ import annotations
@@ -147,13 +152,6 @@ impl Violation for TypingOnlyFirstPartyImport {
147152/// return len(df)
148153/// ```
149154///
150- /// ## Preview
151- /// If [`lint.future-annotations`] is set to `true`, `from __future__ import
152- /// annotations` will be added if doing so would enable an import to be moved into an `if
153- /// TYPE_CHECKING:` block. This takes precedence over the
154- /// [`lint.flake8-type-checking.quote-annotations`] setting described above if both settings are
155- /// enabled.
156- ///
157155/// ## Options
158156/// - `lint.flake8-type-checking.quote-annotations`
159157/// - `lint.flake8-type-checking.runtime-evaluated-base-classes`
@@ -205,6 +203,12 @@ impl Violation for TypingOnlyThirdPartyImport {
205203/// [`lint.flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
206204/// as such.
207205///
206+ /// If [`lint.future-annotations`] is set to `true`, `from __future__ import
207+ /// annotations` will be added if doing so would enable an import to be
208+ /// moved into an `if TYPE_CHECKING:` block. This takes precedence over the
209+ /// [`lint.flake8-type-checking.quote-annotations`] setting described above if
210+ /// both settings are enabled.
211+ ///
208212/// ## Example
209213/// ```python
210214/// from __future__ import annotations
@@ -230,15 +234,6 @@ impl Violation for TypingOnlyThirdPartyImport {
230234/// return str(path)
231235/// ```
232236///
233- /// ## Preview
234- ///
235- /// When [preview](https://docs.astral.sh/ruff/preview/) is enabled, if
236- /// [`lint.future-annotations`] is set to `true`, `from __future__ import
237- /// annotations` will be added if doing so would enable an import to be moved into an `if
238- /// TYPE_CHECKING:` block. This takes precedence over the
239- /// [`lint.flake8-type-checking.quote-annotations`] setting described above if both settings are
240- /// enabled.
241- ///
242237/// ## Options
243238/// - `lint.flake8-type-checking.quote-annotations`
244239/// - `lint.flake8-type-checking.runtime-evaluated-base-classes`
@@ -287,7 +282,7 @@ pub(crate) fn typing_only_runtime_import(
287282
288283 // If we can't add a `__future__` import and in un-strict mode, don't flag typing-only
289284 // imports that are implicitly loaded by way of a valid runtime import.
290- if !checker. settings ( ) . future_annotations ( )
285+ if !checker. settings ( ) . future_annotations
291286 && !checker. settings ( ) . flake8_type_checking . strict
292287 && runtime_imports
293288 . iter ( )
0 commit comments