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: warning cleanup #1055

Merged
merged 4 commits into from
Jan 8, 2025
Merged

chore: warning cleanup #1055

merged 4 commits into from
Jan 8, 2025

Conversation

AuHau
Copy link
Member

@AuHau AuHau commented Dec 30, 2024

I was fed up with so long build logs full of warnings, so did small cleanup mainly for UnusedImports, during which I discovered an actually bug in Nim: nim-lang/Nim#24552

There are a few more areas that would be good to clean up that I listed here: #1054

Unfortunately this PR mainly helped the Test's build logs, where there were lot of unused imports. For normal compile logs the main source of the warnings is from Chronos's async-raises and deprected cid that I skipped for now.

Copy link
Member

@gmega gmega left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanup! Left a couple of comments but otherwise LGTM.

@@ -10,7 +10,8 @@ import ./errored
import ./cancelled
import ./failed
import ./proving
import ./provingsimulated
import ./provingsimulated # used in tests
{.push warning[UnusedImport]:off.}
Copy link
Member

Choose a reason for hiding this comment

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

Hm... why do we have an import that's used only in tests inside of a production module? Shouldn't we keep this warning around and address that instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because we need to have some way how to bypass the "normal proving" module, as generating normal proofs in tests would take too long, and we also need a way to control how and when proving should fail. This functionality is hidden behind compile flag (see here: https://github.com/codex-storage/nim-codex/pull/1055/files/c7074e42d82fe32fee7056eab1fd0e2e8cb9e942#diff-c422f0a891c99abb9c168acd1d6d88f2bd50b0571521e10fb5668a759a9e0e0dR56) so it is not really shipped in production.

I originally tried to move the import in "local import" fashion to the when below, but that does not work in Nim, but you gave me an idea to just add when to the import then ;-)


{.push warning[UnusedImport]: on.}
import std/terminal # Is not used in tests
{.pop.}
Copy link
Member

Choose a reason for hiding this comment

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

Ugh... OK. I guess this points out that we should have a config that's specific to tests, but OK, maybe not worth the trouble for a single module.

@AuHau AuHau enabled auto-merge January 7, 2025 08:26
@AuHau AuHau added this pull request to the merge queue Jan 8, 2025
Merged via the queue into master with commit 407f778 Jan 8, 2025
17 checks passed
@AuHau AuHau deleted the chore/cleanup-warnings branch January 8, 2025 12:39
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