diff --git a/bindings/python/src/pre_tokenizers.rs b/bindings/python/src/pre_tokenizers.rs index 0fd9e9d40..56219e770 100644 --- a/bindings/python/src/pre_tokenizers.rs +++ b/bindings/python/src/pre_tokenizers.rs @@ -536,10 +536,9 @@ impl PyMetaspace { // If a prepend scheme is provided, set it if let Some(prepend_scheme) = prepend_scheme { - if let Ok(prepend_scheme_enum) = _from_string(prepend_scheme) { - new_instance.set_prepend_scheme(prepend_scheme_enum); - } else { - return Err(err); + match _from_string(prepend_scheme) { + Ok(prepend_scheme_enum) => new_instance.set_prepend_scheme(prepend_scheme_enum), + Err(err) => return Err(err), } } Ok((PyMetaspace {}, new_instance.into()))