775 Commits

Author SHA1 Message Date
Eric Huss
3d3e1b3668 Handle Windows newlines.
Suggestions that come from rustc that are multi-line only use LF line
endings. But if the file is checked out on windows with CRLF
line-endings, then you end up with a mix of line endings that don't
match the "fixed.rs" file.

Tracking this at https://github.com/rust-lang/rust/issues/119482.
2023-12-31 16:20:41 -08:00
Eric Huss
a21997f0cc rustfix: Support inserting new lines.
If rustfix received a suggestion which inserts new lines without
replacing existing lines, it would ignore the suggestion. This is
because `parse_snippet` would immediately return if the `lines` to
replace was empty.

The solution here is to just drop the code which messes with the
original text line. `cargo fix` (and compiletest) currently do not use
this. This was originally added back in the days when rustfix supported
an interactive UI which showed color highlighting of what it looks like
with the replacement. My feeling is that when we add something like this
back in, I would prefer to instead use a real diff library and display
instead of trying to do various text manipulation for display. This
particular code has generally been buggy, and has been a problem several
times.

The included test fails without this fix because the changes do not
apply, and the code cannot compile.
2023-12-31 10:18:22 -08:00
Eric Huss
029fe2bafc Add a primitive way to add new tests to parse_and_replace.
This adds an environment variable to make it easier to add new tests.
2023-12-31 09:58:37 -08:00
Eric Huss
c54fa88ea4 Cleanup rustfix parse_and_replace test.
This is just some minor code cleanup for the parse_and_replace test,
there should not be any functional differences.
2023-12-31 09:56:20 -08:00
hi-rustin
ad18dd017b refactor: give some better examples for package ID spec
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-25 10:08:27 +08:00
bors
a9c749c33e Auto merge of #13186 - weihanglo:cargo-util-schemas-error-types, r=epage
refactor: custom error types for `cargo-util-schemas`
2023-12-20 15:52:40 +00:00
Weihang Lo
0b0e78fa3f
chore: bump cargo-util-schemas to 0.2.0 2023-12-20 10:38:03 -05:00
Weihang Lo
f9e726b056
refactor(util-schemas): make error enum private 2023-12-20 10:38:03 -05:00
Weihang Lo
a0201cd465
refactor(util-schemas): make fn in restricted_names crate private
pub
2023-12-20 10:38:02 -05:00
Weihang Lo
d1e1c3d0aa
refactor(util-schemas): remove unused arg 2023-12-20 10:38:02 -05:00
Weihang Lo
f1216495bb
refactor(util-schemas): remove anyhow 2023-12-20 10:38:02 -05:00
Weihang Lo
1e577614c5
refactor(util-schemas): error type for PackageIdSpec 2023-12-20 10:38:02 -05:00
Weihang Lo
a3267bfa29
refactor(util-schemas): error type for restricted_names 2023-12-20 10:38:02 -05:00
bors
c21be2b7cf Auto merge of #13168 - leonzchang:handlebars-v4, r=epage
chore(deps): update rust crate handlebars to `v4.5.0`

In the latest version of `handlebars`, rules for whitespace auto elimination is to check if the directive `{{# xxx}}`` and ``{{/ xxx}}` is holding a whole line, with leading and trailing whitespaces counted, and then remove the trailing NEWLINE (See [`template.rs`](9d7d555628/src/template.rs (L568-L889))).

```md
{{#options}}
                              <--- this newline will be removed after a standalone block
{{#option "`-o` _outdir_"}}
                              <--- this newline will be removed
Some content

{{/option}}
                              <--- this newline will be removed
{{/options}}
                              <--- this newline will be removed
```

