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

[tech] Update to clippy 1.50.0 #744

Merged
merged 1 commit into from
Feb 12, 2021
Merged

[tech] Update to clippy 1.50.0 #744

merged 1 commit into from
Feb 12, 2021

Conversation

woshilapin
Copy link
Contributor

No description provided.

@@ -239,25 +239,25 @@ impl IntoTime for &str {
}
}

pub trait IntoDate {
fn into_date(&self) -> Date;
pub trait IntoDate: Copy {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A clippy lint was complaining about naming a function into_*() while not taking self. At first, I thought we might make an exception but at the same time, the trait IntoTime takes self but IntoDate takes &self so I found that was inconsistent.

However, since fn calendar() takes a &[impl IntoDate], it was impossible to get ownership in this case... unless making IntoDate also Copy. That what I did but I'm open for discussion and alternative. At the very least, I don't want to hide this change 😄
cc @antoine-de

Copy link
Contributor

Choose a reason for hiding this comment

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

Hum I don't know, it might be a hard requirement on the Trait 🤔

maybe we can just rename the Trait to AsDate (and have a as_date(&self) method)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about that too but .as_date() is not really correct either for the &str implementation since a new object is created in this case.

I thought about Copy since I didn't expect any other implementation than Date, &Date and &str which are all Copy.

In the end, I'm fine with either solution.

Copy link
Contributor

Choose a reason for hiding this comment

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

since Date is Copy I don't think it's important if a as_ returns a Date and not a &Date is it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed it for AsDate.

@antoine-de antoine-de merged commit 2a36414 into master Feb 12, 2021
@antoine-de antoine-de deleted the clippy-1.50.0 branch February 12, 2021 09:21
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.

2 participants