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 build warnings + clippy errors from latest nightly #686

Merged
merged 11 commits into from
Feb 19, 2021

Conversation

cmichi
Copy link
Collaborator

@cmichi cmichi commented Feb 12, 2021

@cmichi cmichi requested a review from Robbepop February 12, 2021 22:02
@cmichi cmichi changed the title Fix build + clippy warnings from latest nightly Fix build warnings + clippy errors from latest nightly Feb 12, 2021
@cmichi cmichi marked this pull request as draft February 12, 2021 22:35
@cmichi
Copy link
Collaborator Author

cmichi commented Feb 15, 2021

This PR is blocked until ferrilab/funty#3 is fixed.

@Robbepop
Copy link
Collaborator

This PR is blocked until myrrlyn/funty#3 is fixed.

Might be worth of putting together a temporary workaround instead.

.replace("]", "")
.split(", ")
.map(|s| u8::from_str(s).expect("u8 cannot be extracted from str"))
.collect::<Vec<u8>>();
Copy link
Collaborator Author

@cmichi cmichi Feb 16, 2021

Choose a reason for hiding this comment

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

I dislike this hacky way of deserializing, but AFAIK it's the simplest way of getting the inverse of a panic!("{:?}", Vec<u8>). We can get rid of this as soon as panic_any is stablized, which should be with the next stable release soonish.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you create an issue for that so that we do not forget?

@cmichi cmichi marked this pull request as ready for review February 16, 2021 16:45
@TriplEight
Copy link
Contributor

please ignore ci/gitlab/686

@@ -277,7 +277,7 @@ impl EnvInstance {
beneficiary,
transferred: all,
};
panic!(scale::Encode::encode(&res));
panic!("{:?}", scale::Encode::encode(&res));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe this actually should be converted into an unimplemented! with a proper message stating why it is still unimeplemented?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, so I'm not sure.

I mean, even if we implement setting a tombstone, clearing storage, etc. we would still like to return the result of the contract eviction and it seems that panic! is the right way to go.

From my pov your suggestion would just be a semantic change of having something like unimplemented!("we have not yet implemented everything, but anyway here's the result: …") instead and changing that back to panic!(…) once we have implemented it would then be a breaking change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well hopefully this discussion is not needed soon due to the works on the upcoming off-chain environment. :P But since contract termination is not really properly implemented in the current off-chain environment I would not dare to actually just mark it as unimplemented. But yeah let's keep it as it is for now.

.replace("]", "")
.split(", ")
.map(|s| u8::from_str(s).expect("u8 cannot be extracted from str"))
.collect::<Vec<u8>>();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you create an issue for that so that we do not forget?

Copy link
Collaborator

@Robbepop Robbepop left a comment

Choose a reason for hiding this comment

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

LGTM

@cmichi cmichi merged commit 353a840 into master Feb 19, 2021
@cmichi cmichi deleted the cmichi-fix-broken-master-after-latest-nightly branch February 19, 2021 14:29
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.

3 participants