From 580577e6675babc287f3319e0d544d0c0791f95e Mon Sep 17 00:00:00 2001 From: GiGaGon <107241144+MeGaGiGaGon@users.noreply.github.com> Date: Fri, 1 Aug 2025 10:55:48 -0700 Subject: [PATCH] [`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. --- .../src/rules/refurb/rules/verbose_decimal_constructor.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/ruff_linter/src/rules/refurb/rules/verbose_decimal_constructor.rs b/crates/ruff_linter/src/rules/refurb/rules/verbose_decimal_constructor.rs index a08489d2d1..b4c7e8a493 100644 --- a/crates/ruff_linter/src/rules/refurb/rules/verbose_decimal_constructor.rs +++ b/crates/ruff_linter/src/rules/refurb/rules/verbose_decimal_constructor.rs @@ -30,12 +30,16 @@ use crate::{Edit, Fix, FixAvailability, Violation}; /// /// ## Example /// ```python +/// from decimal import Decimal +/// /// Decimal("0") /// Decimal(float("Infinity")) /// ``` /// /// Use instead: /// ```python +/// from decimal import Decimal +/// /// Decimal(0) /// Decimal("Infinity") /// ```