Skip to content

Fix build warnings #599

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

Closed
wants to merge 3 commits into from
Closed

Conversation

D4nte
Copy link
Contributor

@D4nte D4nte commented Apr 20, 2020

I have noticed few build warnings on master and I thought I'd give a go at suppressing them. So far I have not changed any software behaviour, just removed unused parentheses and removed the warning using an allow attribute.

I have justified the used of the allow attribute in the commit.
Do you prefer justifying the use of allow attribute with in code comments?

Also, I assume that we are keeping the used of description() in purpose. Let me know if you'd prefer to see an implementation and use of the Display trait instead (as per Rust's recommendation).

I have not removed the warning warning: field is never read: 'logger' for ChainWatchInterfaceUtil and KeysManager because indeed, it is never read and I cannot seem to grasp why this field is present.

Some guidance would be greatly appreciated 🙂

D4nte added 3 commits April 20, 2020 09:43
As per Rust's convention, this allows the removal of a build
warning.
While `Error::description()` usage is deprecated, it allows
us to define static string slices for the various error messages.
Until more advance formatting is needed, it is better to use `description`
instead of the `Display` trait as recommended
by Rust.

This also removes a build warning.
`ToString::to_string()` should be favored in place of
the deprecated `Error::description()` trait function.
However, using `to_string` adds a heap allocation due to its
use of dynamic type `String`.

It should be noted that std::io::Error provides a richer context
in the `Display` trait implementation in the deprecated
`description` one. By electing to use `description`, we consciously
choose to stay in the stack over usability.

This also removes a build warning.
@D4nte D4nte changed the title Build warnings Fix build warnings Apr 20, 2020
@TheBlueMatt
Copy link
Collaborator

TheBlueMatt commented Apr 20, 2020 via email

@TheBlueMatt
Copy link
Collaborator

#594 was merged, so gonna close this. As for the missing logger reads, those were added cause we figured we'd have something worth logging. We probably do, in fact, have things worth logging, we just never do. I think the right fix is to log something at least at the trace level.

@D4nte D4nte deleted the build-warnings branch April 22, 2020 03:35
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