[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.
This commit is contained in:
GiGaGon 2025-08-01 10:55:48 -07:00 committed by GitHub
parent dce25da19a
commit 580577e667
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -30,12 +30,16 @@ use crate::{Edit, Fix, FixAvailability, Violation};
/// ///
/// ## Example /// ## Example
/// ```python /// ```python
/// from decimal import Decimal
///
/// Decimal("0") /// Decimal("0")
/// Decimal(float("Infinity")) /// Decimal(float("Infinity"))
/// ``` /// ```
/// ///
/// Use instead: /// Use instead:
/// ```python /// ```python
/// from decimal import Decimal
///
/// Decimal(0) /// Decimal(0)
/// Decimal("Infinity") /// Decimal("Infinity")
/// ``` /// ```