Commit Graph

12 Commits

Author SHA1 Message Date
Yacin Tmimi
ac2ebd3a78 Prevent ICE when calling parse_attribute without an attribute
Fixes 5729

`parse_attribute` will panic if the first token is not a `#`. To prevent
this we return early instead of trying to parse an invalid attribute.
2023-06-19 09:58:12 -05:00
Yacin Tmimi
475396a03c Prevent ICE when calling parse_attribute in parse_cfg_if_inner
Fixes 5728

Previously we were ignoring the diagnostic error, which lead to the ICE.
Now we properly cancel the error.
2023-04-01 13:21:12 -05:00
Yacin Tmimi
c19b14539b test for issue 3164
Closes 3164

Show that when `error_on_line_overflow=true` is set in the rustfmt.toml
that an error message is written to stderr.
2022-07-22 17:57:07 -05:00
Yacin Tmimi
b3d4fb448c Allow #[ignore] tests to run in rustfmt's test suite
There are some tests in the rustfmt test suite that are ignored by
default. I believe these tests are ignored because they have caused
issues with the the `rust-lang/rust` test suite.

However, we recently experienced an issue (5395) that would have been
avoided had these tests been running.

With the introduction of the new `#[rustfmt_only_ci_test]` attribute
macro we can run these tests when the `RUSTFMT_CI` environment variable
is set, which will presumably only be set during rustfmts CI runs.
When the environment variable is not set the `#[rustfmt_only_ci_test]`
will be replaced with an `#[ignore]`.
2022-06-29 18:55:02 -05:00
cuishuang
c03e1842f6 fix some typos
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-05-07 11:10:59 -05:00
Yacin Tmimi
18c0369688 Improve mod resolution error for mods with multiple candidate files
Fixes 5167

When ``a.rs`` and ``a/mod.rs`` are both present we would emit an error
message telling the user that the module couldn't be found. However,
this behavior is misleading because we're dealing with an ambiguous
module path, not a "file not found" error.

Is the file ``a.rs`` or is it ``a/mod.rs``? Rustfmt can't decide, and
the user needs to resolve this ambiguity themselves.

Now, the error message displayed to the user is in line with what they
would see if they went to compile their code with these conflicting
module names.
2022-03-08 21:51:23 -06:00
Caleb Cartwright
281bf03e64 fix: formatting in new test 2022-02-15 21:24:39 -06:00
Tharun Rajendran
b05b313800
chore(rustfmt): remove executable path from usage string (#5216)
* chore(rustfmt): remove executable path from usage string

* add unit test for usage string

* rename test and check usage text in a single assert
2022-02-10 22:35:45 -06:00
topecongiro
ee38d02591
Cargo fmt 2019-09-24 09:26:50 +09:00
CreepySkeleton
e81ec20af0 Add --config command line option (#3767) 2019-09-05 11:15:19 +09:00
Seiichi Uchida
66c27c9161
Add #[ignore] to test that runs external process (#3690) 2019-07-16 19:36:23 +09:00
Stéphane Campinas
6487422b3e fix print-config minimal option (#3687) 2019-07-15 20:58:54 +09:00