diff --git a/lang/rust/avro/tests/validators.rs b/lang/rust/avro/tests/validators.rs index 941ffc3e7d7..fc45353a8d6 100644 --- a/lang/rust/avro/tests/validators.rs +++ b/lang/rust/avro/tests/validators.rs @@ -28,35 +28,35 @@ use apache_avro_test_helper::TestResult; struct CustomValidator; -#[test] -fn avro_3900_custom_validator_with_spec_invalid_names() -> TestResult { - // Setup the custom validators before the schema is parsed - // because the parsing will trigger the validation and will - // setup the default validator (SpecificationValidator)! - impl SchemaNameValidator for CustomValidator { - fn validate(&self, schema_name: &str) -> AvroResult<(String, Namespace)> { - Ok((schema_name.to_string(), None)) - } +// Setup the custom validators before the schema is parsed +// because the parsing will trigger the validation and will +// setup the default validator (SpecificationValidator)! +impl SchemaNameValidator for CustomValidator { + fn validate(&self, schema_name: &str) -> AvroResult<(String, Namespace)> { + Ok((schema_name.to_string(), None)) } +} - impl SchemaNamespaceValidator for CustomValidator { - fn validate(&self, _ns: &str) -> AvroResult<()> { - Ok(()) - } +impl SchemaNamespaceValidator for CustomValidator { + fn validate(&self, _ns: &str) -> AvroResult<()> { + Ok(()) } +} - impl EnumSymbolNameValidator for CustomValidator { - fn validate(&self, _ns: &str) -> AvroResult<()> { - Ok(()) - } +impl EnumSymbolNameValidator for CustomValidator { + fn validate(&self, _ns: &str) -> AvroResult<()> { + Ok(()) } +} - impl RecordFieldNameValidator for CustomValidator { - fn validate(&self, _ns: &str) -> AvroResult<()> { - Ok(()) - } +impl RecordFieldNameValidator for CustomValidator { + fn validate(&self, _ns: &str) -> AvroResult<()> { + Ok(()) } +} +#[test] +fn avro_3900_custom_validator_with_spec_invalid_names() -> TestResult { assert!(set_schema_name_validator(Box::new(CustomValidator)).is_ok()); assert!(set_schema_namespace_validator(Box::new(CustomValidator)).is_ok()); assert!(set_enum_symbol_name_validator(Box::new(CustomValidator)).is_ok()); diff --git a/lang/rust/avro_test_helper/src/lib.rs b/lang/rust/avro_test_helper/src/lib.rs index 5e1e04b50ae..e316dc818d4 100644 --- a/lang/rust/avro_test_helper/src/lib.rs +++ b/lang/rust/avro_test_helper/src/lib.rs @@ -23,7 +23,7 @@ thread_local! { // The unit tests run in parallel // We need to keep the log messages in a thread-local variable // and clear them after assertion - pub(crate) static LOG_MESSAGES: RefCell> = RefCell::new(Vec::new()); + pub(crate) static LOG_MESSAGES: RefCell> = const { RefCell::new(Vec::new()) }; } pub mod logger;