Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy lints #346

Merged
merged 1 commit into from
Jan 7, 2021
Merged

Fix clippy lints #346

merged 1 commit into from
Jan 7, 2021

Conversation

evnu
Copy link
Member

@evnu evnu commented Jan 6, 2021

The periodic CI run from #344 found some clippy lints.

  • Prefer collect() over from_iter(): clippy::from-iter-instead-of-collect
  • Prefer From over Into: clippy::from-over-into
  • Avoid nested match: clippy::collapsible-match
  • Avoid unnecessary wraps: clippy::unnecessary-wraps
  • Obey naming convention of as_: clippy::wrong-self-convention

@evnu evnu requested a review from a team January 6, 2021 21:25
* Prefer collect() over from_iter(): clippy::from-iter-instead-of-collect
* Prefer `From` over `Into`: clippy::from-over-into
* Avoid nested match: clippy::collapsible-match
* Avoid unnecessary wraps: clippy::unnecessary-wraps
* Obey naming convention of `as_`: clippy::wrong-self-convention
@@ -16,14 +16,14 @@ pub use crate::wrapper::{
pub use rustler_sys::{TWinDynNifCallbacks, WIN_DYN_NIF_CALLBACKS};

pub unsafe trait NifReturnable {
unsafe fn as_returned(self, env: Env) -> NifReturned;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clippy advises that as_ should take &self or &mut self (see here). As we want to take ownership here (or am I mistaken?), the function should be prefixed with into_ instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds right to me 👍

codegen_runtime is pub but hidden, so I wouldn't see this as a breaking change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, codegen_runtime is public because it is used by our macros, but is not a documented or stable API outside of that.

@@ -16,14 +16,14 @@ pub use crate::wrapper::{
pub use rustler_sys::{TWinDynNifCallbacks, WIN_DYN_NIF_CALLBACKS};

pub unsafe trait NifReturnable {
unsafe fn as_returned(self, env: Env) -> NifReturned;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, codegen_runtime is public because it is used by our macros, but is not a documented or stable API outside of that.

@evnu evnu merged commit e1f2e02 into rusterlium:master Jan 7, 2021
@evnu evnu deleted the fix-clippy-lints branch January 7, 2021 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants