Commit graph

15082 commits

Author SHA1 Message Date
Eric Huss e7e354c85b Use existing arg_dry_run function.
And drop the `-n` short flag until we decide to commit to using it
generally.
2023-09-19 18:19:53 -07:00
Eric Huss 495ed7ebe2 Add a summary to cargo clean.
This adds a summary at the end when `cargo clean` finishes that displays
how many files and bytes were removed.
2023-09-19 18:16:40 -07:00
Eric Huss 45c5394703 Add a --dry-run option to cargo clean.
This adds a `--dry-run` option to have `cargo clean` display what it
would delete without actually deleting it.
2023-09-19 18:14:47 -07:00
Eric Huss 61e8ef30d9 Wrap clean operations in a CleanContext.
This refactors some of the `cargo clean` code to wrap the "cleaning"
operation in a `CleanContext` so that the context can be passed to other
parts of cargo which can perform their own cleaning operations.

There are some minor changes in the error messages to prepare for
cleaning operations that aren't directly related to the build directory.
2023-09-19 18:14:13 -07:00
bors f9335babbc Auto merge of #12707 - epage:spell, r=ehuss
chore: Fix typos

This is a repeat of #11561
2023-09-19 22:07:03 +00:00
bors 808ffa954e Auto merge of #12678 - Eh2406:shortest_path, r=epage
Shortest path

### What does this PR try to resolve?

Currently error messages from the resolver are based a random path from a package that couldn't be resolved back to the root package. It was pointed out to me that the shortest route is likely to be more useful so the switches to using breadth first search to pick the path. There is also one re-factor to use let-else that I spotted while doing this work.

### How should we test and review this PR?

The shortest path is is a random path, so this is not technically a behavioral change. As such the tests still pass is good evidence for being reasonable.
2023-09-19 21:23:45 +00:00
Jacob Finkelman 679d65103f shortest path is probably more informative than random path for error messages 2023-09-19 20:39:02 +00:00
Ed Page e4e10f2393 chore: Fix typos
This is a repeat of #11561
2023-09-19 15:28:48 -05:00
Jacob Finkelman 2284b7a885 added assertions to make sure the path code is correct in graphs 2023-09-19 20:22:13 +00:00
Jacob Finkelman 245e69ce10 add a test for shortest path 2023-09-19 20:22:13 +00:00
bors 976771d897 Auto merge of #12705 - Turbo87:patch-1, r=epage
doc/reference/manifest: Adjust `keywords` description

This adjusts the naming rules for keywords to match the implemented reality:

aab95692ba/src/models/keyword.rs (L56-L64)

see also:

- https://github.com/rust-lang/rfcs/pull/3488#discussion_r1327466221
- https://github.com/rust-lang/rfcs/pull/3488#discussion_r1327724345
2023-09-19 17:53:54 +00:00
Tobias Bieniek 6a6b5e082a
reference/manifest: Adjust keywords description
This adjusts the naming rules for keywords to match the implemented reality:

aab95692ba/src/models/keyword.rs (L56-L64)
2023-09-19 19:48:36 +02:00
bors 40b78fe5f3 Auto merge of #12702 - Angelin01:refactor-cargo-add-features-display, r=epage
Cargo add displays either feature list or summarized count
2023-09-19 16:34:41 +00:00
Angelo Ross 72dccecb19
Display only feature list or summarized on cargo add 2023-09-19 13:14:44 -03:00
Angelo Ross c25bee16c9
Extract feature suffix formatting to function 2023-09-19 10:21:59 -03:00
bors e4de526f25 Auto merge of #12687 - ehuss:semver-remove-opt-dep, r=epage
SemVer: Update documentation about removing optional dependencies

This updates the documentation cautioning against removing optional dependencies with more up-to-date information about using the `dep:` syntax in the features table. This documentation was written before `dep:`, and I just forgot to update these docs when it was stabilized.
2023-09-18 20:13:24 +00:00
Eric Huss 8fe995f867 SemVer: Update documentation about removing optional dependencies 2023-09-18 12:01:48 -07:00
bors 819fa73b2d Auto merge of #12686 - Turbo87:publish-script, r=epage
publish.py: Remove obsolete `sleep()` calls

