François Garillot created ARROW-7692:
----------------------------------------
Summary: [Rust] Several pattern matches are hard to read
Key: ARROW-7692
URL: https://issues.apache.org/jira/browse/ARROW-7692
Project: Apache Arrow
Issue Type: Improvement
Components: Rust
Reporter: François Garillot
Several pattern matches can be rewritten directly using a combinator, e.g.
array's `value_as_date`, more succintly expressed as a `map`:
{{ match self.value_as_datetime(i) {}}
{{ Some(datetime) => Some(datetime.date()),}}
{{ None => None,}}
{{ }}}
More importantly some of these matches obscure what the code is doing, e.g.
parquet column writer `read_fully`'s extraction of a mutable slice:
{{let actual_def_levels = match &mut def_levels {}}
{{ Some(ref mut vec) => Some(&mut vec[..]),}}
{{ None => None,}}
{{ };}}
which can be written, using `as_mut` and `map`, as:
{{let actual_def_levels = def_levels.as_mut().map(|vec| &mut vec[..]);}}
A large # of these are meant to be addressed in
[https://github.com/apache/arrow/pull/6292/files]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)