-
Notifications
You must be signed in to change notification settings - Fork 123
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
Cleanup with more clippy lints #336
Conversation
c5ad908
to
dadcae9
Compare
17842a1
to
d27e81c
Compare
20eb729
to
50c30b3
Compare
@@ -217,7 +217,7 @@ pub mod space_separated_scopes { | |||
D: de::Deserializer<'de>, | |||
{ | |||
let scopes: &str = Deserialize::deserialize(d)?; | |||
Ok(scopes.split_whitespace().map(|x| x.to_owned()).collect()) | |||
Ok(scopes.split_whitespace().map(ToOwned::to_owned).collect()) |
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.
I learned a new thing :)
@@ -210,6 +210,7 @@ macro_rules! define_idtypes { | |||
/// Only returns `true` in case the given string is valid | |||
/// according to that specific ID (e.g., some may require | |||
/// alphanumeric characters only). | |||
#[must_use] |
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.
Just out of curiosity, these functions are all must_use
?
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.
What do you mean? Yes, I marked all of them with must_use because clippy told me to, and it makes sense.
MinValence(x) => x.to_string(), | ||
MaxValence(x) => x.to_string(), | ||
TargetValence(x) => x.to_string(), | ||
MinAcousticness(x) |
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.
Cool, Huge work!
@@ -5,7 +5,7 @@ use std::collections::HashMap; | |||
use serde::Serialize; | |||
use std::marker::PhantomData; | |||
|
|||
pub(crate) fn build_map<'key, 'value, const N: usize>( | |||
pub fn build_map<'key, 'value, const N: usize>( |
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.
Will this change the visibility from crate
public to globally public?
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.
Because the entire module is already public to the crate only. No need to do that again.
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.
In summary, clippy
is a great mentor.
This PR is ready to merge, but the |
That's weird... Maybe try disabling the adblocker or something like that? I'll merge myself. |
Description
This PR cleans up a lot of code thanks to the clippy lints described in #204.
Cargo.toml
(categories
field)#[must_use]
Self
where possibleOffset
constructorsMotivation and Context
Some code is overly complex or not well annotated.
Dependencies
None
Type of change
Please delete options that are not relevant.
How has this been tested?
CI still passes
Is this change properly documented?
Yes