`cargo` waits for the package to appear in the index by default these days, so these obsolete extra `sleep()` calls are just making the publish process slower now without any advantages.

see https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/publish.2Epy
2023-09-18 16:32:49 +00:00
bors 4ac43be68a Auto merge of #12685 - eopb:ambiguous-spec-12433, r=epage
generalise suggestion on abiguous spec

Fixes #12433
2023-09-18 15:42:58 +00:00
Tobias Bieniek 49125e9ad8
publish.py: Remove obsolete sleep() calls
`cargo` waits for the package to appear in the index by default these days, so these obsolete extra `sleep()` calls are just making the publish process slower now without any advantages.
2023-09-18 17:40:42 +02:00
Ethan Brierley 9831e83fb2 generalise suggestion on abiguous spec
Fixes #12433
2023-09-18 16:34:17 +01:00
bors 30ce4461d2 Auto merge of #12682 - Turbo87:rename, r=weihanglo
util/toml: Remove duplicate `serde(rename)` attributes

The struct is already using `#[serde(rename_all = "kebab-case")]`, so the rename attributes on the individual fields seems unnecessary.
2023-09-18 09:22:01 +00:00
Tobias Bieniek 6a6ed68823
util/toml: Remove duplicate serde(rename) attributes
The struct is already using `#[serde(rename_all = "kebab-case")]`, so the rename attributes on the individual fields seems unnecessary.
2023-09-18 11:19:53 +02:00
bors b4ddf95ad9 Auto merge of #12680 - tompscanlan:split-debuginfo, r=hi-rustin
doc: differentiate defaults for split-debuginfo

### What does this PR try to resolve?

Documentation of different values for same named option in two different tools.
could fix #12243

### How should we test and review this PR?

Editor review.
2023-09-18 03:48:09 +00:00
bors 695416e8d8 Auto merge of #12660 - epage:dry, r=weihanglo
feat(cli): Add '-n' to dry-run

This came from #12638 and my many small frustrations from wanting to use `-n` and not being able to.

We do not have any existing `-n` flags for this to be confused with.

I would wager that `-n` is such an entrenched short flag in build tools that it would not make sense for us to use it with any other flag.

For a survey of where `-n` is used as a short, see https://www.gnu.org/prep/standards/html_node/Option-Table.html#Option-Table
2023-09-18 02:53:19 +00:00
bors 7149418ed3 Auto merge of #12649 - arlosi:cred-stable, r=weihanglo
feat: stabilize credential-process and registry-auth

Stabilization PR for `registry-auth` and `credential-process`.

