29 Commits

Author SHA1 Message Date
Scott Schafer
d36c326926
chore(deps): update rust crate annotate-snippets to 0.12.1 2025-09-02 15:43:38 -06:00
Ross Sullivan
92d9a94d02
chore: Migrated testsuite to testsuite::prelude 2025-06-25 22:37:24 +09:00
Ed Page
d2ec764995 fix(resolve): Dont show locking workspace members
This is for `cargo generate-lockfile` and when syncing the lockfile with
the manifest.
We still show it for `cargo update` because of `cargo update
--workspace`.

We hacked around this previously by filtering out the `num_pkgs==1` case
for single packages but this didn't help with workspaces.
2024-08-22 16:57:06 -05:00
Ed Page
5b9799c6f4 refactor: Migrate from extern crate to test-support prelude
We now include the prelude in so many places, this simplifies how we can
present how `cargo-test-support` works.

Yes, this included some `use` clean ups but its already painful enough
walking through every test file, I didn't want to do it twice.
2024-07-12 15:57:00 -05:00
eth3lbert
6c4d59c296
test: migrate lints_table to snapbox 2024-06-19 17:17:02 +08:00
Ed Page
dc5ac62cab fix(test): Deprecate non-snapbox assertions
While this is noisy and hides other deprecations, I figured deprecations would
make it easier for people to discover what tasks remain and allow us to
divide and conquer this work rather than doing a heroic PR.
In theory, this will be short lived and we'll go back to seeing
deprecations in our tests.
2024-06-10 10:20:52 -05:00
Urgau
1e4857a4d9 Allow lint config to have extra custom configs
And report the unused manifest key warning for every key that we do not
use, which is currently every of them.
2024-05-16 17:03:42 +02:00
Scott Schafer
6f81cff16c
refactor: Move lint specific tests to lints/mod.rs 2024-05-08 15:18:49 -06:00
Scott Schafer
6c2334613c
fix(lints): Prevent inheritance from bring exposed for published packages 2024-05-02 15:37:53 -06:00
Scott Schafer
6c08e58de9
feat(cargo-lints): Add a lint for unknown_lints 2024-05-01 10:45:09 -06:00
Scott Schafer
9159ebb083
fix(cargo-lints): Don't rewrite dash to underscore in lint name 2024-05-01 10:41:35 -06:00
bors
6fc9e4b9a1 Auto merge of #13805 - Muscraft:im-a-teapot-lint-unstable, r=epage
Error when unstable lints are specified but not enabled

In [#13797, it was noted that](https://github.com/rust-lang/cargo/pull/13797#discussion_r1578162057) 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
![No inherit](https://github.com/rust-lang/cargo/assets/23045215/c245af87-8623-42dc-9652-be461809bb30)
Inherited
![Inhrtited](https://github.com/rust-lang/cargo/assets/23045215/5a90b7c9-0e9e-4a07-ab0e-e2e43cca8991)
2024-05-01 13:59:51 +00:00
Scott Schafer
712946c518
fix(lints): Mark the test_dummy_unstable lint group as unstable 2024-04-30 20:35:50 -06:00
Scott Schafer
f007527291
fix(lints): Mark the im_a_teapot lint as unstable 2024-04-30 20:34:17 -06:00
Scott Schafer
2df02f07d8
fix(lints): Feature-gate the im_a_teapot lint 2024-04-30 20:31:12 -06:00
Scott Schafer
72f265b22d
refactor: Warn not Error on unsupported lint tool 2024-04-30 10:46:07 -06:00
Scott Schafer
cbb1cd2382
test(cargo-lints): Add a test to ensure cap-lints works 2024-04-29 10:36:29 -06:00
Scott Schafer
cf197fc499
fix(cargo-lints): Don't always inherit workspace lints 2024-04-26 16:37:41 -06:00
Scott Schafer
c3b104e11e
test(cargo-lints): Show workspace lints always inherited 2024-04-26 16:26:36 -06:00
Scott Schafer
dfc9bd2068
feat(lints): Add where lint level was set 2024-04-24 14:57:36 -06:00
Scott Schafer
2655b069c6
test(cargo-lints): Add a test for workspace inheritance 2024-04-24 14:48:48 -06:00
Scott Schafer
11d6013c1d
fix(cargo-lints): Respect Forbid lint level 2024-04-20 20:12:47 -06:00
Scott Schafer
2d40a475d9
feat: Add unstable im_a_teapot lint 2024-04-20 19:33:13 -06:00
Scott Schafer
8d676dde40
feat(implicit_features): Show why lint was emiited 2024-04-19 11:41:28 -06:00
Scott Schafer
495f94e80e
refactor(implicit_features): Use lint description for title 2024-04-19 10:58:55 -06:00
Ed Page
1876326b6b feat(resolve): Tell the user the style of resovle done
This is to help with #9930

Example changes:
```diff
-[LOCKING] 4 packages
+[LOCKING] 4 packages to latest version
-[LOCKING] 2 packages
+[LOCKING] 2 packages to latest Rust 1.60.0 compatible versions
-[LOCKING] 2 packages
+[LOCKING] 2 packages to earliest versions
```

Benefits
- The package count is of "added" packages and this makes that more
  logically clear
- This gives users transparency into what is happening, especially with
  - what rust-version is use
  - the transition to this feature in the new edition
  - whether the planned config was applied or not (as I don't want it to
    require an MSRV bump)
- Will make it easier in tests to show what changed
- Provides more motiviation to show this message in `cargo update` and
  `cargo install` (that will be explored in a follow up PR)

This does come at the cost of more verbose output but hopefully not too
verbose.  This is why I left off other factors, like avoid-dev-deps.
2024-04-13 20:39:59 -05:00
Scott Schafer
0a400d5ef0
refactor: Make lint names snake_case 2024-03-25 12:44:12 -06:00
Scott Schafer
abf0953292
feat: Add -Zcargo-lints 2024-03-23 10:24:50 -06:00
Scott Schafer
31c3052524
refactor(testsuite): Rename lints to lints_table 2024-03-22 11:33:58 -06:00