@@ -110,7 +110,6 @@ impl PyGenericAlias {
110110 "()" . to_owned( )
111111 } else {
112112 self . args
113- . as_slice( )
114113 . iter( )
115114 . map( |o| repr_item( o. clone( ) , vm) )
116115 . collect:: <PyResult <Vec <_>>>( ) ?
@@ -153,7 +152,7 @@ impl PyGenericAlias {
153152 #[ pymethod( magic) ]
154153 fn dir ( & self , vm : & VirtualMachine ) -> PyResult < PyList > {
155154 let dir = vm. dir ( Some ( self . origin ( ) ) ) ?;
156- for exc in ATTR_EXCEPTIONS . iter ( ) {
155+ for exc in & ATTR_EXCEPTIONS {
157156 if !dir. contains ( ( * exc) . to_pyobject ( vm) , vm) ? {
158157 dir. append ( ( * exc) . to_pyobject ( vm) ) ;
159158 }
@@ -198,7 +197,7 @@ fn is_typevar(obj: &PyObjectRef) -> bool {
198197
199198fn make_parameters ( args : & PyTupleRef , vm : & VirtualMachine ) -> PyTupleRef {
200199 let mut parameters: Vec < PyObjectRef > = Vec :: with_capacity ( args. len ( ) ) ;
201- for arg in args. as_slice ( ) {
200+ for arg in args {
202201 if is_typevar ( arg) {
203202 if !parameters. iter ( ) . any ( |param| param. is ( arg) ) {
204203 parameters. push ( arg. clone ( ) ) ;
@@ -208,7 +207,7 @@ fn make_parameters(args: &PyTupleRef, vm: &VirtualMachine) -> PyTupleRef {
208207 . get_attr ( "__parameters__" , vm)
209208 . and_then ( |obj| PyTupleRef :: try_from_object ( vm, obj) )
210209 {
211- for subparam in subparams. as_slice ( ) {
210+ for subparam in & subparams {
212211 if !parameters. iter ( ) . any ( |param| param. is ( subparam) ) {
213212 parameters. push ( subparam. clone ( ) ) ;
214213 }
@@ -222,7 +221,7 @@ fn make_parameters(args: &PyTupleRef, vm: &VirtualMachine) -> PyTupleRef {
222221
223222#[ inline]
224223fn tuple_index ( tuple : & PyTupleRef , item : & PyObjectRef ) -> Option < usize > {
225- tuple. as_slice ( ) . iter ( ) . position ( |element| element. is ( item) )
224+ tuple. iter ( ) . position ( |element| element. is ( item) )
226225}
227226
228227fn subs_tvars (
@@ -240,7 +239,6 @@ fn subs_tvars(
240239 . map ( |sub_params| {
241240 if sub_params. len ( ) > 0 {
242241 let sub_args = sub_params
243- . as_slice ( )
244242 . iter ( )
245243 . map ( |arg| {
246244 if let Some ( idx) = tuple_index ( params, arg) {
@@ -290,7 +288,6 @@ pub fn subs_parameters<F: Fn(&VirtualMachine) -> PyResult<String>>(
290288 }
291289
292290 let new_args = args
293- . as_slice ( )
294291 . iter ( )
295292 . map ( |arg| {
296293 if is_typevar ( arg) {
@@ -370,7 +367,7 @@ impl Hashable for PyGenericAlias {
370367
371368impl GetAttr for PyGenericAlias {
372369 fn getattro ( zelf : PyRef < Self > , attr : PyStrRef , vm : & VirtualMachine ) -> PyResult {
373- for exc in ATTR_EXCEPTIONS . iter ( ) {
370+ for exc in & ATTR_EXCEPTIONS {
374371 if * ( * exc) == attr. to_string ( ) {
375372 return vm. generic_getattribute ( zelf. as_object ( ) . to_owned ( ) , attr) ;
376373 }
0 commit comments