Commit graph

13603 commits

Author SHA1 Message Date
flip1995
49b9f9247b
Bump nightly version -> 2022-02-10 2022-02-10 18:11:49 +01:00
flip1995
0775c06d32
Merge remote-tracking branch 'upstream/master' into rustup 2022-02-10 18:11:27 +01:00
bors
6966a42c1a Auto merge of #8404 - camsteffen:rm-ui-test, r=flip1995
Factor out ui_test suite

changelog: none
2022-02-09 09:09:58 +00:00
Yuki Okushi
5044e3769e Rollup merge of #93746 - cjgillot:nodefii, r=nikomatsakis
Remove defaultness from ImplItem.

This information is not really used anywhere, except HIR pretty-printing. This makes ImplItem and TraitItem more similar.
2022-02-09 14:12:22 +09:00
Cameron Steffen
88fd090531 Factor out ui_test suite 2022-02-08 15:11:48 -06:00
bors
caeebd6b09 Auto merge of #8374 - Alexendoo:bless-revisions, r=camsteffen
Support `cargo dev bless` for tests with revisions

changelog: internal: Support `cargo dev bless` for tests with revisions

Previously bless wouldn't pick up the saved stderr from `target/debug/tests/manual_assert.stage-id.edition2021.stderr` or `target/debug/tests/manual_assert.stage-id.edition2018.stderr` due to there being multiple revisions of the test output

This tweaks compile-test so the built files end up in e.g. `target/debug/tests/ui`, `target/debug/tests/ui-cargo` rather than share the `tests` dir. `cargo dev bless` then uses that to update all the `.stdout/stdout/fixed` files it can find

Also removes an empty file I found, and the logic to remove empty outputs as compiletest doesn't produce empty `.stdout/stderr` files
2022-02-08 20:50:41 +00:00
bors
2590701b2a Auto merge of #8400 - Jarcho:split_matches, r=Manishearth
Split matches

Part of #6680

changelog: None
2022-02-07 20:10:07 +00:00
Jason Newcomb
c65894cf1a Split out wild_in_or_pats 2022-02-07 13:00:19 -05:00
Jason Newcomb
aa3af30dee Split out rest_pat_in_fully_bound_struct 2022-02-07 12:57:02 -05:00
Jason Newcomb
6477923323 Split out infalliable_detructuring_match 2022-02-07 12:28:57 -05:00
Jason Newcomb
fb1093c561 Split out match_ref_pats 2022-02-07 12:22:27 -05:00
Jason Newcomb
1da26c8a70 Split out match_single_binding 2022-02-07 12:22:27 -05:00
Jason Newcomb
bccf06f601 Split out match_as_ref 2022-02-07 12:22:26 -05:00
Jason Newcomb
75923dff5b Split out wildcard_enum_match_arm and match_wildcard_for_single_variants 2022-02-07 12:22:26 -05:00
Jason Newcomb
dc75695e97 Split out match_wild_err_arm 2022-02-07 12:22:26 -05:00
Jason Newcomb
2a70439ef0 Split out overlapping_arms 2022-02-07 12:22:26 -05:00
Jason Newcomb
f3dd909e0f Split out match_bool 2022-02-07 12:22:26 -05:00
Jason Newcomb
f23dc16e1d Split out single_match 2022-02-07 12:22:26 -05:00
Jason Newcomb
f2b6ed7cb2 Split out redundant_pattern_match 2022-02-07 12:22:24 -05:00
Jason Newcomb
64548250e7 Split out match_same_arms 2022-02-07 12:20:18 -05:00
Jason Newcomb
e41a6fc042 Split out match_like_matches_macro 2022-02-07 12:20:18 -05:00
Jason Newcomb
f7be9564e5 Move matches.rs to mod.rs 2022-02-07 12:20:17 -05:00
bors
3d43826e32 Auto merge of #8305 - camsteffen:util-cleanup, r=flip1995
Factor out several utils, add `path_def_id`

