Skip to content

Commit 580577e

Browse files
authored
[refurb] Make example error out-of-the-box (FURB157) (#19695)
## Summary Part of #18972 This PR makes [verbose-decimal-constructor (FURB157)](https://docs.astral.sh/ruff/rules/verbose-decimal-constructor/#verbose-decimal-constructor-furb157)'s example error out-of-the-box. [Old example](https://play.ruff.rs/0930015c-ad45-4490-800e-66ed057bfe34) ```py Decimal("0") Decimal(float("Infinity")) ``` [New example](https://play.ruff.rs/516e5992-322f-4203-afe7-46d8cad53368) ```py from decimal import Decimal Decimal("0") Decimal(float("Infinity")) ``` Imports were also added to the "Use Instead" section.
1 parent dce25da commit 580577e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/ruff_linter/src/rules/refurb/rules/verbose_decimal_constructor.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,16 @@ use crate::{Edit, Fix, FixAvailability, Violation};
3030
///
3131
/// ## Example
3232
/// ```python
33+
/// from decimal import Decimal
34+
///
3335
/// Decimal("0")
3436
/// Decimal(float("Infinity"))
3537
/// ```
3638
///
3739
/// Use instead:
3840
/// ```python
41+
/// from decimal import Decimal
42+
///
3943
/// Decimal(0)
4044
/// Decimal("Infinity")
4145
/// ```

0 commit comments

Comments
 (0)