@@ -103,14 +103,14 @@ macro_rules! def_array_enum {
103
103
Ok ( ( ) )
104
104
}
105
105
106
- fn count( & self , obj: PyObjectRef , vm: & VirtualMachine ) -> PyResult < usize > {
106
+ fn count( & self , obj: PyObjectRef , vm: & VirtualMachine ) -> usize {
107
107
match self {
108
108
$( ArrayContentType :: $n( v) => {
109
- Ok ( if let Ok ( val) = $t:: try_into_from_object( vm, obj) {
109
+ if let Ok ( val) = $t:: try_into_from_object( vm, obj) {
110
110
v. iter( ) . filter( |&&a| a == val) . count( )
111
111
} else {
112
112
0
113
- } )
113
+ }
114
114
} ) *
115
115
}
116
116
}
@@ -385,13 +385,13 @@ def_array_enum!(
385
385
( Double , f64 , 'd' ) ,
386
386
) ;
387
387
388
- trait TryIntoFromObject : Sized {
388
+ trait ArrayElement : Sized {
389
389
fn try_into_from_object ( vm : & VirtualMachine , obj : PyObjectRef ) -> PyResult < Self > ;
390
390
}
391
391
392
392
macro_rules! adapt_try_into_from_object {
393
393
( $( ( $t: ty, $f: path) , ) * ) => { $(
394
- impl TryIntoFromObject for $t {
394
+ impl ArrayElement for $t {
395
395
fn try_into_from_object( vm: & VirtualMachine , obj: PyObjectRef ) -> PyResult <Self > {
396
396
$f( vm, obj)
397
397
}
@@ -490,7 +490,7 @@ impl PyArray {
490
490
}
491
491
492
492
#[ pymethod]
493
- fn count ( & self , x : PyObjectRef , vm : & VirtualMachine ) -> PyResult < usize > {
493
+ fn count ( & self , x : PyObjectRef , vm : & VirtualMachine ) -> usize {
494
494
self . borrow_value ( ) . count ( x, vm)
495
495
}
496
496
0 commit comments