changelog: none

This is generally an effort to reduce the total number of utils. `path_def_id` is added which I believe is more "cross-cutting" and also complements `path_to_local`. Best reviewed one commit at a time.

Added:
* `path_def_id`
* `path_res`

Removed:
 * `is_qpath_def_path`
 * `match_any_diagnostic_items`
 * `expr_path_res`
 * `single_segment_path`
 * `differing_macro_contexts`
 * `is_ty_param_lang_item`
 * `is_ty_param_diagnostic_item`
 * `get_qpath_generics`

Renamed:
* `path_to_res` to `def_path_res`
* `get_qpath_generic_tys` to `qpath_generic_tys`

CC `@Jarcho` since this relates to some of your work and you may have input.
2022-02-07 15:23:23 +00:00
bors
8dc719cb39 Auto merge of #8326 - matthiaskrgr:warn_on_multi_configs, r=xFrednet
warn if we find multiple clippy configs

Fixes #8323

---

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: warn if we find multiple clippy configs
2022-02-06 17:19:11 +00:00
Matthias Krüger
aae64e93b7 ignore test on windows since I don't know why compiletest does not hand paths properly there 2022-02-06 17:21:32 +01:00
bors
093e32052e Auto merge of #8398 - Jarcho:unordered_transmute, r=llogiq
Add lint `transmute_undefined_repr`

Partially implements #3999 and #546

This doesn't consider `enum`s at all right now as those are going to be a pain to deal with. This also allows `#[repr(Rust)]` structs with only one non-zero sized fields. I think those are technically undefined when transmuted.

changelog: Add lint `transmute_undefined_repr`
2022-02-06 16:05:00 +00:00
Jason Newcomb
68993b1f6c Small transmute_float_to_int cleanup 2022-02-06 09:42:10 -05:00
Alex Macleod
04dce4aed4 Support cargo dev bless for tests with revisions 2022-02-06 13:00:17 +00:00
Jason Newcomb
3403b3e717 Add lint transumte_undefined_repr 2022-02-05 16:28:25 -05:00
bors
68b44986de Auto merge of #8365 - Alexendoo:explicit-write-suggestion, r=camsteffen
Add `explicit_write` suggestions for `write!`s with format args

changelog: Add [`explicit_write`] suggestions for `write!`s with format args

Fixes #4542

```rust
writeln!(std::io::stderr(), "macro arg {}", one!()).unwrap();
```

Now suggests:

```
error: use of `writeln!(stderr(), ...).unwrap()`
  --> $DIR/explicit_write.rs:36:9
   |
LL |         writeln!(std::io::stderr(), "macro arg {}", one!()).unwrap();
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprintln!("macro arg {}", one!())`
```

---------

r? `@camsteffen` (again, sorry 😛) for the `FormatArgsExpn` change

Before this change `inputs_span` returned a span pointing to just `1` in

```rust
macro_rules! one {
    () => { 1 };
}

