risechain / pevm

Blazingly fast Parallel EVM
MIT License
227 stars 47 forks source link

Remove all #![allow(...)] #419

Closed MuhtasimTanmoy closed 3 days ago

MuhtasimTanmoy commented 1 week ago

Closes https://github.com/risechain/pevm/issues/410

i1i1 commented 1 week ago

I think there is no workaround for this allow(unused_crate_dependencies). The issue is related to 2 things:

So #![allow(unused_crate_dependencies)] in each of the tests is probably the best workaround.

Of course tests can be squashed and that would make only 1 allow on the very toplevel.

WDUT?

hai-rise commented 1 week ago

These false positives are very noisy so I'd vote to remove unused_crate_dependencies if there's no clean workaround. Can replace it with cargo-machete in the CI but practically, at the current scale we can manually bump and audit dependencies per every Reth or our own release.

i1i1 commented 1 week ago

Makes sense! False positives are annoying.

Can we make an issue for cargo machete or generally for checking unused dependencies? I think it is really important to keep track of it and keep the repo in shape

hai-rise commented 1 week ago

Okay, I've opened #420 and @MuhtasimTanmoy let's remove the unused_crate_dependencies lint in this PR 🙏.

MuhtasimTanmoy commented 5 days ago

Done.

What this config #![cfg_attr(test, allow(unused_crate_dependencies))] in crates/pevm/src/lib.rs does?

hai-rise commented 5 days ago

What this config #![cfg_attr(test, allow(unused_crate_dependencies))] in crates/pevm/src/lib.rs does?

It allows unused_crate_dependencies for tests which we can also remove now that we've turned off the lint.

@MuhtasimTanmoy CI is failing for missing docs. It'd be more appropriate for us to add them so let's keep the allow in for now, and just make this PR remove unused_crate_dependencies. What do you think 🙏?

MuhtasimTanmoy commented 5 days ago

It allows unused_crate_dependencies for tests which we can also remove now that we've turned off the lint.

Done.

Total 63 missing docs. Can we go for bare minimum doc? I was sort of going through the codebase. You can provide some context to some of them.

hai-rise commented 5 days ago

Can we go for bare minimum doc?

@MuhtasimTanmoy Yes, that should work for now as the missing ones are only in test/bench anyway. There's existing // that can be quickly converted to /// too 🙏.

MuhtasimTanmoy commented 5 days ago

Going for this approach then.

MuhtasimTanmoy commented 4 days ago

Done.

Only two left with warnings during documenting macros.

The following lines giving warning: missing documentation for a function

criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);

After converting to

/// Benchmark
criterion_group!(benches, benchmark_gigagas);

Warning persists.

/// Benchmark
| ^^^^^^^^^^^^^ rustdoc does not generate documentation for macro invocations

May be missing something.

MuhtasimTanmoy commented 3 days ago

@hai-rise Cant document macro invocation. Also, it's library provided. Any insight?

Context:

i1i1 commented 3 days ago

Hey @MuhtasimTanmoy! Thanks again for working on this :pray:

I think we can't do much about macro invocation, so lets just #[allow(missing_docs)] and merge it for now.

I've tried to fix it and it seems it requires some workaround like follows:

-criterion_group!(benches, criterion_benchmark); 
-criterion_main!(benches);
+#[allow(missing_docs)]
+mod benches {
+    use super::*;
+    criterion_group!(benches, criterion_benchmark);
+}
+
+criterion_main!(benches::benches);

Could you do smth like this and just add some comment like // HACK: we can't document public items inside of the macro? :pray:

MuhtasimTanmoy commented 3 days ago

Ok, I @i1i1

I got a similar solution on StackOverflow from my question as well.

MuhtasimTanmoy commented 3 days ago

Done.

MuhtasimTanmoy commented 3 days ago

Sure. Should have checked.