Commit Graph

4990 Commits

Author SHA1 Message Date
Ulyssa
e3203ef5e6 Add tests for binop_separator = Back 2021-09-28 22:20:34 -05:00
Yacin Tmimi
a5138b34d5 Prevent removal of qualified path for tuple struct inside macro
fixes 5005

This was very similar to 4964 and the fix was to extract and pass along
the qself of the ``PatKind::TupleStruct``
2021-09-27 17:49:10 -05:00
Lucas Kent
cb144c35e7 In Configurations.md demonstrate both cases for noop selections 2021-09-25 14:48:20 -05:00
Caleb Cartwright
4b9d637f58 refactor: simplify local dep lookups 2021-09-23 21:12:57 -05:00
Caleb Cartwright
7f6229b9aa tests: restructure and extend cargo-fmt tests 2021-09-23 21:12:57 -05:00
Caleb Cartwright
74df7b3265 deps: update cargo_metadata to include 'path' 2021-09-23 21:12:57 -05:00
Ulyssa
dd445aba08 Trailing comma on match block goes missing when guard is on its own line 2021-09-20 20:05:52 -05:00
Caleb Cartwright
7aa69e5bc8 refactor: use iter workaround for contains() gap 2021-09-16 22:01:50 -05:00
Caleb Cartwright
17cb2b147e feat: add --check flag to cargo fmt (#3890) 2021-09-16 22:01:50 -05:00
Arjen Laarhoven
9d65b7dcd1 feat: upper- or lowercase hexadecimal literals 2021-09-14 21:22:26 -05:00
Seiichi Uchida
d4ffd1efa4 Support @generated marker to skip code formatting
This is a copy of #4296 with these changes:
* file is not reopened again to find if the file is generated
* first five lines are scanned for `@generated` marker instead of one
* no attempt is made to only search for marker in comments

`@generated` marker is used by certain tools to understand that the
file is generated, so it should be treated differently than a file
written by a human:
* linters should not be invoked on these files,
* diffs in these files are less important,
* and these files should not be reformatted.

This PR proposes builtin support for `@generated` marker.

I have not found a standard for a generated file marker, but:
* Facebook [uses `@generated` marker](https://tinyurl.com/fb-generated)
* Phabricator tool which was spawned from Facebook internal tool
  [also understands `@generated` marker](https://git.io/JnVHa)
* Cargo inserts `@generated` marker into [generated Cargo.lock files](https://git.io/JnVHP)

My personal story is that rust-protobuf project which I maintain
was broken twice because of incompatibilities/bugs in rustfmt marker
handling: [one](https://github.com/stepancheg/rust-protobuf/issues/493),
[two](https://github.com/stepancheg/rust-protobuf/issues/551).
(Also, rust-protobuf started generating `@generated` marker
[6 years ago](https://git.io/JnV5h)).

While rustfmt AST markers are useful to apply to a certain AST
elements, disable whole-file-at-once all-tools-at-once text level
marker might be easier to use and more reliable for generated code.
2021-09-14 21:22:26 -05:00
Laurențiu Nicola
67a59f6ee3 opts: rephrase wording for --all and -p 2021-09-13 18:57:31 -05:00
Nipunn Koorapati
b10ab51fed rustfmt doc code blocks with multiple comma-separated attributes
Added test covering this. Chose to treat the code block
as rust if and only if all of the comma-separated attributes
are rust-valid. Chose to allow/preserve whitespace around commas

Fixes #3158
2021-09-08 23:27:51 -05:00
Caleb Cartwright
a80688329c fix: handle param doc comments for macro scenarios 2021-09-08 19:27:31 -05:00
Caleb Cartwright
57548aa096 fix: resolve idempotency issue in extern body elements 2021-09-07 20:22:09 -05:00
Caleb Cartwright
3d8cd57c2f tests: add files for issue 4579 2021-09-06 18:14:13 -05:00
Stéphane Campinas
c2f0e99d85 try to write the parameter on a new line in case the attribute/parameter together are over max_width 2021-09-06 18:14:13 -05:00
Caleb Cartwright
a59cac29f4 fix: use correct spans for params with attrs 2021-09-06 18:14:13 -05:00
Caleb Cartwright
59063e8b40 fix: newline width calc in combine w/ comments (#4123) 2021-09-06 17:02:20 -05:00
Eric
ae5696a7c4 test: add test for #4322 2021-09-02 20:53:15 -05:00
Eric
bfc60466bd test: add test for #4954 2021-09-02 20:53:15 -05:00
Eric
33d1368674 test: add test for #4257 2021-09-02 20:53:15 -05:00
Eric
d19f69cd71 test: add missing source for #4943 2021-09-02 20:53:15 -05:00
Akiomi Kamakura
c71c68c43f Add <title> to docs 2021-09-01 21:59:58 -05:00
Yusuke Tanaka
ca9b050bbf Implement One option for imports_granularity (#4669)
This option merges all imports into a single `use` statement as long as
they have the same visibility.
2021-08-31 18:33:06 -05:00
Ashvin Arsakularatne
e81c393663 fix: remove wrong reformatting of qualified paths in struct patterns 2021-08-25 21:18:41 -05:00
David Tolnay
fd6b025e8a Preserve visibility on trait items inside trait and impl 2021-08-22 12:06:18 -05:00
David Tolnay
c8bd550c8d Add test for visibility on a trait item (currently wrong) 2021-08-22 12:06:18 -05:00
David Bar-On
f7872887e9 Fix for version config option anchor 2021-08-17 21:55:26 -05:00
gunadhya
ec86cfd6ba Fix redirect issue
Signed-off-by: gunadhya <6939749+gunadhya@users.noreply.github.com>
2021-08-17 21:55:26 -05:00
gunadhya
042c2ec369 Added Updated default version to Rustfmt docs config 2021-08-17 21:55:26 -05:00
jdollar
3c36a0c0b7 Exluding v0.8.1 and v0.7 from the config dropdown
Older tags of the repo don't have the configuration.md file
that the docs/index.html file uses to display configuration options.
Removing them from the list since they don't apply to the use case of the
documentation page.
2021-08-17 21:55:26 -05:00
Ayaz Hafiz
5c7ac69393 Warn when rate limit is on docs page
Demo: https://5f0fad2f06c62143ac519413--festive-golick-afb5e0.netlify.app
2021-08-17 21:55:26 -05:00
Ayaz Hafiz
f5c782f321 fixup! Ensure that doc url hash IDs are scrolled to on page load 2021-08-17 21:55:26 -05:00
Ayaz Hafiz
bf47fc17a3 Ensure that doc url hash IDs are scrolled to on page load
I broke this a few weeks ago so I'll fix it

Demo: https://5f0fa445faca4aff5f580029--naughty-borg-09b903.netlify.app/?version=master&search=#brace_style
2021-08-17 21:55:26 -05:00
Ayaz Hafiz
3195d6c2b7 docs: Preserve updated query param content and add config option links
- Preserve search and version parameter updates in the url
- Render headings with an anchor to itself for easier linking to config
  options, variants, etc.

Demo: https://5efeb81ca3f0d.htmlsave.net/
2021-08-17 21:55:26 -05:00
asrar
31c97ce0f0 Adds query param for version no (#4270)
* Adds query param for version no

This adds support for using a query parameter for selecting the version no

* Adds error handling to configuration request

Catch request exception in case fetching the configuration from the url fails, this can happen either if non existent version number is passed in or because of server issues.

* Makes version selection better

Covers a few common cases in which the version number can be specified.
2021-08-17 21:55:26 -05:00
asrar
c5f1d9698e Adds direct linking using header ids (#4272)
Separates out search and direct linking, uses header ids for direct linking and `?search=term` for filtering configurations.
Once the app mounts the page is scrolled to the current header set in the url hash.
2021-08-17 21:55:26 -05:00
hafiz
1045c62ac1 Add github-style highlighting for code blocks (#4224) 2021-08-17 21:55:26 -05:00
Ayaz Hafiz
916c238103 fixup! Show configs from different versions on github pages 2021-08-17 21:55:26 -05:00
Ayaz Hafiz
6959d03a3a Show configs from different versions on github pages
See https://gushiermainecoon.htmlpasta.com/ for a demo of this change.

Part of #4178
2021-08-17 21:55:26 -05:00
Ayaz Hafiz
667a2da7af Fix stable toggle on gh pages configuration site
A demonstration of the fix is included in the PR associated with this
commit.
2021-08-17 21:55:26 -05:00
Nipunn Koorapati
1d6002ae38 Enable triagebot assignment in rustfmt 2021-08-09 17:56:41 -05:00
Caleb Cartwright
5d8eb8d79c fix: don't drop drop generic args on assoc ty constraints 2021-08-08 13:58:10 -05:00
Caleb Cartwright
fefb5427a2 fix: handle GAT types in impls with self bounds 2021-08-06 22:03:40 -05:00
Caleb Cartwright
8cbee5604a ci: functionally delete appveyor 2021-07-29 22:07:50 -05:00
klensy
8c52aae10a Bump deps
* dirs-sys v0.3.4 -> v0.3.6 to drop a lot of deps
regex v1.3.1 -> v1.4.3 drops thread_local 0.3.6
bytecount v0.6.0 -> v0.6.2 replaces packed_simd with packed_simd_2
ignore v0.4.11 -> v0.4.17 drop crossbeam-channel v0.4.0

* itertools 8.0 -> 9.0
bump `ignore` version in Cargo.toml

* cargo_metadata 0.8 -> 0.12

* env_logger 0.6 -> 0.8
2021-07-27 19:50:11 -05:00
Ellen
0b21ea2161 Unyeet const param defaults 2021-07-27 19:50:11 -05:00
Outvi V
e7fa07036f fix: make --edition 2021 visible in --help 2021-07-27 19:50:11 -05:00
Caleb Cartwright
778f03530f ci: remove unnecessary cargo-make install on windows jobs 2021-07-26 22:00:01 -05:00