findepi commented on code in PR #8417:
URL: https://github.com/apache/arrow-rs/pull/8417#discussion_r2376849398
##########
arrow-schema/src/field.rs:
##########
@@ -1118,6 +1124,19 @@ mod test {
assert!(f1.cmp(&f3).is_lt());
}
+ #[test]
+ #[expect(clippy::needless_borrows_for_generic_args)] // intentional to
exercise various references
+ fn test_field_as_ref() {
+ fn accept_ref(_: impl AsRef<Field>) {}
Review Comment:
Thanks that's a very good point @alamb. That indeed works very well for a
function taking a field.
Does it generalize to a function that takes a collection (iter /
IntoIterator) over any form of field references?
Example: i have locally-owned `Vec<Field>` and want to run a check over them.
Or I have `Fields` from ` Schema`. I want to be able to write a single
function that accepts both, without having to do unnecessary `map`s on the call
sites.
i added a commit showing how this works with AsRef, but maybe can be
achieved without AsRef too?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]