Tracking approval of this stabilization is done in the via the FCP in [#8933](https://github.com/rust-lang/cargo/issues/8933#issuecomment-1711990123). This PR is here to help reviewers of the FCP.

* Stabilizes `registry-auth` and `credential-process`
* Makes authenticated registries require a credential provider
* Adds stable documentation for credential providers and authenticated registries

Closes #8933
Closes #10474
2023-09-18 01:17:44 +00:00
bors 41cef471d0 Auto merge of #12677 - weihanglo:registry-or-index, r=hi-rustin
refactor: use `RegistryOrIndex` enum to replace two booleans
2023-09-17 15:19:48 +00:00
Arlo Siemsen d345ca212f feat: stabilize credential-process and registry-auth 2023-09-16 22:40:45 -05:00
Tom Scanlan 95bf0abdad
doc: differentiate defaults for split-debuginfo 2023-09-16 09:04:50 -04:00
bors 4c10811ee1 Auto merge of #12679 - tompscanlan:caret-doc, r=weihanglo
doc: clarify caret requirements

### What does this PR try to resolve?

clearing up caret version requirements

possibly fixes #12112

### How should we test and review this PR?

expert review...
2023-09-16 12:09:30 +00:00
bors da498c8a74 Auto merge of #12614 - epage:partial, r=weihanglo
feat(pkgid): Allow incomplete versions when unambigious

### What does this PR try to resolve?

This was proposed in #12425 to help sand off some of the rough edges around `cargo update` for its wider use it would be getting.  Its easy to accidentally get duplicate copies packages in a repo and a pain to have to specify the full version when `cargo update -p foo@1` is sufficient to describe it.

Other effects
- profile overrides also supports this since we already allow a spec to match multiple items
- `cargo clean -p foo@...` already ignored the version, so now we also parse and ignore the partial version
- `cargo tree --prune` will now accept partial versions and will match all of them

Parts not effected:
- Replacements
  - Two of the cases were found and we treat it as if the version isn't present which will error, so I think that is correct

### How should we test and review this PR?

This extracts `PartialVersion` from `RustVersion` where `RustVersion` is a more specialized variant, not allowing prerelease or build.

This works by adopting `PartialVersion` into `PackageIdSpec`.  For `PackageIdSpec::query`, this will "just work".

### Additional information
2023-09-16 06:02:25 +00:00
Tom Scanlan 0454f9578c
doc: clarify caret requirements 2023-09-15 19:17:50 -04:00
Weihang Lo 11754e9923
refactor: use RegistryOrIndex enum to replace two booleans 2023-09-16 01:10:16 +08:00
Weihang Lo e883054c59
test: verify publish failed with --index and the only implicit allowed registry
The message is misleading and shouldn't proceed when `--index` presents.
2023-09-16 00:48:41 +08:00
Weihang Lo e57ce13da8
refactor: --registry always conflicts with --index
Move the validation upfront to clap
2023-09-15 22:33:27 +08:00
Weihang Lo 1f172e4b76
refactor: extract registry and index arg for reuse 2023-09-15 18:30:28 +08:00
bors d5336f813d Auto merge of #12671 - arlosi:cred-shadow, r=epage
fix: emit a warning for `credential-alias` shadowing

### What does this PR try to resolve?
If a `credential-alias` shadows a built-in provider the user could be confused about which provider is being used.

### How should we review this PR?
See the test to see what the warning looks like.

r? `@epage` who listed this as a concern on the FCP in #8933
2023-09-14 19:55:49 +00:00
Arlo Siemsen 8f18f2bdc8 fix: emit a warning when a credential provider alias shadows a built-in provider 2023-09-14 14:33:59 -05:00
bors 64642cc9f4 Auto merge of #12669 - weihanglo:lint-refactor, r=epage
refactor: fix lint errors in preparation of `[lints]` table integration
2023-09-14 16:41:27 +00:00
bors 5c84ce06f0 Auto merge of #12662 - Angelin01:limit-cargo-add-feature-print, r=weihanglo
Limit cargo add feature print
2023-09-14 13:19:16 +00:00
Angelo Ross 9928689d2c
Limit features printed during cargo add 2023-09-14 08:36:44 -03:00
Weihang Lo c4f9712a42
chore: bump patch version due to refactor 2023-09-14 14:44:44 +08:00
Weihang Lo 463622ad81
lint: fix errors for self-named module files 2023-09-14 13:43:48 +08:00
Weihang Lo aef3bd22d3
lint: fix errors for rust 2018 idioms 2023-09-14 13:43:48 +08:00
Weihang Lo 85a3e9ace0
lint: move module-level doc comment to top 2023-09-14 13:43:47 +08:00
Weihang Lo 437942ee7e
lint: use eprintln for human-facing outputs 2023-09-14 13:43:47 +08:00
Weihang Lo f9d82a1703
lint: remove unused dbg! 2023-09-14 13:43:47 +08:00
Weihang Lo 4cc9208b25
lint: follow convention no capitcal letter in first word 2023-09-14 13:43:47 +08:00
bors 80932be2e6 Auto merge of #12667 - Eh2406:clippy, r=weihanglo
Clippy

### What does this PR try to resolve?

A few more small anti-patterns from our code base. Each in their own commit, found by turning on a clippy warning and manually reviewing the changes. Most of the changes are from switching to `let-else`.

### How should we test and review this PR?

Internal refactoring and tests still pass.

### Additional information

I know we don't like "fix clippy" PR's. Sorry.

On the other hand having reviewed for these lints, I wouldn't mind turning them to warn. 🤷
2023-09-14 04:47:59 +00:00
Ed Page 82f9bd330e feat(spec): Allow partial versions when unambigious
This was proposed in #12425 to help improve usability of the existing
`cargo update` when dealing with the added workflows.
2023-09-13 22:00:00 -06:00