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 clippy and audit warnings #667

Merged
merged 7 commits into from
Jan 20, 2021
Merged

Fix clippy and audit warnings #667

merged 7 commits into from
Jan 20, 2021

Conversation

pradovic
Copy link
Collaborator

@pradovic pradovic commented Jan 14, 2021

cargo clippy and cargo audit have some new warnings since the new version. This is an attempt to simply fix those.

Copy link
Collaborator

@koivunej koivunej left a comment

Choose a reason for hiding this comment

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

Some comments we already discussed, before your latest push

crates/interledger-btp/src/packet.rs Outdated Show resolved Hide resolved
crates/interledger-packet/src/address.rs Outdated Show resolved Hide resolved
Comment on lines 200 to 203
fn normalize_scale(&self, details: ConvertDetails) -> Result<Self::Item, ()>;
fn normalize_scale(
&self,
details: ConvertDetails,
) -> Result<Self::Item, Box<dyn std::error::Error + 'static>>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah it looks like a public trait, but interledger-settlement is only 0.3 so this is much easier breaking change.

As this will be a public api going forward and regardless of anyone using it, I'd collect the common issues to an enum ConversionError if there are more than just the Overflow case? I cannot at least see one; strange that there is no underflow or the normalization returning zero.

Then again, it'd seem that this is used to unwrap..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree, let's go for en enum then. I will see if there is a few possible errors and address map them in enum. If not, I will just make a struct for an ConversionError

Copy link
Collaborator Author

@pradovic pradovic Jan 15, 2021

Choose a reason for hiding this comment

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

There is no more specific conversion errors at the moment. In the other file crypto.rs there has been a case of a two different errors being handled by the same unit error (). I have replaced those to one single error similar to here as well, because it was also used to unwrap, and there were no specific branches of different errors (because there was not any). I would omit adding different errors in this iterations, probably better in some future PR when/if we change these functions as well.
Anyway, I have just added the struct ConversionError here, and did the same in other places where the unit error was used. Hope it makes sense :)

@pradovic pradovic changed the title Fix clippy warnings Fix clippy and audit warnings Jan 15, 2021
Copy link
Collaborator

@koivunej koivunej left a comment

Choose a reason for hiding this comment

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

Changes look good, and commits look good! I haven't kept up with the circleci errors, but it looks like we must go ahead with local checks only. I checked that at least the cargo test --workspace --all-features works.

@pradovic
Copy link
Collaborator Author

@koivunej Thanks for checking! I checked cargo audit and cargo clippy ones as well, and they appear to be correct.

@koivunej
Copy link
Collaborator

koivunej commented Jan 19, 2021

Oki, I am thinking we should just merge this ahead, or have the 24h grace period as usual starting from now. I am for waiting, as there seems to be no rush.

@koivunej
Copy link
Collaborator

@emschwartz could you relax the merging requirements as the circleci is now defunct? Please see #669 for the next steps.

@koivunej
Copy link
Collaborator

An alternative to getting this in would be to make disable other than the clippy for example in circleci for now and go with a lighter, fix the build by migrating to github actions in the next PR.

@pradovic
Copy link
Collaborator Author

pradovic commented Jan 20, 2021

I have included a working circleCI changes, and re-enabled the clippy and audit checks. Can I merge this one without 24h warning, so we can unblock other PRs?

@koivunej
Copy link
Collaborator

Yeah lets go ahead and merge, the 24h grace period already passed!

@pradovic pradovic merged commit d81d99c into interledger:master Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants