Currently, when the mocked cargo command is passed
`--recursive-cargo-subcommand`, it runs:
```
cargo-foo --recursive-cargo
```
However, cargo subcommands are normally passed their subcommand name as
the first argument. Thus, one would expect the following to be run:
```
cargo-foo foo --recursive-cargo
```
This commit changes the mocked cargo command to do the latter. It also
adds a check to ensure that the "subcommand name as first argument"
behavior is respected.
This is, admittedly, a rather pedantic change.
Extracted from #4175
Previously, `Config::cmd` would always append an `EXE_SUFFIX`. However,
this would produce an invalid path if the suffix was already present.
Extracted from #4175
`SanitizedOutput`s have `String` `stdout` and `stderr` fields. This
makes `SanitizedOutput`s easier to display than `Output`s.
This commit adds a `TryFrom<Output>` implementation for
`SanitizedOutput`. In this way, a test can run a command to produce an
`Output`, and from that `Output` produce a `SanitizedOutput`.
Extracted from #4175
Use `strip_suffix()` which is clearer, shorter, and won't break if the suffix is in the middle of the filename (unlikely, but still). I also renamed `binary_prefix` to something clearer, since it isn't actually a prefix; it's the main part.
Following
<https://users.rust-lang.org/t/rust-2024-compatibility-lint-and-the-if-let-temporary-scope/125969/5>,
I have manually audited all `if_let_rescope` cases and found out that
certain existing cases can be rewritten to make it clearer semantically.
So these migrations have been made in advance so that the only cases of
`if-let` remaining are false positives of this lint.
The crux of determining false positives here is that, according to
<https://github.com/rust-lang/rust/issues/133167>, `if let Some()`
and other similar cases where the `else` drop is not significant are
not affected by the Edition change.