This is an automated email from the ASF dual-hosted git repository. Kriskras99 pushed a commit to branch chore/dead_code in repository https://gitbox.apache.org/repos/asf/avro-rs.git
commit 0bcf808c6d8a1a97bea2955bca0241b99dd5c3d2 Author: Kriskras99 <[email protected]> AuthorDate: Fri Sep 4 21:44:54 2026 +0200 chore: Remove code that is no longer needed --- avro/tests/schema.rs | 32 ------------------------------- avro/tests/to_from_avro_datum_schemata.rs | 8 +------- avro_test_helper/src/lib.rs | 5 ----- 3 files changed, 1 insertion(+), 44 deletions(-) diff --git a/avro/tests/schema.rs b/avro/tests/schema.rs index 2da2924..1419138 100644 --- a/avro/tests/schema.rs +++ b/avro/tests/schema.rs @@ -32,13 +32,11 @@ use apache_avro::{ use apache_avro_test_helper::{ TestResult, data::{DOC_EXAMPLES, OTHER_ATTRIBUTES_EXAMPLES, examples, valid_examples}, - init, }; use serde::{Deserialize, Serialize}; #[test] fn test_correct_recursive_extraction() -> TestResult { - init(); let raw_outer_schema = r#"{ "type": "record", "name": "X", @@ -89,7 +87,6 @@ fn test_correct_recursive_extraction() -> TestResult { #[test] fn test_parse() -> TestResult { - init(); for (raw_schema, valid) in examples().iter() { let schema = Schema::parse_str(raw_schema); if *valid { @@ -109,7 +106,6 @@ fn test_parse() -> TestResult { #[test] fn test_3799_parse_reader() -> TestResult { - init(); for (raw_schema, valid) in examples().iter() { let schema = Schema::parse_reader(&mut Cursor::new(raw_schema)); if *valid { @@ -167,7 +163,6 @@ fn test_3799_raise_io_error_from_parse_read() -> Result<(), String> { #[test] /// Test that the string generated by an Avro Schema object is, in fact, a valid Avro schema. fn test_valid_cast_to_string_after_parse() -> TestResult { - init(); for (raw_schema, _) in valid_examples().iter() { let schema = Schema::parse_str(raw_schema)?; Schema::parse_str(schema.canonical_form().as_str())?; @@ -179,7 +174,6 @@ fn test_valid_cast_to_string_after_parse() -> TestResult { /// Test that a list of schemas whose definitions do not depend on each other produces the same /// result as parsing each element of the list individually fn test_parse_list_without_cross_deps() -> TestResult { - init(); let schema_str_1 = r#"{ "name": "A", "type": "record", @@ -208,7 +202,6 @@ fn test_parse_list_without_cross_deps() -> TestResult { /// the schemas are input. /// However, the output order is guaranteed to be the same as the input order. fn test_parse_list_with_cross_deps_basic() -> TestResult { - init(); let schema_a_str = r#"{ "name": "A", "type": "record", @@ -236,7 +229,6 @@ fn test_parse_list_with_cross_deps_basic() -> TestResult { #[test] fn test_parse_list_recursive_type() -> TestResult { - init(); let schema_str_1 = r#"{ "name": "A", "doc": "A's schema", @@ -263,7 +255,6 @@ fn test_parse_list_recursive_type() -> TestResult { #[test] /// Test that schema composition resolves namespaces. fn test_parse_list_with_cross_deps_and_namespaces() -> TestResult { - init(); let schema_a_str = r#"{ "name": "A", "type": "record", @@ -292,7 +283,6 @@ fn test_parse_list_with_cross_deps_and_namespaces() -> TestResult { #[test] /// Test that schema composition fails on namespace errors. fn test_parse_list_with_cross_deps_and_namespaces_error() -> TestResult { - init(); let schema_str_1 = r#"{ "name": "A", "type": "record", @@ -321,7 +311,6 @@ fn test_parse_list_with_cross_deps_and_namespaces_error() -> TestResult { // <https://issues.apache.org/jira/browse/AVRO-3216> // test that field's RecordSchema could be referenced by a following field by full name fn test_parse_reused_record_schema_by_fullname() -> TestResult { - init(); let schema_str = r#" { "type" : "record", @@ -436,7 +425,6 @@ fn permutation_indices(indices: Vec<usize>) -> Vec<Vec<usize>> { /// Test that a type that depends on more than one other type is parsed correctly when all /// definitions are passed in as a list. This should work regardless of the ordering of the list. fn test_parse_list_multiple_dependencies() -> TestResult { - init(); let schema_a_str = r#"{ "name": "A", "type": "record", @@ -474,7 +462,6 @@ fn test_parse_list_multiple_dependencies() -> TestResult { /// Test that a type that is depended on by more than one other type is parsed correctly when all /// definitions are passed in as a list. This should work regardless of the ordering of the list. fn test_parse_list_shared_dependency() -> TestResult { - init(); let schema_a_str = r#"{ "name": "A", "type": "record", @@ -513,7 +500,6 @@ fn test_parse_list_shared_dependency() -> TestResult { #[test] /// Test that trying to parse two schemas with the same fullname returns an Error fn test_name_collision_error() -> TestResult { - init(); let schema_str_1 = r#"{ "name": "foo.A", "type": "record", @@ -537,7 +523,6 @@ fn test_name_collision_error() -> TestResult { #[test] /// Test that having the same name but different fullnames does not return an error fn test_namespace_prevents_collisions() -> TestResult { - init(); let schema_str_1 = r#"{ "name": "A", "type": "record", @@ -588,7 +573,6 @@ fn test_namespace_prevents_collisions() -> TestResult { #[test] fn test_fullname_name_and_namespace_specified() -> TestResult { - init(); let name: Name = serde_json::from_str(r#"{"name": "a", "namespace": "o.a.h", "aliases": null}"#)?; let fullname = name.fullname(None); @@ -598,7 +582,6 @@ fn test_fullname_name_and_namespace_specified() -> TestResult { #[test] fn test_fullname_fullname_and_namespace_specified() -> TestResult { - init(); let name: Name = serde_json::from_str(r#"{"name": "a.b.c.d", "namespace": "o.a.h"}"#)?; assert_eq!(name.name(), "d"); assert_eq!(name.namespace(), Some("a.b.c")); @@ -609,7 +592,6 @@ fn test_fullname_fullname_and_namespace_specified() -> TestResult { #[test] fn test_fullname_name_and_default_namespace_specified() -> TestResult { - init(); let name: Name = serde_json::from_str(r#"{"name": "a", "namespace": null}"#)?; assert_eq!(name.name(), "a"); assert_eq!(name.namespace(), None); @@ -620,7 +602,6 @@ fn test_fullname_name_and_default_namespace_specified() -> TestResult { #[test] fn test_fullname_fullname_and_default_namespace_specified() -> TestResult { - init(); let name: Name = serde_json::from_str(r#"{"name": "a.b.c.d", "namespace": null}"#)?; assert_eq!(name.name(), "d"); assert_eq!(name.namespace(), Some("a.b.c")); @@ -631,7 +612,6 @@ fn test_fullname_fullname_and_default_namespace_specified() -> TestResult { #[test] fn test_avro_3452_parsing_name_without_namespace() -> TestResult { - init(); let name: Name = serde_json::from_str(r#"{"name": "a.b.c.d"}"#)?; assert_eq!(name.name(), "d"); assert_eq!(name.namespace(), Some("a.b.c")); @@ -642,7 +622,6 @@ fn test_avro_3452_parsing_name_without_namespace() -> TestResult { #[test] fn test_avro_3452_parsing_name_with_leading_dot_without_namespace() -> TestResult { - init(); let name: Name = serde_json::from_str(r#"{"name": ".a"}"#)?; assert_eq!(name.name(), "a"); assert_eq!(name.namespace(), None); @@ -652,7 +631,6 @@ fn test_avro_3452_parsing_name_with_leading_dot_without_namespace() -> TestResul #[test] fn test_avro_3452_parse_json_without_name_field() -> TestResult { - init(); let result: serde_json::error::Result<Name> = serde_json::from_str(r#"{"unknown": "a"}"#); assert!(&result.is_err()); assert_eq!(result.unwrap_err().to_string(), "No `name` field"); @@ -661,7 +639,6 @@ fn test_avro_3452_parse_json_without_name_field() -> TestResult { #[test] fn test_fullname_fullname_namespace_and_default_namespace_specified() -> TestResult { - init(); let name: Name = serde_json::from_str(r#"{"name": "a.b.c.d", "namespace": "o.a.a", "aliases": null}"#)?; assert_eq!(name.name(), "d"); @@ -673,7 +650,6 @@ fn test_fullname_fullname_namespace_and_default_namespace_specified() -> TestRes #[test] fn test_fullname_name_namespace_and_default_namespace_specified() -> TestResult { - init(); let name: Name = serde_json::from_str(r#"{"name": "a", "namespace": "o.a.a", "aliases": null}"#)?; assert_eq!(name.name(), "a"); @@ -685,7 +661,6 @@ fn test_fullname_name_namespace_and_default_namespace_specified() -> TestResult #[test] fn test_doc_attributes() -> TestResult { - init(); fn assert_doc(schema: &Schema) { match schema { Schema::Enum(EnumSchema { doc, .. }) => assert!(doc.is_some()), @@ -746,7 +721,6 @@ fn test_avro_old_93_other_attributes() -> TestResult { #[test] fn test_root_error_is_not_swallowed_on_parse_error() -> Result<(), String> { - init(); let raw_schema = "/not/a/real/file"; let error = Schema::parse_str(raw_schema).unwrap_err().into_details(); @@ -765,7 +739,6 @@ fn test_root_error_is_not_swallowed_on_parse_error() -> Result<(), String> { // AVRO-3302 #[test] fn test_record_schema_with_cyclic_references() -> TestResult { - init(); let schema = Schema::parse_str( r#" { @@ -833,7 +806,6 @@ fn test_record_schema_with_cyclic_references() -> TestResult { // https://github.com/flavray/avro-rs/issues/47 #[test] fn avro_old_issue_47() -> TestResult { - init(); let schema_str = r#" { "type": "record", @@ -2052,7 +2024,6 @@ fn test_avro_3851_read_default_value_for_enum() -> TestResult { #[test] fn avro_rs_66_test_independent_canonical_form_primitives() -> TestResult { - init(); let record_primitive = r#"{ "name": "Rec", "namespace": "ns", @@ -2153,7 +2124,6 @@ fn avro_rs_66_test_independent_canonical_form_primitives() -> TestResult { #[test] fn avro_rs_66_test_independent_canonical_form_usages() -> TestResult { - init(); let record_primitive = r#"{ "name": "Rec", "namespace": "ns", @@ -2291,7 +2261,6 @@ fn avro_rs_66_test_independent_canonical_form_usages() -> TestResult { #[test] fn avro_rs_66_test_independent_canonical_form_deep_recursion() -> TestResult { - init(); let record_primitive = r#"{ "name": "Rec", "namespace": "ns", @@ -2359,7 +2328,6 @@ fn avro_rs_66_test_independent_canonical_form_deep_recursion() -> TestResult { #[test] fn avro_rs_66_test_independent_canonical_form_missing_ref() -> TestResult { - init(); let record_primitive = r#"{ "name": "Rec", "namespace": "ns", diff --git a/avro/tests/to_from_avro_datum_schemata.rs b/avro/tests/to_from_avro_datum_schemata.rs index 0849367..a6bcbd1 100644 --- a/avro/tests/to_from_avro_datum_schemata.rs +++ b/avro/tests/to_from_avro_datum_schemata.rs @@ -18,7 +18,7 @@ use apache_avro::reader::datum::GenericDatumReader; use apache_avro::writer::datum::GenericDatumWriter; use apache_avro::{Codec, Reader, Schema, Writer, types::Value}; -use apache_avro_test_helper::{TestResult, init}; +use apache_avro_test_helper::TestResult; static SCHEMA_A_STR: &str = r#"{ "name": "A", @@ -38,8 +38,6 @@ static SCHEMA_B_STR: &str = r#"{ #[test] fn test_avro_3683_multiple_schemata_to_from_avro_datum() -> TestResult { - init(); - let record: Value = Value::Record(vec![( String::from("field_b"), Value::Record(vec![(String::from("field_a"), Value::Float(1.0))]), @@ -68,8 +66,6 @@ fn test_avro_3683_multiple_schemata_to_from_avro_datum() -> TestResult { #[test] fn avro_rs_106_test_multiple_schemata_to_from_avro_datum_with_resolution() -> TestResult { - init(); - let record: Value = Value::Record(vec![( String::from("field_b"), Value::Record(vec![(String::from("field_a"), Value::Float(1.0))]), @@ -100,8 +96,6 @@ fn avro_rs_106_test_multiple_schemata_to_from_avro_datum_with_resolution() -> Te #[test] fn test_avro_3683_multiple_schemata_writer_reader() -> TestResult { - init(); - let record: Value = Value::Record(vec![( String::from("field_b"), Value::Record(vec![(String::from("field_a"), Value::Float(1.0))]), diff --git a/avro_test_helper/src/lib.rs b/avro_test_helper/src/lib.rs index 28c017d..7c752b5 100644 --- a/avro_test_helper/src/lib.rs +++ b/avro_test_helper/src/lib.rs @@ -62,8 +62,3 @@ impl<Err: Display + Debug> From<Err> for TestError { } pub type TestResult = Result<(), TestError>; - -/// Does nothing. Just loads the crate. -/// Should be used in the integration tests, because they do not use [dev-dependencies] -/// and do not auto-load this crate. -pub const fn init() {}
