File tree 3 files changed +5
-9
lines changed 3 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,8 @@ pub struct PyInt {
24
24
pub type PyIntRef = PyRef < PyInt > ;
25
25
26
26
impl PyInt {
27
- pub fn new < T : ToBigInt > ( i : T ) -> Self {
28
- PyInt {
29
- // TODO: this .clone()s a BigInt, which is not what we want.
30
- value : i. to_bigint ( ) . unwrap ( ) ,
31
- }
27
+ pub fn new < T : Into < BigInt > > ( i : T ) -> Self {
28
+ PyInt { value : i. into ( ) }
32
29
}
33
30
}
34
31
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ use std::ptr;
10
10
use std:: rc:: Rc ;
11
11
12
12
use num_bigint:: BigInt ;
13
- use num_bigint:: ToBigInt ;
14
13
use num_complex:: Complex64 ;
15
14
use num_traits:: { One , Zero } ;
16
15
@@ -508,7 +507,7 @@ impl PyContext {
508
507
self . new_instance ( self . object ( ) , None )
509
508
}
510
509
511
- pub fn new_int < T : ToBigInt > ( & self , i : T ) -> PyObjectRef {
510
+ pub fn new_int < T : Into < BigInt > > ( & self , i : T ) -> PyObjectRef {
512
511
PyObject :: new ( PyInt :: new ( i) , self . int_type ( ) )
513
512
}
514
513
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ use crate::pyobject::{
32
32
} ;
33
33
use crate :: stdlib;
34
34
use crate :: sysmodule;
35
- use num_bigint:: ToBigInt ;
35
+ use num_bigint:: BigInt ;
36
36
37
37
// use objects::objects;
38
38
@@ -109,7 +109,7 @@ impl VirtualMachine {
109
109
}
110
110
111
111
/// Create a new python int object.
112
- pub fn new_int < T : ToBigInt > ( & self , i : T ) -> PyObjectRef {
112
+ pub fn new_int < T : Into < BigInt > > ( & self , i : T ) -> PyObjectRef {
113
113
self . ctx . new_int ( i)
114
114
}
115
115
You can’t perform that action at this time.
0 commit comments