mirror of https://github.com/astral-sh/ruff
[`flake8-async`] Make `ASYNC105` example error out-of-the-box (#19002)
## Summary Part of #18972 This PR makes [trio-sync-call (ASYNC105)](https://docs.astral.sh/ruff/rules/trio-sync-call/#trio-sync-call-async105)'s example error out-of-the-box [Old example](https://play.ruff.rs/5b267e01-1c0a-4902-949e-45fc46f8b0d0) ```py async def double_sleep(x): trio.sleep(2 * x) ``` [New example](https://play.ruff.rs/eba6ea40-ff88-4ea8-8cb4-cea472c15c53) ```py import trio async def double_sleep(x): trio.sleep(2 * x) ``` ## Test Plan <!-- How was it tested? --> N/A, no functionality/tests affected
This commit is contained in:
parent
68f98cfcd8
commit
c5995c40d3
|
|
@ -18,12 +18,18 @@ use crate::{Edit, Fix, FixAvailability, Violation};
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// ```python
|
/// ```python
|
||||||
|
/// import trio
|
||||||
|
///
|
||||||
|
///
|
||||||
/// async def double_sleep(x):
|
/// async def double_sleep(x):
|
||||||
/// trio.sleep(2 * x)
|
/// trio.sleep(2 * x)
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// Use instead:
|
/// Use instead:
|
||||||
/// ```python
|
/// ```python
|
||||||
|
/// import trio
|
||||||
|
///
|
||||||
|
///
|
||||||
/// async def double_sleep(x):
|
/// async def double_sleep(x):
|
||||||
/// await trio.sleep(2 * x)
|
/// await trio.sleep(2 * x)
|
||||||
/// ```
|
/// ```
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue