Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

bradjc
Copy link
Contributor

@bradjc bradjc commented Jul 11, 2024

Pull Request Overview

This one is maybe more subjective. The lint says:

an implementation of From is preferred since it gives you Into<_> for free where the reverse isn't true

So maybe we should advocate for From?

Testing Strategy

cargo clippy

TODO or Help Wanted

Is there a good reason to only use Into in certain cases and we shouldn't turn on this lint?

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

@github-actions github-actions bot added chips/nrf Change pertains to the nRF5x family of MCUs. chips/stm32 Change pertains to the stm32 family of MCUSs labels Jul 11, 2024
@lschuermann
Copy link
Member

To me this is pretty uncontroversial. It's definitely more idiomatic to implement From<>. From the Rust standard library documentation:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

@lschuermann lschuermann added the last-call Final review period for a pull request. label Jul 12, 2024
@lschuermann lschuermann self-assigned this Jul 12, 2024
@ppannuto ppannuto added this pull request to the merge queue Jul 12, 2024
@bradjc bradjc merged commit 669e8bb into master Jul 12, 2024
@bradjc bradjc deleted the clippy-from-over-into branch July 12, 2024 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chips/nrf Change pertains to the nRF5x family of MCUs. chips/stm32 Change pertains to the stm32 family of MCUSs last-call Final review period for a pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants