File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -344,23 +344,22 @@ where
344
344
let slot_ident = item_meta. slot_name ( ) ?;
345
345
let slot_name = slot_ident. to_string ( ) ;
346
346
let tokens = {
347
- if slot_name == "new" {
348
- let into_func = quote_spanned ! { ident. span( ) =>
347
+ let into_func = if slot_name == "new" {
348
+ quote_spanned ! { ident. span( ) =>
349
349
:: rustpython_vm:: function:: IntoPyNativeFunc :: into_func( Self :: #ident)
350
- } ;
351
- quote ! {
352
- slots. #slot_ident = Some ( #into_func) ;
353
350
}
354
- } else if slot_name == "buffer" {
355
- let into_func = quote_spanned ! { ident. span( ) =>
356
- :: std:: boxed:: Box :: new( Self :: #ident)
357
- } ;
351
+ } else {
352
+ quote_spanned ! { ident. span( ) =>
353
+ Self :: #ident as _
354
+ }
355
+ } ;
356
+ if slot_name == "new" || slot_name == "buffer" {
358
357
quote ! {
359
358
slots. #slot_ident = Some ( #into_func) ;
360
359
}
361
360
} else {
362
361
quote ! {
363
- slots. #slot_ident. store( Some ( Self :: #ident as _ ) )
362
+ slots. #slot_ident. store( Some ( #into_func ) )
364
363
}
365
364
}
366
365
} ;
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ pub struct PyClassSlots {
67
67
}
68
68
69
69
type BufferFunc =
70
- Box < py_dyn_fn ! ( dyn Fn ( PyObjectRef , & VirtualMachine ) -> PyResult <Box <dyn BufferProtocol >> ) > ;
70
+ fn ( PyObjectRef , & VirtualMachine ) -> PyResult < Box < dyn BufferProtocol > > ;
71
71
72
72
impl PyClassSlots {
73
73
pub fn from_flags ( flags : PyTpFlags ) -> Self {
You can’t perform that action at this time.
0 commit comments