This PR changes includes (fixes #13162):
1. update `handlebars` crate to `v4.5.0`.
2. add extra NEWLINE to helper blocks `options`, `option` to align with the new strip rules, preserving the original behavior.
3. update doc(the rest handlebars expression) to align with the new strip rules..
2023-12-20 14:52:29 +00:00
leonzchang
b96b244c28
update handlebars & fix tests & update doc 2023-12-20 11:12:49 +08:00
Weihang Lo
90017c0747
refactor(util-schemas): error type for RustVerion 2023-12-19 18:28:01 -05:00
Weihang Lo
d7b811b686
refactor(util-schemas): error type for PartialVersion 2023-12-19 18:28:01 -05:00
Weihang Lo
da6cf9cde2
refactor(util-schemas): add thiserror 2023-12-19 03:34:35 -05:00
bors
69255bb10d Auto merge of #13184 - weihanglo:ws-homepage, r=epage
refactor: clean up package metadata

Like #12352 but for `homepage` and `repository`.

Inspired by <https://github.com/rust-lang/cargo/pull/13178#discussion_r1429394873>.
2023-12-18 22:12:59 +00:00
Weihang Lo
ad2c45bde9
refactor: clean up package metadata
Like PR 12352 but for homepage and repository

Versions for

* `cargo-credential-1password`
* `cargo-util-schemas`
* `home`

are bumped along with the change.
2023-12-18 16:09:03 -05:00
Weihang Lo
0ac9cdeeec
ci: check SemVer for cargo-util-schemas on CI 2023-12-18 15:56:13 -05:00
Ed Page
633929d3aa refactor(schemas): Pull out cargo-util-schemas crate
Fixes #12801
2023-12-15 13:22:25 -06:00
bors
9c1316ff3f Auto merge of #13181 - hi-rustin:rustin-patch-rename-files, r=weihanglo
chore(rustfix): rename Readme.md to README.md
2023-12-18 15:04:01 +00:00
hi-rustin
0b6c229e9d chore(rustfix): remove useless clippy rules
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-18 20:17:05 +08:00
hi-rustin
b8e2f75881 chore(rustfix): fix a typo
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-18 20:10:28 +08:00
hi-rustin
efdaf4bbc6 chore(rustfix): rename Changelog.md to CHANGELOG.md
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-18 20:05:52 +08:00
hi-rustin
88993a3bbe chore(rustfix): rename Readme.md to README.md
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-12-18 20:04:50 +08:00
Ed Page
c7bcc6c199
docs(home): Set release date 2023-12-15 12:32:15 -06:00
Guillaume Dallenne
7ce9c26f39
docs(home): prepare the changelog for 0.5.9 2023-12-15 19:04:51 +01:00
Chris Denton
6e11c77384
Replace SHGetFolderPathW with SHGetKnownFolderPath 2023-12-15 03:36:39 +00:00
Weihang Lo
516313379e
chore(bump-check): dont check home against beta/stable branches
The publish of home is not tied with Rust release process, hence.
2023-12-13 18:21:55 -05:00
bors
1aa9df1a5b Auto merge of #13158 - Turbo87:crates-io-status-codes, r=epage
crates-io: Add support for other 2xx HTTP status codes

Replying with `201 Created` of `202 Accepted` should not result in showing errors.

Related:

- https://github.com/rust-lang/cargo/issues/3995
- https://github.com/rust-lang/cargo/pull/6771
2023-12-12 14:52:31 +00:00
Tobias Bieniek
32d4c0fd80
crates-io: Add support for other 2xx HTTP status codes
Replying with `201 Created` of `202 Accepted` should not result in showing errors.
2023-12-12 13:33:03 +01:00
Ed Page
808e2a174f refactor(schema): Adopt RustVersion 2023-12-11 13:44:14 -06:00
bors
749654c5fd Auto merge of #13132 - arlosi:cachedir, r=epage
Avoid writing CACHEDIR.TAG if it already exists

Cargo currently unconditionally writes `CACHEDIR.TAG` files even if they already exist.

This practice causes problems for build systems that disallow multiple writes to the same file.
2023-12-07 22:37:55 +00:00
Arlo Siemsen
04af5e7a06 Avoid writing CACHEDIR.TAG if it already exists 2023-12-07 14:51:01 -06:00
Ed Page
96f8517a28 test(mdman): Switch to snapbox
- We use it elsewhere
- We don't have to bake our own snapshotting solution
- It is more obvious how to update the snapshots
2023-12-01 15:31:27 -06:00
renovate[bot]
ab6adab01b
chore(deps): update compatible 2023-12-01 17:33:18 +00:00
Ed Page
378502bf20 refactor: Try to make PackageId conversion clearer 2023-12-01 10:48:14 -06:00
bors
c192d989b3 Auto merge of #13091 - weihanglo:trim-paths-lldb, r=epage
test(trim-paths): exercise with real world debugger
2023-12-01 15:47:10 +00:00
Weihang Lo
5c32fe0432
test(trim-paths): exercise with real world debugger 2023-12-01 08:48:24 -05:00
Eric Huss
1aa769240d Add more options to registry test support. 2023-11-30 16:39:08 -08:00
Ed Page
a43e09073c test(resolver): Don't bother generating public cases 2023-11-29 13:11:39 -06:00
Ed Page
e6da166c8b test(resolver-tests): Remove public dep support from SAT resolver 2023-11-29 12:17:26 -06:00
Ed Page
71172d52b5 fix(resolver): Remove unused public-deps error handling
To implement rust-lang/rfcs#3516, we need to decouple the resolver's
behavior from the unstable flag.  Since the code path is now dead, I
went ahead and removed it.
2023-11-22 15:20:10 -06:00
Weihang Lo
21274da65b
chore: bump rustfix to 0.7.0 2023-11-27 10:50:10 -05:00
Weihang Lo
ed347ce4dc
refactor: use custom error instead of anyhow 2023-11-27 10:50:10 -05:00
bors
3920bd5ea5 Auto merge of #13047 - tompscanlan:rustfix-ignored-tests, r=weihanglo
review and remove ignored tests in rustfix

### What does this PR try to resolve?
review ignored tests in rustfix crate per #13034.

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

### Additional information

* Removed unproductive test in `parse_and_replace`
* un-ignore proptests, and reduce runtime from ~2s to ~<.25s
2023-11-26 17:14:11 +00:00
Tom Scanlan
b179cd175a
review and remove ignored tests in rustfix
* reduce time in proptest
* delete edition dir
* remove refs to fixmode::EDITION
2023-11-26 09:29:18 -05:00
bors
35ed69cb1b Auto merge of #13048 - weihanglo:rustfix-doc, r=epage
docs: add doc comments for rustfix
2023-11-25 23:45:45 +00:00