Skip to content

Allow unknown lints#688

Closed
tcharding wants to merge 1 commit intorust-bitcoin:masterfrom
tcharding:unknown-lints
Closed

Allow unknown lints#688
tcharding wants to merge 1 commit intorust-bitcoin:masterfrom
tcharding:unknown-lints

Conversation

@tcharding
Copy link
Copy Markdown
Member

@tcharding tcharding commented Nov 4, 2021

We support many versions of rustc by design, this puts us in the following predicament:

  1. Linting with a newer version of clippy throws a warning for a newly introduced default lint.
  2. In order to allow the lint we must use the lint by name but this lint does not exist in earlier versions of clippy, so we get a warning unknown lint when linting with the earlier version.

We want to have our cake and eat it too, we can do this by allowing unknown lints. Doing so enables (1) while preventing (2).

This will help us introduce clippy into the CI pipeline because we can better control lint output for different versions of the toolchain.

Before this patch was applied cargo +1.36 check emits:

warning: unknown lint: `broken_intra_doc_links`

With this patch applied the warning is removed.

I have also raised PRs, doing the same thing, in:

We support many versions of rustc by design, this puts us in the
following predicament:

1. Linting with a newer version of clippy throws a warning for a newly
introduced default lint.
2. In order to allow the lint we must use the lint by name but this lint
does not exist in earlier versions of clippy, so we get a warning
`unknown lint` when linting with the earlier version.

We want to have our cake and eat it too, we can do this by allowing
unknown lints. Doing so enables (1) while preventing (2).

This will help us introduce clippy into the CI pipeline because we can
better control lint output for different versions of the toolchain.

Before this patch was applied `cargo +1.36 check` emits:

    warning: unknown lint: `broken_intra_doc_links`

With this patch applied the warning is removed.
@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented Nov 5, 2021

I believe it's best to just lint with the newest version in CI. clippy knows MSRV, so that shouldn't be a problem except for bugs like rust-lang/rust-clippy#7922 which can be dealt with case-by-case.
I slightly prefer not allow-ing unknown lints because it makes troubleshooting difficult.

@tcharding
Copy link
Copy Markdown
Member Author

tcharding commented Nov 5, 2021

I believe it's best to just lint with the newest version in CI. clippy knows MSRV, so that shouldn't be a problem except for bugs like rust-lang/rust-clippy#7922 which can be dealt with case-by-case.

Ok, paraphrasing just to make sure I get you. The idea would be to add clippy.toml with our current MSRV then run cargo +stable check in CI. That makes sense and totally removes the need for this PR.

I slightly prefer not allow-ing unknown lints because it makes troubleshooting difficult.

Do you mean when trying to debug code with a certain toolchain version?

@tcharding
Copy link
Copy Markdown
Member Author

Based of @Kixunil's ideas above this PR is not needed. Please excuse the noise.

@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented Nov 6, 2021

You understood correctly, I already added that clippy.toml in my PR.

By not allow-ing we catch mistakes in the lint names.

@tcharding tcharding deleted the unknown-lints branch August 17, 2023 02:48
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