@@ -38,6 +38,13 @@ use crate::{Fix, FixAvailability, Violation};
38
38
/// [`lint.flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
39
39
/// as such.
40
40
///
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
+ ///
41
48
/// ## Example
42
49
/// ```python
43
50
/// from __future__ import annotations
@@ -63,14 +70,6 @@ use crate::{Fix, FixAvailability, Violation};
63
70
/// return len(sized)
64
71
/// ```
65
72
///
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
- ///
74
73
/// ## Options
75
74
/// - `lint.flake8-type-checking.quote-annotations`
76
75
/// - `lint.flake8-type-checking.runtime-evaluated-base-classes`
@@ -122,6 +121,12 @@ impl Violation for TypingOnlyFirstPartyImport {
122
121
/// [`lint.flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
123
122
/// as such.
124
123
///
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
+ ///
125
130
/// ## Example
126
131
/// ```python
127
132
/// from __future__ import annotations
@@ -147,13 +152,6 @@ impl Violation for TypingOnlyFirstPartyImport {
147
152
/// return len(df)
148
153
/// ```
149
154
///
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
- ///
157
155
/// ## Options
158
156
/// - `lint.flake8-type-checking.quote-annotations`
159
157
/// - `lint.flake8-type-checking.runtime-evaluated-base-classes`
@@ -205,6 +203,12 @@ impl Violation for TypingOnlyThirdPartyImport {
205
203
/// [`lint.flake8-type-checking.runtime-evaluated-decorators`] settings to mark them
206
204
/// as such.
207
205
///
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
+ ///
208
212
/// ## Example
209
213
/// ```python
210
214
/// from __future__ import annotations
@@ -230,15 +234,6 @@ impl Violation for TypingOnlyThirdPartyImport {
230
234
/// return str(path)
231
235
/// ```
232
236
///
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
- ///
242
237
/// ## Options
243
238
/// - `lint.flake8-type-checking.quote-annotations`
244
239
/// - `lint.flake8-type-checking.runtime-evaluated-base-classes`
@@ -287,7 +282,7 @@ pub(crate) fn typing_only_runtime_import(
287
282
288
283
// If we can't add a `__future__` import and in un-strict mode, don't flag typing-only
289
284
// imports that are implicitly loaded by way of a valid runtime import.
290
- if !checker. settings ( ) . future_annotations ( )
285
+ if !checker. settings ( ) . future_annotations
291
286
&& !checker. settings ( ) . flake8_type_checking . strict
292
287
&& runtime_imports
293
288
. iter ( )
0 commit comments