Marcos Schroh created AVRO-3950:
-----------------------------------
Summary: [rust] Some code when checking schema compatibility is
never reached
Key: AVRO-3950
URL: https://issues.apache.org/jira/browse/AVRO-3950
Project: Apache Avro
Issue Type: Improvement
Reporter: Marcos Schroh
When checking schema compatibility between schemas some code blocks are never
reached. For example, [this lines
|https://github.com/apache/avro/tree/main/lang/rust/avro/src#L365-L373] are
never reached because writer and readers schemas are for sure the same type
(record) which is [previously
compared|https://github.com/apache/avro/tree/main/lang/rust/avro/src#L346].
This issue leads to add unnecessary *if let* blocks which can be suppressed and
`Error` that are never reached. For example the following code could be
removed because it is know before hand that the schema is Record which it has a
name and only one error can be retrieved.
{code}
let Schema::Record(RecordSchema { name: w_name, .. }) = writers_schema { ... }
{code}
*Solution*: Refactor the code and add more unittest to match_schemas function
to clean up the unreachable code
--
This message was sent by Atlassian Jira
(v8.20.10#820010)