Skip to content

Commit 8731e9f

Browse files
authored
Added num/malachite features for format crate (#109)
1 parent 29c4728 commit 8731e9f

File tree

7 files changed

+14
-5
lines changed

7 files changed

+14
-5
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ rustpython-parser-vendored = { path = "vendored", version = "0.3.0" }
2020
rustpython-ast = { path = "ast", default-features = false, version = "0.3.0" }
2121
rustpython-parser-core = { path = "core", features = [], version = "0.3.0" }
2222
rustpython-literal = { path = "literal", version = "0.3.0" }
23-
rustpython-format = { path = "format", version = "0.3.0" }
23+
rustpython-format = { path = "format", default-features = false, version = "0.3.0" }
2424
rustpython-parser = { path = "parser", default-features = false, version = "0.3.0" }
2525

2626
anyhow = "1.0.45"

format/Cargo.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ repository = { workspace = true }
88
license = { workspace = true }
99
rust-version = { workspace = true }
1010

11+
[features]
12+
default = ["malachite-bigint"]
13+
1114
[dependencies]
1215
rustpython-literal = { workspace = true }
1316

1417
bitflags = { workspace = true }
1518
itertools = { workspace = true }
16-
malachite-bigint = { workspace = true }
19+
malachite-bigint = { workspace = true, optional = true }
20+
num-bigint = { workspace = true, optional = true }
1721
num-traits = { workspace = true }

format/src/bigint.rs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#[cfg(feature = "malachite-bigint")]
2+
pub use malachite_bigint::{BigInt, Sign};
3+
#[cfg(feature = "num-bigint")]
4+
pub use num_bigint::{BigInt, Sign};

format/src/cformat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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).
3+
use crate::bigint::{BigInt, Sign};
34
use bitflags::bitflags;
4-
use malachite_bigint::{BigInt, Sign};
55
use num_traits::Signed;
66
use rustpython_literal::{float, format::Case};
77
use std::{

format/src/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
use crate::bigint::{BigInt, Sign};
12
use itertools::{Itertools, PeekingNext};
2-
use malachite_bigint::{BigInt, Sign};
33
use num_traits::FromPrimitive;
44
use num_traits::{cast::ToPrimitive, Signed};
55
use rustpython_literal::float;

format/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
mod bigint;
12
pub mod cformat;
23
mod format;
34

parser/Cargo.toml

+1-1
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)