-
Notifications
You must be signed in to change notification settings - Fork 220
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
Fix clippy lints #346
Conversation
* 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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
The periodic CI run from #344 found some clippy lints.
From
overInto
: clippy::from-over-intoas_
: clippy::wrong-self-convention