-
Notifications
You must be signed in to change notification settings - Fork 70
Various Clippy fixes #2781
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
Various Clippy fixes #2781
Conversation
6e7a0f3 to
728f67e
Compare
hrxi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the names of the clippy warnings that you fix to the commit description?
database/database-value/src/lib.rs
Outdated
| Cow::Borrowed(slice::from_raw_parts( | ||
| self as *const $typ as *const u8, | ||
| mem::size_of::<$typ>(), | ||
| size_of::<$typ>(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the minimum required Rust version for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rust 1.80: rust-lang/rust#123168
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. Sounds a bit annoying to bump up our MSRV just to silence a warning. Perhaps we can simply disable the warning for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by allowing this Clippy lint
| /// * AddStake | ||
| /// The type of transaction, parameters and proof are given in the data field of the transaction. | ||
| /// | ||
| /// The type of transaction, parameters and proof are given in the data field of the transaction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix seems incorrect(?). It looks like it should belong inside the 1..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's part of 1. but being on the next line directly after * AddStake it thinks its part of the list thus needs to be indented up to the same level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both are incorrect, as far as I can tell.
Before, it was part of * AddStake which is clearly incorrect. Afterwards, it's now a free-standing text, but it should be part of the first enumeration item "1.".
I don't know if that can be fixed properly.
If not, perhaps we could reword the text so that
The type of transaction, parameters and proof are given in the data field of the transaction.
can right after the "1."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
| /// * RemoveStake | ||
| /// The type of transaction, parameters and proof are given in the proof field of the transaction. | ||
| /// | ||
| /// The type of transaction, parameters and proof are given in the proof field of the transaction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
| fn from(signature: G1Projective) -> Self { | ||
| let mut buffer = [0u8; SIZE]; | ||
| CanonicalSerialize::serialize_compressed(&signature.into_affine(), &mut &mut buffer[..]) | ||
| CanonicalSerialize::serialize_compressed(&signature.into_affine(), &mut buffer[..]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What warning does this fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the borrowed expression implements the required traits
--> bls/src/types/compressed_signature.rs:96:76
|
96 | CanonicalSerialize::serialize_compressed(&signature.into_affine(), &mut &mut buffer[..])
| ^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut buffer[..]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
728f67e to
fb9ee0b
Compare
e223b8b to
ac7a4f3
Compare
Fixes: unexpected `cfg` condition name: `tokio_unstable` by setting `workspace.lints.rust.unexpected_cfgs` Fixes: doc list item missing indentation Ignore lint until MSVR 1.80: unnecessary qualification of `mem` in `mem::size_of` Fixes: unnecessary qualification of `nimiq_database::mdbx` in `nimiq_database::mdbx::MdbxDatabase` Fixes: the borrowed expression implements the required traits in case of `&mut &mut buffer` The unexpected cfg condition value 'parallel' in the primitives crate will be addressed in a separate PR by @ii-cruz
ac7a4f3 to
b0eff5c
Compare
hrxi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!


Various Clippy fixes with Rust 1.80.
Noticeable changes causing most new Clippy warnings:
size_ofis now part of the prelude Addsize_ofandsize_of_valandalign_ofandalign_of_valto the prelude rust-lang/rust#123168-Zcheck-cfgis now enabled by default Stabilize-Zcheck-cfgas always enabled rust-lang/cargo#13571The unexpected
cfgcondition valueparallelwill be addressed in a separate PR.