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 rustc & clippy warnings for nightly (2021-09-16) #629

Merged
merged 2 commits into from
Sep 22, 2021

Conversation

sharnoff
Copy link
Member

@sharnoff sharnoff commented Sep 18, 2021

Clippy/rustc commit rust-lang/rust@e4828d5b7

There's a few additional warnings that currently pop up on nightly (not sure exactly when they started), some from rustc itself and some from clippy.

Perhaps there's a better solution to handling the unused fields in IdentifySystem, but I'm not sure what it is right now. I think it does make sense for that struct to be left as-is, given that rust-postgres doesn't provide an IDENTIFY_SYSTEM interface.

Clippy/rustc commit e4828d5b7
Copy link
Contributor

@hlinnaka hlinnaka left a comment

Choose a reason for hiding this comment

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

Perhaps there's a better solution to handling the unused fields in IdentifySystem, but I'm not sure what it is right now. I think it does make sense for that struct to be left as-is, given that rust-postgres doesn't provide an IDENTIFY_SYSTEM interface.

Why does it consider IdentifySystem as unused? It is printed here:

    let identify = identify_system(&mut rclient)?;
    info!("{:?}", identify);

Is that info!-line not enough? Perhaps we should print out the individual fields in that message. And maybe downgradi it to 'trace' while we're at it.

Adds a comment about the change from 2021-09-11 that causes the fields
of `IdentifySystem` to be marked as unused, even though we log the
entire struct.
@sharnoff
Copy link
Member Author

sharnoff commented Sep 20, 2021

@hlinnaka Hmm, you're right. After looking into it a little further, it seems like it's related to this issue: rust-lang/rust#88900.

There's some debate about whether that change actually should have been made, but the tl;dr about why it's there is essentially: "a field isn't used if it's only read as part of a Debug impl". In the meantime, I've added a comment describing why we have #[allow(dead_code)] and linking to the issue.

@sharnoff sharnoff merged commit 90ef661 into main Sep 22, 2021
@stepashka stepashka deleted the fix-clippy-nightly branch January 11, 2022 15:12
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