From cadb27aa62509ad9059dfac4f075317893f1f614 Mon Sep 17 00:00:00 2001 From: notV4l Date: Fri, 31 May 2024 15:26:09 +0200 Subject: [PATCH] fix trait/Self warnings for cairo 2.7 --- Scarb.toml | 6 +++--- src/f128/types/fixed.cairo | 8 ++++---- src/f64/types/fixed.cairo | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Scarb.toml b/Scarb.toml index 8321422..4381d19 100644 --- a/Scarb.toml +++ b/Scarb.toml @@ -1,13 +1,13 @@ [package] name = "cubit" version = "1.3.0" -cairo-version = ">=2.4.0" +cairo-version = "2.6.3" edition = "2023_10" description = "Math library in Cairo using a 64.64 fixed point representation" homepage = "https://github.com/influenceth/cubit" [lib] -sierra = false # Enable Sierra codegen. -casm = false # Enable CASM codegen. +sierra = true # Enable Sierra codegen. +casm = true # Enable CASM codegen. [dependencies] diff --git a/src/f128/types/fixed.cairo b/src/f128/types/fixed.cairo index e3f2bd7..f8d3103 100644 --- a/src/f128/types/fixed.cairo +++ b/src/f128/types/fixed.cairo @@ -92,16 +92,16 @@ impl FixedImpl of FixedTrait { } fn new_unscaled(mag: u128, sign: bool) -> Fixed { - return FixedTrait::new(mag * ONE_u128, sign); + return Self::new(mag * ONE_u128, sign); } fn from_felt(val: felt252) -> Fixed { let mag = core::integer::u128_try_from_felt252(utils::felt_abs(val)).unwrap(); - return FixedTrait::new(mag, utils::felt_sign(val)); + return Self::new(mag, utils::felt_sign(val)); } fn from_unscaled_felt(val: felt252) -> Fixed { - return FixedTrait::from_felt(val * ONE); + return Self::from_felt(val * ONE); } fn abs(self: Fixed) -> Fixed { @@ -551,7 +551,7 @@ impl FixedOne of core::num::traits::One { } #[inline(always)] fn is_one(self: @Fixed) -> bool { - *self == FixedOne::one() + *self == Self::one() } #[inline(always)] fn is_non_one(self: @Fixed) -> bool { diff --git a/src/f64/types/fixed.cairo b/src/f64/types/fixed.cairo index 5e4ef81..85dee51 100644 --- a/src/f64/types/fixed.cairo +++ b/src/f64/types/fixed.cairo @@ -93,11 +93,11 @@ impl FixedImpl of FixedTrait { fn from_felt(val: felt252) -> Fixed { let mag = core::integer::u64_try_from_felt252(utils::felt_abs(val)).unwrap(); - return FixedTrait::new(mag, utils::felt_sign(val)); + return Self::new(mag, utils::felt_sign(val)); } fn from_unscaled_felt(val: felt252) -> Fixed { - return FixedTrait::from_felt(val * ONE.into()); + return Self::from_felt(val * ONE.into()); } fn abs(self: Fixed) -> Fixed { @@ -548,7 +548,7 @@ impl FixedOne of core::num::traits::One { } #[inline(always)] fn is_one(self: @Fixed) -> bool { - *self == FixedOne::one() + *self == Self::one() } #[inline(always)] fn is_non_one(self: @Fixed) -> bool {