Skip to content

Questions about restrictions lint following update to clippy 0.1.67 #10244

@SylvainDe

Description

@SylvainDe

Summary

I am very new to Rust and thus, new to clippy and I've had troubles after updating clippy to version 0.1.67 (probably from version 0.1.65 or so) but this may show problems with my workflow more than problems with clippy itself.

  1. My first question is about Warn when clippy::restriction is enabled via the command line #9755 .

Previously, in order to get the most out of clippy, I've tried to enable every single check I could. This involved using a super long list of arguments: "-D clippy::correctness (...) -D clippy::restriction" and then a "whitelist" for restrictions check that I want to allow: "-A clippy::indexing_slicing -A clippy::integer_arithmetic -A clippy::arithmetic_side_effects (...)".
My idea was that if there were any checks added to clippy, they would be enabled by default and if they were to fail: I'd have to decide between adding the check to the list of lints allowed or fix things in my code (and learn something about good practices).

Now, it looks like using "-D clippy::restriction" is somehow forbidden and I do not quite understand the reasoning. Is using "-D clippy::restriction" with an explicit list of allowed lints frowned upon ? If so, should I instead maintained a list of disallowed lints and update it regularly based on the list of new checks in the documentation ? (I've tried to do this in a very tedious way before realising that I should have just used "-A clippy::blanket_clippy_restriction_lints".

  1. My second question is about 2 fairly new lints: clippy::semicolon_inside_block and clippy::semicolon_outside_block

The documentation can be found on:

As per the explanation above, I've tried to run every single lint including these 2 lints which are according to the documentation added in 1.66.0. However, they seem to be unknown on my version.

$ cargo clippy --version clippy 0.1.67 (fc594f1 2023-01-24) 

then

$ cargo clippy -- -D clippy::semicolon_outside_block Checking aoc v0.1.0 (/home/desodtsy/Documents/Geekage/aoc/rust) error[E0602]: unknown lint: `clippy::semicolon_outside_block` | = note: requested on the command line with `-D clippy::semicolon_outside_block` For more information about this error, try `rustc --explain E0602`. 

then

$ cargo clippy -- -D clippy::semicolon_inside_block Checking aoc v0.1.0 (/home/desodtsy/Documents/Geekage/aoc/rust) error[E0602]: unknown lint: `clippy::semicolon_inside_block` | = note: requested on the command line with `-D clippy::semicolon_inside_block` For more information about this error, try `rustc --explain E0602`. 

Reproducer

No response

Version

$ rustc -Vv rustc 1.67.0 (fc594f156 2023-01-24) binary: rustc commit-hash: fc594f15669680fa70d255faec3ca3fb507c3405 commit-date: 2023-01-24 host: x86_64-unknown-linux-gnu release: 1.67.0 LLVM version: 15.0.6 

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions