Skip to content

Commit aa86d62

Browse files
committed
Added num/malachite features for format crate
d
1 parent 52edf45 commit aa86d62

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

ast/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ fold = []
1616
unparse = ["rustpython-literal"]
1717
visitor = []
1818
all-nodes-with-ranges = []
19+
malachite-bigint = ["dep:malachite-bigint"]
20+
num-bigint = ["dep:num-bigint"]
1921

2022
[dependencies]
2123
rustpython-parser-core = { workspace = true }

format/Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@ repository = { workspace = true }
88
license = { workspace = true }
99
rust-version = { workspace = true }
1010

11+
[features]
12+
default = ["malachite-bigint"]
13+
malachite-bigint = ["dep:malachite-bigint"]
14+
num-bigint = ["dep:num-bigint"]
15+
1116
[dependencies]
1217
rustpython-literal = { workspace = true }
1318

1419
bitflags = { workspace = true }
1520
itertools = { workspace = true }
16-
malachite-bigint = { workspace = true }
21+
malachite-bigint = { workspace = true, optional = true }
22+
num-bigint = { workspace = true, optional = true }
1723
num-traits = { workspace = true }

format/src/cformat.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
//! Implementation of Printf-Style string formatting
22
//! as per the [Python Docs](https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting).
33
use bitflags::bitflags;
4+
#[cfg(feature = "malachite-bigint")]
45
use malachite_bigint::{BigInt, Sign};
6+
#[cfg(feature = "num-bigint")]
7+
use num_bigint::{BigInt, Sign};
58
use num_traits::Signed;
69
use rustpython_literal::{float, format::Case};
710
use std::{

format/src/format.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
use itertools::{Itertools, PeekingNext};
2+
#[cfg(feature = "malachite-bigint")]
23
use malachite_bigint::{BigInt, Sign};
4+
#[cfg(feature = "num-bigint")]
5+
use num_bigint::{BigInt, Sign};
36
use num_traits::FromPrimitive;
47
use num_traits::{cast::ToPrimitive, Signed};
58
use rustpython_literal::float;

parser/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ phf_codegen = "0.11.1"
2424
tiny-keccak = { version = "2", features = ["sha3"] }
2525

2626
[dependencies]
27-
rustpython-ast = { workspace = true }
27+
rustpython-ast = { workspace = true, default-features = false }
2828
rustpython-parser-core = { workspace = true }
2929

3030
itertools = { workspace = true }

0 commit comments

Comments
 (0)