Merged
Conversation
Collaborator
|
r? @weihanglo rustbot has assigned @weihanglo. Use |
epage
reviewed
Apr 24, 2024
| gctx: &GlobalContext, | ||
| ) -> CargoResult<()> { | ||
| let manifest = pkg.manifest(); | ||
| let lint_level = IM_A_TEAPOT.level(lints, manifest.edition()); |
Contributor
There was a problem hiding this comment.
IM_A_TEAPOT should be an unstable lint that we hide (when it comes to that)
Contributor
Contributor
17 tasks
epage
reviewed
Apr 24, 2024
Comment on lines
+89
to
120
| let edition_level = self | ||
| .edition_lint_opts | ||
| .filter(|(e, _)| edition >= *e) | ||
| .map(|(_, l)| l); | ||
|
|
||
| if self.default_level == LintLevel::Forbid || edition_level == Some(LintLevel::Forbid) { | ||
| return LintLevel::Forbid; | ||
| } | ||
|
|
||
| let level = self | ||
| .groups | ||
| .iter() | ||
| .map(|g| g.name) | ||
| .chain(std::iter::once(self.name)) | ||
| .filter_map(|n| lints.get(n).map(|l| (n, l))) | ||
| .max_by_key(|(n, l)| (l.priority(), std::cmp::Reverse(*n))); | ||
| .max_by_key(|(n, l)| { | ||
| ( | ||
| l.level() == TomlLintLevel::Forbid, | ||
| l.priority(), | ||
| std::cmp::Reverse(*n), | ||
| ) | ||
| }); | ||
|
|
||
| match level { | ||
| Some((_, toml_lint)) => toml_lint.level().into(), | ||
| None => { | ||
| if let Some((lint_edition, lint_level)) = self.edition_lint_opts { | ||
| if edition >= lint_edition { | ||
| return lint_level; | ||
| } | ||
| if let Some(level) = edition_level { | ||
| level | ||
| } else { | ||
| self.default_level | ||
| } | ||
| self.default_level | ||
| } |
Contributor
There was a problem hiding this comment.
The implementation for default and edition exists in two places. We should do this in one place.
Contributor
Contributor
|
☀️ Test successful - checks-actions |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 26, 2024
Update cargo 9 commits in c9392675917adc2edab269eea27c222b5359c637..b60a1555155111e962018007a6d0ef85207db463 2024-04-23 19:35:19 +0000 to 2024-04-26 16:37:29 +0000 - fix(toml): Remove underscore field support in 2024 (rust-lang/cargo#13804) - fix: emit 1.77 syntax error only when msrv is incompatible (rust-lang/cargo#13808) - docs(ref): Index differences between virtual / real manifests (rust-lang/cargo#13794) - refactor(toml): extract dependency-to-source-id to function (rust-lang/cargo#13802) - Add where lint was set (rust-lang/cargo#13801) - fix(toml): Don't double-warn when underscore is used in workspace dep (rust-lang/cargo#13800) - fix(toml): Be more forceful with underscore/dash redundancy (rust-lang/cargo#13798) - Fix warning suppression for config.toml vs config compat symlinks (rust-lang/cargo#13793) - Cleanup linting system (rust-lang/cargo#13797) r? ghost
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 27, 2024
Update cargo 9 commits in c9392675917adc2edab269eea27c222b5359c637..b60a1555155111e962018007a6d0ef85207db463 2024-04-23 19:35:19 +0000 to 2024-04-26 16:37:29 +0000 - fix(toml): Remove underscore field support in 2024 (rust-lang/cargo#13804) - fix: emit 1.77 syntax error only when msrv is incompatible (rust-lang/cargo#13808) - docs(ref): Index differences between virtual / real manifests (rust-lang/cargo#13794) - refactor(toml): extract dependency-to-source-id to function (rust-lang/cargo#13802) - Add where lint was set (rust-lang/cargo#13801) - fix(toml): Don't double-warn when underscore is used in workspace dep (rust-lang/cargo#13800) - fix(toml): Be more forceful with underscore/dash redundancy (rust-lang/cargo#13798) - Fix warning suppression for config.toml vs config compat symlinks (rust-lang/cargo#13793) - Cleanup linting system (rust-lang/cargo#13797) r? ghost
bors
added a commit
that referenced
this pull request
May 1, 2024
Error when unstable lints are specified but not enabled In [#13797, it was noted that](#13797 (comment)) the `im-a-teapot` lint should always be unstable. This PR makes it so that `im-a-teapot` is unstable, and it is an error to specify it without the `test-dummy-unstable` cargo feature. It does this by adding a `feature-gate` field to `Lint` and `LintGroup` that optionally puts the lint/lint group behind a feature. The `feature-gate` is then checked during the new `analyze_cargo_lints_table` step that runs across all lints (and groups) specified in `[lints.cargo]` or `[workspace.lints]` if the package is inheriting its lints from a workspace. The error looks like the following: No inherit  Inherited 
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are a number of problems with the current linting system, most notably that lints could run without
-Zcargo-lintsbeing set. This PR fixes that issue and a few others that are low-hanging fruit.