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

chore(crates): address lint errs when rust is at 1.77+ #2474

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

vdice
Copy link
Member

@vdice vdice commented Apr 25, 2024

A few lint errors block successfully running the lint and test targets locally when on a more recent version of rust than is pinned in Spin/CI. Hoping these updates are compatible with both scenarios...

Signed-off-by: Vaughn Dice <vaughn.dice@fermyon.com>
@vdice vdice force-pushed the chore/fix-lints-rust-1.77 branch from 2083a39 to 6696a0d Compare April 25, 2024 20:19
@vdice vdice merged commit efac5cf into fermyon:main Apr 25, 2024
17 checks passed
@vdice vdice deleted the chore/fix-lints-rust-1.77 branch April 25, 2024 23:38
@@ -86,7 +86,7 @@ impl BadgerRecordManager {
let new = BadgerRecord {
name: name.to_owned(),
badgered_from: from.clone(),
badgered_to: to.iter().map(|v| <semver::Version>::clone(v)).collect(),
badgered_to: to.iter().cloned().map(<semver::Version>::clone).collect(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the call to map still necessary?

Copy link
Member Author

@vdice vdice Apr 26, 2024

Choose a reason for hiding this comment

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

Oh, it could prove not to be! I admit I just did the barebones lint-suggested thing to get it to not error.

Copy link
Contributor

@fibonacci1729 fibonacci1729 Apr 26, 2024

Choose a reason for hiding this comment

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

I had the same thought yesterday but when i looked into it i started to believe that this is a false positive map_clone lint (=> rust-lang/rust-clippy#12271). I.e. removing the map yields an type error on the resulting collection.

A few things we could do but i'm not sure which is best:

  1. Drop the cloned and attach #[allow(clippy::map_clone)] to this line
  2. Keep as is and attach a note to remove the cloned whenever the false positive fix lands in rust proper (if it hasn't alread) just requires a rust version bump 🤷‍♂️ .

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.

4 participants