ink icon indicating copy to clipboard operation
ink copied to clipboard

Add global clippy rules

Open cmichi opened this issue 4 years ago • 3 comments

This issue is blocked by https://github.com/rust-lang/cargo/issues/5034.

We want to have some global clippy rules.

bool_assert_comparison

Allows syntax a la:

assert_eq!(flipper.get(), false);
assert_eq!(flipper.get(), true);

This is the bool_assert_comparison rule, which should be allowed.

With https://github.com/paritytech/ink/pull/884 we unfortunately had to change assert_eq!(flipper.get(), false); to assert!(!flipper.get());. These assert!(!…) expressions should be reverted to the boolean comparison.

new_without_default

For example, our flipper example in readme is currently no valid if you run clippy on it, since it misses a Default implementation for Flipper. This should not be necessary.

cmichi avatar Aug 04 '21 08:08 cmichi

To unblock you: https://crates.io/crates/cargo-lints

gilescope avatar Sep 03 '21 16:09 gilescope

Some lints can also be configured in a clippy.toml: https://github.com/rust-lang/rust-clippy#configuration.

Not sure if this is applicable here.

cmichi avatar Nov 08 '21 15:11 cmichi

Have a look at substrate/.cargo/config.toml - since june this works. It's currently the only way to do it out of the box.

gilescope avatar Nov 15 '21 07:11 gilescope