@@ -346,7 +346,7 @@ pub(crate) mod decl {
346
346
impl ParamSpec {
347
347
#[ pymethod( magic) ]
348
348
fn mro_entries ( & self , _bases : PyObjectRef , vm : & VirtualMachine ) -> PyResult {
349
- Err ( vm. new_type_error ( "Cannot subclass an instance of ParamSpec" . to_owned ( ) ) )
349
+ Err ( vm. new_type_error ( "Cannot subclass an instance of ParamSpec" ) )
350
350
}
351
351
352
352
#[ pygetset( magic) ]
@@ -483,16 +483,14 @@ pub(crate) mod decl {
483
483
if let Some ( name) = kwargs. swap_remove ( "name" ) {
484
484
name
485
485
} else {
486
- return Err ( vm . new_type_error (
487
- "ParamSpec() missing required argument: 'name' (pos 1)" . to_owned ( ) ,
488
- ) ) ;
486
+ return Err (
487
+ vm . new_type_error ( "ParamSpec() missing required argument: 'name' (pos 1)" )
488
+ ) ;
489
489
}
490
490
} else if args. args . len ( ) == 1 {
491
491
args. args [ 0 ] . clone ( )
492
492
} else {
493
- return Err (
494
- vm. new_type_error ( "ParamSpec() takes at most 1 positional argument" . to_owned ( ) )
495
- ) ;
493
+ return Err ( vm. new_type_error ( "ParamSpec() takes at most 1 positional argument" ) ) ;
496
494
} ;
497
495
498
496
let bound = kwargs. swap_remove ( "bound" ) ;
@@ -524,15 +522,11 @@ pub(crate) mod decl {
524
522
525
523
// Check for invalid combinations
526
524
if covariant && contravariant {
527
- return Err (
528
- vm. new_value_error ( "Bivariant type variables are not supported." . to_owned ( ) )
529
- ) ;
525
+ return Err ( vm. new_value_error ( "Bivariant type variables are not supported." ) ) ;
530
526
}
531
527
532
528
if infer_variance && ( covariant || contravariant) {
533
- return Err ( vm. new_value_error (
534
- "Variance cannot be specified with infer_variance" . to_owned ( ) ,
535
- ) ) ;
529
+ return Err ( vm. new_value_error ( "Variance cannot be specified with infer_variance" ) ) ;
536
530
}
537
531
538
532
// Handle default value
@@ -653,12 +647,12 @@ pub(crate) mod decl {
653
647
654
648
#[ pymethod( magic) ]
655
649
fn mro_entries ( & self , _bases : PyObjectRef , vm : & VirtualMachine ) -> PyResult {
656
- Err ( vm. new_type_error ( "Cannot subclass an instance of TypeVarTuple" . to_owned ( ) ) )
650
+ Err ( vm. new_type_error ( "Cannot subclass an instance of TypeVarTuple" ) )
657
651
}
658
652
659
653
#[ pymethod( magic) ]
660
654
fn typing_subst ( & self , _arg : PyObjectRef , vm : & VirtualMachine ) -> PyResult {
661
- Err ( vm. new_type_error ( "Substitution of bare TypeVarTuple is not supported" . to_owned ( ) ) )
655
+ Err ( vm. new_type_error ( "Substitution of bare TypeVarTuple is not supported" ) )
662
656
}
663
657
664
658
#[ pymethod( magic) ]
@@ -685,15 +679,13 @@ pub(crate) mod decl {
685
679
name
686
680
} else {
687
681
return Err ( vm. new_type_error (
688
- "TypeVarTuple() missing required argument: 'name' (pos 1)" . to_owned ( ) ,
682
+ "TypeVarTuple() missing required argument: 'name' (pos 1)" ,
689
683
) ) ;
690
684
}
691
685
} else if args. args . len ( ) == 1 {
692
686
args. args [ 0 ] . clone ( )
693
687
} else {
694
- return Err ( vm. new_type_error (
695
- "TypeVarTuple() takes at most 1 positional argument" . to_owned ( ) ,
696
- ) ) ;
688
+ return Err ( vm. new_type_error ( "TypeVarTuple() takes at most 1 positional argument" ) ) ;
697
689
} ;
698
690
699
691
let default = kwargs. swap_remove ( "default" ) ;
@@ -755,7 +747,7 @@ pub(crate) mod decl {
755
747
8000
code>
impl ParamSpecArgs {
756
748
#[ pymethod( magic) ]
757
749
fn mro_entries ( & self , _bases : PyObjectRef , vm : & VirtualMachine ) -> PyResult {
758
- Err ( vm. new_type_error ( "Cannot subclass an instance of ParamSpecArgs" . to_owned ( ) ) )
750
+ Err ( vm. new_type_error ( "Cannot subclass an instance of ParamSpecArgs" ) )
759
751
}
760
752
761
753
#[ pygetset( magic) ]
@@ -834,7 +826,7 @@ pub(crate) mod decl {
834
826
impl ParamSpecKwargs {
835
827
#[ pymethod( magic) ]
836
828
fn mro_entries ( & self , _bases : PyObjectRef , vm : & VirtualMachine ) -> PyResult {
837
- Err ( vm. new_type_error ( "Cannot subclass an instance of ParamSpecKwargs" . to_owned ( ) ) )
829
+ Err ( vm. new_type_error ( "Cannot subclass an instance of ParamSpecKwargs" ) )
838
830
}
839
831
840
832
#[ pygetset( magic) ]
0 commit comments