From 4efe36b6bcd802d4e55f2eeb1dc3fa69b60250f9 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 28 Dec 2023 01:09:35 +0900 Subject: [PATCH] bigint module for rustpython-format --- format/src/bigint.rs | 4 ++++ format/src/cformat.rs | 5 +---- format/src/format.rs | 5 +---- format/src/lib.rs | 1 + 4 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 format/src/bigint.rs diff --git a/format/src/bigint.rs b/format/src/bigint.rs new file mode 100644 index 00000000..ed12ec44 --- /dev/null +++ b/format/src/bigint.rs @@ -0,0 +1,4 @@ +#[cfg(feature = "malachite-bigint")] +pub use malachite_bigint::{BigInt, Sign}; +#[cfg(feature = "num-bigint")] +pub use num_bigint::{BigInt, Sign}; diff --git a/format/src/cformat.rs b/format/src/cformat.rs index 248ad514..975da4be 100644 --- a/format/src/cformat.rs +++ b/format/src/cformat.rs @@ -1,10 +1,7 @@ //! Implementation of Printf-Style string formatting //! as per the [Python Docs](https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting). +use crate::bigint::{BigInt, Sign}; use bitflags::bitflags; -#[cfg(feature = "malachite-bigint")] -use malachite_bigint::{BigInt, Sign}; -#[cfg(feature = "num-bigint")] -use num_bigint::{BigInt, Sign}; use num_traits::Signed; use rustpython_literal::{float, format::Case}; use std::{ diff --git a/format/src/format.rs b/format/src/format.rs index 8109f1f9..fd497b90 100644 --- a/format/src/format.rs +++ b/format/src/format.rs @@ -1,8 +1,5 @@ +use crate::bigint::{BigInt, Sign}; use itertools::{Itertools, PeekingNext}; -#[cfg(feature = "malachite-bigint")] -use malachite_bigint::{BigInt, Sign}; -#[cfg(feature = "num-bigint")] -use num_bigint::{BigInt, Sign}; use num_traits::FromPrimitive; use num_traits::{cast::ToPrimitive, Signed}; use rustpython_literal::float; diff --git a/format/src/lib.rs b/format/src/lib.rs index 3c5d8695..acf8e1b3 100644 --- a/format/src/lib.rs +++ b/format/src/lib.rs @@ -1,3 +1,4 @@ +mod bigint; pub mod cformat; mod format;