`writeln!(std::io::stderr(), "macro arg {}", one!()).unwrap();`
```

And the `source_callsite` of that span didn't include the format string, it was just `one!()`
2022-02-05 17:44:37 +00:00
bors
29cc0d8e59 Auto merge of #8372 - tamaroning:unwrap_used, r=llogiq
make unwrap_used also trigger on .get().unwrap()

fixes #8124
changelog: make the [unwrap_used] lint trigger for code of the form such as `.get(i).unwrap()` and `.get_mut(i).unwrap()`
2022-02-05 14:56:42 +00:00
Alex Macleod
144b4a59c7 Add explicit_write suggestions for write!s with format args 2022-02-05 13:05:08 +00:00
Alex Macleod
4bae06d73c Use source callsite in FormatArgsExpn::inputs_span 2022-02-05 13:05:08 +00:00
bors
699ee5e31c Auto merge of #8376 - dswij:8373, r=camsteffen
[`chars_next_cmp`] Fix unescaped suggestion

closes #8373

changelog: [`chars_next_cmp`] Fix unescaped suggestion
2022-02-05 00:32:10 +00:00
Camille GILLOT
3edfd5ec3d Remove defaultness from ImplItem. 2022-02-03 18:56:08 +01:00
Oli Scherer
69872175ee Lazily resolve type-alias-impl-trait defining uses
by using an opaque type obligation to bubble up comparisons between opaque types and other types

Also uses proper obligation causes so that the body id works, because out of some reason nll uses body ids for logic instead of just diagnostics.
2022-02-02 15:40:11 +00:00
bors
bef92b864d Auto merge of #8382 - tamaroning:suggest_iter_instead_of_into_iter, r=giraffate
[explicit_counter_loop] suggests `.into_iter()`, despite that triggering [into_iter_on_ref] in some cases

I have modified `fn make_iterator_snippet` in clippy_lints/src/loops/utils.rs ,so this change has some little influence on another lint [manual_flatten] .

fixes #8155

---
changelog: Fix that [`explicit_counter_loop`] suggests `into_iter()` despite that triggering [`into_iter_on_ref`] in some cases
2022-02-02 12:37:18 +00:00
tamaron
f5fd9ded00 chore 2022-02-02 11:25:15 +09:00
bors
cf53710744 Auto merge of #8370 - smoelius:master, r=flip1995
Format `if_chain` invocations in clippy_utils

Not realizing it was [already obsolete](https://github.com/rust-lang/rust-clippy/pull/8360), I built a [tool to format inside `if_chain` invocations](https://crates.io/crates/rustfmt_if_chain).

This PR applies the tool to clippy_utils. (If you apply it to clippy_lints, the changes are extensive.)

Anyway, I'm making it known here in case anyone wants to use it while `if-let` chain support is developed for `rustfmt`. (There could be a few Clippy PRs between now and then, and IMHO, the code looks better with the `if_chain` invocations formatted.)

Cheers.

---

changelog: none
2022-02-01 21:18:45 +00:00
bors
327768cfb0 Auto merge of #8387 - Jarcho:ptr_arg_8386, r=flip1995
Fix ICE in `ptr_arg`

fixes: #8386

changelog: None
2022-02-01 20:48:07 +00:00
Jason Newcomb
e4f45c22e2 Fix ICE in ptr_arg 2022-02-01 15:05:20 -05:00
bors
b8c80ddbb5 Auto merge of #8330 - flip1995:changelog, r=llogiq
Update Changelog

[Rendered](https://github.com/flip1995/rust-clippy/blob/changelog/CHANGELOG.md)

changelog: none
2022-02-01 19:30:25 +00:00
Jason Newcomb
8ef87455b0 Minor cleanup on transmute lints 2022-02-01 10:58:01 -05:00
Matthias Krüger
c7b7b537ba Rollup merge of #93290 - lcnr:same_type, r=jackh726
remove `TyS::same_type`

This function ignored regions and constants in adts, but didn't do so for references or any other types. cc https://github.com/rust-lang/rust/pull/93148#discussion_r791408057
2022-02-01 16:08:05 +01:00
lcnr
99af4c8971 remove TyS::same_type
it ignored regions and constants in adts,
but didn't do so for references or any other types.
This seemed quite weird
2022-02-01 11:21:26 +01:00
lcnr
544ed0b3cf silence lint in clippy 2022-02-01 10:13:32 +01:00
tamaron
b13704a9cd update test suites 2022-02-01 13:44:24 +09:00
tamaron
0e1cbc5cd1 fix code 2022-02-01 13:43:39 +09:00
Matthias Krüger
1193abe4c8 multiple configs: add tests 2022-01-31 18:36:15 +01:00
Matthias Krüger
97e5a70f47 warn if we find multiple clippy configs
Fixes #8323
2022-01-31 18:36:15 +01:00