From ef62132d0875ddeda53d6578ff36c4b62db2b279 Mon Sep 17 00:00:00 2001 From: GiGaGon <107241144+MeGaGiGaGon@users.noreply.github.com> Date: Thu, 31 Jul 2025 14:34:54 -0700 Subject: [PATCH] Update unnecessary_from_float.rs --- .../src/rules/refurb/rules/unnecessary_from_float.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/ruff_linter/src/rules/refurb/rules/unnecessary_from_float.rs b/crates/ruff_linter/src/rules/refurb/rules/unnecessary_from_float.rs index 03986fe1f3d29..dfa074a55a409 100644 --- a/crates/ruff_linter/src/rules/refurb/rules/unnecessary_from_float.rs +++ b/crates/ruff_linter/src/rules/refurb/rules/unnecessary_from_float.rs @@ -26,6 +26,9 @@ use crate::{Applicability, Edit, Fix, FixAvailability, Violation}; /// /// ## Example /// ```python +/// from decimal import Decimal +/// from fractions import Fraction +/// /// Decimal.from_float(4.2) /// Decimal.from_float(float("inf")) /// Fraction.from_float(4.2) @@ -34,10 +37,13 @@ use crate::{Applicability, Edit, Fix, FixAvailability, Violation}; /// /// Use instead: /// ```python +/// from decimal import Decimal +/// from fractions import Fraction +/// /// Decimal(4.2) /// Decimal("inf") /// Fraction(4.2) -/// Fraction(Decimal(4.2)) +/// Fraction(Decimal("4.2")) /// ``` /// /// ## Fix safety