diff --git a/src/errors/types.rs b/src/errors/types.rs index d3a6cdebb..57025f9b5 100644 --- a/src/errors/types.rs +++ b/src/errors/types.rs @@ -56,15 +56,12 @@ fn field_from_context<'py, T: FromPyObject<'py>>( .map_err(|_| py_error_type!(PyTypeError; "{}: '{}' context value must be a {}", enum_name, field_name, type_name_fn())) } -fn cow_field_from_context<'py, T: FromPyObject<'py>, B: ?Sized + 'static>( +fn cow_field_from_context<'py, T: FromPyObject<'py>, B: ToOwned + ?Sized + 'static>( context: Option<&Bound<'py, PyDict>>, field_name: &str, enum_name: &str, _type_name_fn: fn() -> &'static str, -) -> PyResult> -where - B: ToOwned, -{ +) -> PyResult> { let res: T = field_from_context(context, field_name, enum_name, || { type_name::().split("::").last().unwrap() })?; diff --git a/src/serializers/ser.rs b/src/serializers/ser.rs index 170cd1849..50f006e7b 100644 --- a/src/serializers/ser.rs +++ b/src/serializers/ser.rs @@ -236,23 +236,17 @@ where self.serialize_str(variant) } - fn serialize_newtype_struct(self, _name: &'static str, value: &T) -> Result - where - T: Serialize, - { + fn serialize_newtype_struct(self, _name: &'static str, value: &T) -> Result { value.serialize(self) } - fn serialize_newtype_variant( + fn serialize_newtype_variant( self, _name: &'static str, _variant_index: u32, variant: &'static str, value: &T, - ) -> Result - where - T: Serialize, - { + ) -> Result { tri!(self .formatter .begin_object(&mut self.writer) diff --git a/src/validators/arguments.rs b/src/validators/arguments.rs index 63ef36d7f..075bc009e 100644 --- a/src/validators/arguments.rs +++ b/src/validators/arguments.rs @@ -64,7 +64,6 @@ impl BuildValidator for ArgumentsValidator { .map(|py_str| py_str.to_str()) .transpose()? .unwrap_or("positional_or_keyword"); - let positional = mode == "positional_only" || mode == "positional_or_keyword"; if positional { positional_params_count = arg_index + 1;