159 Commits

Author SHA1 Message Date
Ed Page
21c0928638 fix(fix): Ensure optional dep is available for dep-features 2024-06-05 16:00:39 -05:00
Ed Page
078383bd0f fix(fix): Dont remove features when making implicit features explicit 2024-06-05 15:27:00 -05:00
Ed Page
fbe1cd1ab7 test(fix): Show the dep-feature behavior 2024-06-05 15:09:29 -05:00
Ed Page
fa14a13618 test(fix): Simplify existing-table test
We already have a test that covers each dep type; we don't need to cover
that here.
2024-06-05 15:08:22 -05:00
Ed Page
1b51d170fe tests(fix): Clarify role of dependencies 2024-06-05 12:03:24 -05:00
Ed Page
c009b3208d tests(fix): Snapshot fixes 2024-06-05 11:59:50 -05: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
Ed Page
3054936cab refactor: Port from assert_matches_exact to assert_e2e
This leaves off `validate_crate_contents` as that would be an effort on
its own
2024-05-29 14:08:10 -05:00
surechen
1c8da38a5c Fix test error in https://github.com/rust-lang/rust/pull/125533
As lint dropping_copy_types will give suggsetion in this
situation.(Changed in https://github.com/rust-lang/rust/pull/125433)
2024-05-25 23:49:13 +08:00
Ed Page
627b1d1470 feat(fix): Migrate inherited deps with ignored default-features 2024-05-01 12:43:47 -05:00
Ed Page
10012ce9cf test(fix): Show default-features migration 2024-05-01 12:30:57 -05:00
bors
6087566b3f Auto merge of #13792 - weihanglo:fix-in-rust-src, r=ehuss
fix(cargo-fix): dont fix into standard library
2024-04-30 20:45:20 +00:00
Ed Page
a71b8fecf3 feat(fix): Migrate underscore toml fields 2024-04-25 13:22:06 -05:00
Ed Page
bcf032e5be test(fix): Show underscore field migration 2024-04-25 12:44:53 -05:00
Weihang Lo
0810627891
fix(cargo-fix): dont fix into standard library
This takes a more aggressive approach by stop any write into sysroot.
2024-04-23 11:52:22 -04:00
Weihang Lo
8410c1e99d
test(fix): verify cargo might fix into rust-src
The suggestion is slightly tweaked since the original
diagnostic was rejected due to multiple files were involved.

For the original diagnostic JSON, see
https://github.com/rust-lang/rust/issues/88514#issuecomment-2043469384
2024-04-23 09:41:14 -04:00
Scott Schafer
064184a2bb
feat(fix): Add features for unused deps on Edition 2024 2024-04-19 11:43:39 -06:00
Ed Page
cbd9def9dc feat(fix): Migrate from project to package on Edition 2024 2024-04-15 13:33:28 -05:00
Ed Page
98298d4966 feat(fix): Report manifest migrations 2024-04-15 13:33:27 -05:00
Ed Page
d5606b2278 test(fix): Show current project/package behavior 2024-04-15 13:32:17 -05: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
Weihang Lo
95edc06e5b
fix(rustfix): dont apply same suggestion twice
This assumes that if any of the machine applicable fixes in
a diagnostic suggestion is a duplicate, we should see the
entire suggestion as a duplicate.
2024-04-10 11:54:33 -04:00
Weihang Lo
5b05a3bb5a
test(rustfix): demonstrate duplicate suggestions 2024-04-10 11:53:37 -04:00
Ed Page
4ab2797f36 feat(lock): Print lockfile changes on all commands 2024-03-12 13:39:56 -05:00
Ed Page
14646e6af6 test: Make edition explicit on packages 2024-02-22 11:37:03 -06:00
Ed Page
e7e8d8748a fix(compiler): Clarify we're showing a profile name 2024-02-08 14:01:39 -06:00
Oli Scherer
e60678fae0 Relax a test to permit warnings to be emitted, too.
This change is necessary to allow rustc to actually start emitting the warning about the unused `mut`
2024-02-07 15:16:40 +00:00
Esteban Küber
88bafd161e Change tests to support changes to suggestion
`rustc` will start marking the suggestions for prefacing unused bindings
with underscores as "maybe incorrect", which makes them no longer auto
applicable by `rustfix`.

Change done at https://github.com/rust-lang/rust/pull/120470.
2024-02-01 03:47:27 +00:00
Eric Huss
e7eaa51909 cargo fix: Call rustc fewer times.
This changes `cargo fix` so that it keeps track of the output so that it
doesn't need to run the final "show the output" step.
2024-01-02 15:03:06 -08:00
Eric Huss
8ffd9cd86f Add tests validating the sequence for cargo fix.
This adds a set of tests which validates various edge cases around how
`cargo fix` works in terms of calling `rustc` multiple times. This uses
a replacement of `rustc` so it doesn't depend on the behavior of rustc
itself which is not always stable.
2024-01-02 14:54:41 -08:00
Eric Huss
1ef1b7e313 Fix fix::fix_in_dependency to not rely on rustc 2023-12-29 12:56:23 -08:00
Adrian
b7b5a093a1
Fix cargo errors counter 2023-11-29 18:47:14 +02:00
belovdv
6b86f93713 remove jobserver in shim for tests in testsuite/fix 2023-11-29 15:30:58 +03:00
Eric Huss
2eac6f5c0c Fix clippy-wrapper test race condition. 2023-11-18 17:23:29 -08:00
hi-rustin
08169fd015 Add rustc_shim_for_cargo_fix and wrapped_clippy_driver to reuse code
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-04-14 11:23:41 +08:00
hi-rustin
47f6e2ddc9 Add broken_clippy_fixes_backed_out
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-04-14 10:46:53 +08:00
Adrián Ortiz
db457d950f Fixing issue https://github.com/rust-lang/cargo/issues/10834:
- Adding display of which target failed to compile
- Consistent messages for warnings/errors.
- Fixing assertions on related tests.
2023-03-07 06:45:26 +01:00
Scott Schafer
9c14193764 chore: update fix tests to use check 2023-02-20 12:21:15 -06:00
hi-rustin
21b2fe98a4 Fix fix_in_existing_repo_weird_ignore broken test
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-11-26 20:15:36 +08:00
hi-rustin
3189dc3b06 Include untracked files
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-11-26 20:15:36 +08:00
hi-rustin
25f7d4b09a Remove new_repo_without_add_and_commit
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-11-26 20:15:36 +08:00
hi-rustin
89b8a8bb10 Suppress error with --allow-dirty and add a test
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-11-26 20:15:36 +08:00
Eric Huss
1c3640e05c Add requirements to cargo_test. 2022-07-30 19:36:58 -07:00
Scott Schafer
c239e407e7 add a reason to masquerade_as_nightly_cargo so it is searchable 2022-07-15 21:32:23 -05:00
Scott Schafer
4bc8fe85bd remove unneeded nightly flags from various tests 2022-07-14 19:55:44 -05:00
Weihang Lo
d813739c76
test: make tests compatible when force using argfile 2022-04-10 22:23:20 +08:00
Eric Huss
88117505b8 Bump to 0.59.0 2021-10-22 07:53:17 -07:00
Weihang Lo
0565dafd87
Skip all cargo fix that tends to write to registry cache. 2021-09-23 23:31:10 +08:00
Eric Huss
7a6377092c Make --force-warn support auto-detect. 2021-08-31 22:24:02 -07:00
Eric Huss
46450d6e3a Change cargo fix --edition to only fix edition lints. 2021-08-27 11:28:03 -07:00