]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agotests: default to more threads for ui-tests
Matthias Krüger [Sun, 20 Feb 2022 12:45:37 +0000 (13:45 +0100)]
tests: default to more threads for ui-tests

Benchmarks (tested on i5-7200U, 2 core 4 threads)

```
master branch:

cargo test // prime caches
cargo --color=always test  70,39s user 21,91s system 180% cpu 51,035 total
cargo --color=always test  70,77s user 22,13s system 180% cpu 51,579 total
cargo --color=always test  70,97s user 22,12s system 180% cpu 51,673 total

cargo --color=always nextest run  78,74s user 22,27s system 220% cpu 45,829 total
cargo --color=always nextest run  78,46s user 21,92s system 224% cpu 44,674 total
cargo --color=always nextest run  78,31s user 22,21s system 228% cpu 43,909 total

Patched (ui_speedup branch)

cargo test // prime cache
cargo --color=always test  97,51s user 32,02s system 288% cpu 44,905 total
cargo --color=always test  99,19s user 31,91s system 276% cpu 47,436 total
cargo --color=always test  98,47s user 31,84s system 284% cpu 45,744 total

cargo --color=always nextest run  102,18s user 30,80s system 350% cpu 37,902 total
cargo --color=always nextest run  99,75s user 29,86s system 350% cpu 36,935 total
cargo --color=always nextest run  100,36s user 29,93s system 351% cpu 37,061 total
```

2 years agoAuto merge of #8440 - Jarcho:transmute_undefined, r=Manishearth
bors [Fri, 18 Feb 2022 22:48:23 +0000 (22:48 +0000)]
Auto merge of #8440 - Jarcho:transmute_undefined, r=Manishearth

Some more fixes for `transmute_undefined_repr`

changelog: Fix transmuting a struct containing a pointer into a pointer in `transmute_undefined_repr`
changelog: Allow various forms of type erasure in `transmute_undefined_repr`

2 years agoFix `transmute_undefined_repr` when converting between a fat pointer and a type conta...
Jason Newcomb [Wed, 16 Feb 2022 19:59:04 +0000 (14:59 -0500)]
Fix `transmute_undefined_repr` when converting between a fat pointer and a type containing a fat pointer

2 years agoAllow transmuting fat pointers to some types in `transmute_undefined_repr`
Jason Newcomb [Wed, 16 Feb 2022 15:45:49 +0000 (10:45 -0500)]
Allow transmuting fat pointers to some types in `transmute_undefined_repr`

2 years agoAllow various type erasure patterns in `transmute_undefined_repr`
Jason Newcomb [Tue, 15 Feb 2022 19:51:57 +0000 (14:51 -0500)]
Allow various type erasure patterns in `transmute_undefined_repr`

2 years agoAdd some comments to `transmute_undefined_repr`
Jason Newcomb [Tue, 15 Feb 2022 16:39:19 +0000 (11:39 -0500)]
Add some comments to `transmute_undefined_repr`

2 years agoFix `transmute_undefined_repr` when converting between a pointer and a type containin...
Jason Newcomb [Tue, 15 Feb 2022 16:29:02 +0000 (11:29 -0500)]
Fix `transmute_undefined_repr` when converting between a pointer and a type containing a pointer

2 years agoAuto merge of #8381 - Jarcho:cast_possible_truncation_542, r=Manishearth
bors [Fri, 18 Feb 2022 19:31:10 +0000 (19:31 +0000)]
Auto merge of #8381 - Jarcho:cast_possible_truncation_542, r=Manishearth

Lint enum-to-int casts with `cast_possible_truncation`

fixes: #542

~~This will not lint casting a specific variant to an integer. That really should be a new lint as it's definitely a truncation (other than `isize`/`usize` values).~~

changelog: Lint enum-to-int casts with `cast_possible_truncation`
changelog: New lint `cast_enum_truncation`

2 years agoExtract some util functions
Jason Newcomb [Fri, 18 Feb 2022 14:10:48 +0000 (09:10 -0500)]
Extract some util functions

2 years agoNew lint `cast_enum_truncation`
Jason Newcomb [Tue, 1 Feb 2022 02:22:47 +0000 (21:22 -0500)]
New lint `cast_enum_truncation`

2 years agoLint enum-to-int casts with `cast_possible_truncation`
Jason Newcomb [Mon, 31 Jan 2022 20:45:49 +0000 (15:45 -0500)]
Lint enum-to-int casts with `cast_possible_truncation`

2 years agoAuto merge of #8419 - flip1995:await_parking_alot, r=llogiq
bors [Fri, 18 Feb 2022 10:55:05 +0000 (10:55 +0000)]
Auto merge of #8419 - flip1995:await_parking_alot, r=llogiq

Fix `await_holding_lock` not linting `parking_lot` Mutex/RwLock

This adds tests for `RwLock` and `parking_lot::{Mutex, RwLock}`, which were added before in https://github.com/rust-lang/rust-clippy/commit/2dc8c083f54454ca87bb09d691577eada2d23539, but never tested in UI tests. I noticed this while reading [fasterthanli.me](https://fasterthanli.me/articles/a-rust-match-made-in-hell) latest blog post, complaining that Clippy doesn't catch this for `parking_lot`. (Too many people read his blog, he's too powerful)

Some more things:
- Adds a test for #6446
- Improves the lint message

changelog: [`await_holding_lock`]: Now also lints for `parking_lot::{Mutex, RwLock}`

2 years agoAuto merge of #8442 - rsmantini:issue-8120-fix, r=Manishearth
bors [Thu, 17 Feb 2022 22:57:23 +0000 (22:57 +0000)]
Auto merge of #8442 - rsmantini:issue-8120-fix, r=Manishearth

trigger  `ptr_as_ptr` inside macros

This PR makes `ptr_as_ptr` trigger inside macros

Fixes issue #8120

changelog: ``[`ptr_as_ptr`]`` is now triggered inside macros

r? `@llogiq`

2 years agotrigger ptr_as_ptr inside macros
Rodrigo Mantini [Thu, 17 Feb 2022 00:08:53 +0000 (01:08 +0100)]
trigger ptr_as_ptr inside macros

2 years agoMove await_holding_* lints to suspicious and improve doc
flip1995 [Thu, 17 Feb 2022 16:57:39 +0000 (17:57 +0100)]
Move await_holding_* lints to suspicious and improve doc

Even though the FP for that the lints were moved to pedantic isn't fixed
yet, running the lintcheck tool over the most popular 279 crates didn't
trigger this lint once. I would say that this lint is valuable enough,
despite the known FP, to be warn-by-default. Especially since a pretty
nice workaround exists.

2 years agoAdd test for drop-before-await FP
flip1995 [Sat, 12 Feb 2022 10:30:03 +0000 (11:30 +0100)]
Add test for drop-before-await FP

2 years agoActually lint parking_lot in await_holding_lock
flip1995 [Sat, 12 Feb 2022 09:32:44 +0000 (10:32 +0100)]
Actually lint parking_lot in await_holding_lock

This adapts the paths for the parking_lot mutex guards, so that
parking_lot mutexes and RwLocks actually get linted. This is now also
tested.

2 years agoImprove lint message of await_holding_*
flip1995 [Sat, 12 Feb 2022 09:23:07 +0000 (10:23 +0100)]
Improve lint message of await_holding_*

Improves the message of the lints await_holding_lock and
await_holding_refcell_ref. Now also actually tests RwLock.

2 years agoAuto merge of #8218 - Jarcho:redundant_slicing_deref, r=camsteffen
bors [Thu, 17 Feb 2022 16:08:45 +0000 (16:08 +0000)]
Auto merge of #8218 - Jarcho:redundant_slicing_deref, r=camsteffen

Improve `redundant_slicing` lint

fixes #7972
fixes #7257

This can supersede #7976

changelog: Fix suggestion for `redundant_slicing` when re-borrowing for a method call
changelog: New lint `deref_as_slicing`

2 years agoAuto merge of #8441 - Jarcho:needless_borrow_temp, r=flip1995
bors [Thu, 17 Feb 2022 15:51:30 +0000 (15:51 +0000)]
Auto merge of #8441 - Jarcho:needless_borrow_temp, r=flip1995

Don't lint `needless_borrow` in method receiver positions

fixes #8408
fixes #8407
fixes #8391
fixes #8367
fixes #8380

This is a temporary fix for `needless_borrow`. The proper fix is included in #8355.

This should probably be merged into rustc before beta branches on Friday. This issue has been reported six or seven times in the past couple of weeks.

changelog: Fix various issues with `needless_borrow` n´. Note to changelog writer: those issues might have been introduced in this release cycle, so this might not matter in the changelog.

2 years agoAuto merge of #8433 - hellow554:update_default_trait, r=flip1995
bors [Thu, 17 Feb 2022 09:13:30 +0000 (09:13 +0000)]
Auto merge of #8433 - hellow554:update_default_trait, r=flip1995

Don't lint Default::default if it is the udpate syntax base

changelog: Don't lint `Default::default` it is part of the update syntax

Current clippy warns about this:

```
warning: calling `Foo::default()` is more clear than this expression
  --> src/main.rs:12:11
   |
12 |         ..Default::default()
   |           ^^^^^^^^^^^^^^^^^^ help: try: `Foo::default()`
   |
```

With these changes, it will not lint that particular expression anymore.

2 years agoDon't lint Default::default if it is the udpate syntax base
Marcel Hellwig [Mon, 14 Feb 2022 12:22:36 +0000 (13:22 +0100)]
Don't lint Default::default if it is the udpate syntax base

An Update Syntax looks like this:

   Foo {
      a: 3,
      ..Default::default()
    }

Don't lint `Default::default` here

2 years agoMove some cases from `redundant_slicing` to `deref_by_slicing`
Jason Newcomb [Sun, 13 Feb 2022 23:43:19 +0000 (18:43 -0500)]
Move some cases from `redundant_slicing` to `deref_by_slicing`

2 years agoSplit off new lint `deref_by_slicing` from `redundant_slicing`
Jason Newcomb [Tue, 11 Jan 2022 17:41:15 +0000 (12:41 -0500)]
Split off new lint `deref_by_slicing` from `redundant_slicing`

2 years agoAccount for auto-borrows and precedence in `redundant_slicing` lint
Jason Newcomb [Tue, 4 Jan 2022 01:35:32 +0000 (20:35 -0500)]
Account for auto-borrows and precedence in `redundant_slicing` lint

2 years agoImprove `redundant_slicing` lint
Jason Newcomb [Mon, 3 Jan 2022 20:25:00 +0000 (15:25 -0500)]
Improve `redundant_slicing` lint

* Lint when slicing triggers auto-deref
* Lint when slicing returns the same type as dereferencing

2 years agoDon't lint `needless_borrow` in method receiver positions
Jason Newcomb [Thu, 17 Feb 2022 04:14:39 +0000 (23:14 -0500)]
Don't lint `needless_borrow` in method receiver positions

2 years agoAuto merge of #8188 - jamesmcm:recursive_display_impl, r=camsteffen
bors [Wed, 16 Feb 2022 22:01:49 +0000 (22:01 +0000)]
Auto merge of #8188 - jamesmcm:recursive_display_impl, r=camsteffen

new lint: `recursive_format_impl`

The to_string_in_display lint is renamed to recursive_format_impl
A check is added for the use of self formatted with Display or Debug inside any format string in the same impl
The to_string_in_display check is kept as is - like in the format_in_format_args lint

This is my first contribution so please check it for better / more idiomatic checks + error messages. Note the format macro paths are shared with the `format_in_format_args` lint - maybe those could be moved to clippy utils too.

This relates to issues #2691 and #7830

------

changelog: Renamed `to_string_in_display` lint to [`recursive_format_impl`] with new check for any use of self as Display or Debug inside the same format trait impl.

2 years agoAdd recursive_format_impl lint
James McMurray [Tue, 28 Dec 2021 18:27:11 +0000 (19:27 +0100)]
Add recursive_format_impl lint

The to_string_in_display lint is renamed to recursive_format_impl
A check is added for the use of self formatted with Display or Debug
inside any format string in the same impl
The to_string_in_display check is kept as is - like in the
format_in_format_args lint

For now only Display and Debug are checked
This could also be extended to other Format traits (Binary, etc.)

2 years agoAuto merge of #8425 - Jarcho:transmute_8417, r=giraffate
bors [Mon, 14 Feb 2022 06:58:51 +0000 (06:58 +0000)]
Auto merge of #8425 - Jarcho:transmute_8417, r=giraffate

Fix `transmute_undefined_repr` with single field `#[repr(C)]` structs

Fixes: #8417
The description has also been made more precise.

changelog: Fix `transmute_undefined_repr` with single field `#[repr(C)]` structs
changelog: Move `transmute_undefined_repr` back to `correctness`

2 years agoAuto merge of #8427 - Jarcho:merge_cargo_passes, r=llogiq
bors [Mon, 14 Feb 2022 06:14:02 +0000 (06:14 +0000)]
Auto merge of #8427 - Jarcho:merge_cargo_passes, r=llogiq

Merge cargo lints

changelog: None

2 years agoAuto merge of #8429 - nsunderland1:master, r=llogiq
bors [Mon, 14 Feb 2022 05:55:34 +0000 (05:55 +0000)]
Auto merge of #8429 - nsunderland1:master, r=llogiq

Document `pub` requirement for `new_without_default` lint

fixes #8415

Also adds some UI tests that ensure that `pub` is required on both the struct _and_ the field. The only thing I'm not sure about is that the lint actually [checks](https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/new_without_default.rs#L102) if `new` is _reachable_, not _public_. To the best of my understanding, both the struct and the method need to be public for the method to be reachable for external crates (I certainly didn't manage to craft a counterexample).

changelog: Document `pub` requirement for ``[`new_without_default`]`` lint.

2 years agoDocument `pub` requirement for `new_without_default` lint
nsunderland1 [Mon, 14 Feb 2022 01:07:14 +0000 (17:07 -0800)]
Document `pub` requirement for `new_without_default` lint

2 years agoMerge cargo lints
Jason Newcomb [Sun, 13 Feb 2022 21:54:33 +0000 (16:54 -0500)]
Merge cargo lints

2 years agoFix `transmute_undefined_repr` with single field `#[repr(C)]` structs
Jason Newcomb [Sun, 13 Feb 2022 18:22:17 +0000 (13:22 -0500)]
Fix `transmute_undefined_repr` with single field `#[repr(C)]` structs

2 years agoAuto merge of #8421 - Alexendoo:paths, r=llogiq
bors [Sat, 12 Feb 2022 17:24:57 +0000 (17:24 +0000)]
Auto merge of #8421 - Alexendoo:paths, r=llogiq

Replace a few paths with diagnostic items

A fairly small change towards #5393

changelog: none

2 years agoReplace a few paths with diagnostic items
Alex Macleod [Sat, 12 Feb 2022 11:44:28 +0000 (11:44 +0000)]
Replace a few paths with diagnostic items

2 years agoAuto merge of #8418 - dtolnay-contrib:transmuteundefinedrepr, r=llogiq
bors [Sat, 12 Feb 2022 07:22:13 +0000 (07:22 +0000)]
Auto merge of #8418 - dtolnay-contrib:transmuteundefinedrepr, r=llogiq

Downgrade transmute_undefined_repr to nursery

Reason: #8417. I am skeptical of this lint but maybe there is a narrower subset of types on which it is useful, so keeping it for now but moving to nursery for further development.

---

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

changelog: Remove [`transmute_undefined_repr`] from default set of enabled lints

2 years agoDowngrade transmute_undefined_repr lint to nursery
David Tolnay [Sat, 12 Feb 2022 03:40:07 +0000 (19:40 -0800)]
Downgrade transmute_undefined_repr lint to nursery

2 years agoAuto merge of #8411 - Alexendoo:dbg_macro, r=flip1995
bors [Fri, 11 Feb 2022 16:39:00 +0000 (16:39 +0000)]
Auto merge of #8411 - Alexendoo:dbg_macro, r=flip1995

Migrate `dbg_macro` to late pass

changelog: Make `dbg_macro` work with crate level attributes and inside macro calls

One down for #6610, fixes #7275

Also fixes #7274, and adds parenthesis around the suggestion for `dbg!(1, 2, 3)` as it expands to a tuple

2 years agoMigrate `dbg_macro` to late pass
Alex Macleod [Fri, 11 Feb 2022 14:45:56 +0000 (14:45 +0000)]
Migrate `dbg_macro` to late pass

2 years agoAuto merge of #8409 - flip1995:rustup, r=flip1995
bors [Thu, 10 Feb 2022 17:14:39 +0000 (17:14 +0000)]
Auto merge of #8409 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump nightly version -> 2022-02-10
flip1995 [Thu, 10 Feb 2022 17:11:49 +0000 (18:11 +0100)]
Bump nightly version -> 2022-02-10

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 10 Feb 2022 17:11:27 +0000 (18:11 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #8404 - camsteffen:rm-ui-test, r=flip1995
bors [Wed, 9 Feb 2022 09:09:58 +0000 (09:09 +0000)]
Auto merge of #8404 - camsteffen:rm-ui-test, r=flip1995

Factor out ui_test suite

changelog: none

2 years agoRollup merge of #93746 - cjgillot:nodefii, r=nikomatsakis
Yuki Okushi [Wed, 9 Feb 2022 05:12:22 +0000 (14:12 +0900)]
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.

2 years agoFactor out ui_test suite
Cameron Steffen [Tue, 8 Feb 2022 16:45:52 +0000 (10:45 -0600)]
Factor out ui_test suite

2 years agoAuto merge of #8374 - Alexendoo:bless-revisions, r=camsteffen
bors [Tue, 8 Feb 2022 20:50:41 +0000 (20:50 +0000)]
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

2 years agoAuto merge of #8400 - Jarcho:split_matches, r=Manishearth
bors [Mon, 7 Feb 2022 20:10:07 +0000 (20:10 +0000)]
Auto merge of #8400 - Jarcho:split_matches, r=Manishearth

Split matches

Part of #6680

changelog: None

2 years agoSplit out `wild_in_or_pats`
Jason Newcomb [Mon, 7 Feb 2022 18:00:19 +0000 (13:00 -0500)]
Split out `wild_in_or_pats`

2 years agoSplit out `rest_pat_in_fully_bound_struct`
Jason Newcomb [Mon, 7 Feb 2022 17:57:02 +0000 (12:57 -0500)]
Split out `rest_pat_in_fully_bound_struct`

2 years agoSplit out `infalliable_detructuring_match`
Jason Newcomb [Mon, 7 Feb 2022 17:28:57 +0000 (12:28 -0500)]
Split out `infalliable_detructuring_match`

2 years agoSplit out `match_ref_pats`
Jason Newcomb [Sun, 6 Feb 2022 21:44:52 +0000 (16:44 -0500)]
Split out `match_ref_pats`

2 years agoSplit out `match_single_binding`
Jason Newcomb [Sun, 6 Feb 2022 21:38:34 +0000 (16:38 -0500)]
Split out `match_single_binding`

2 years agoSplit out `match_as_ref`
Jason Newcomb [Sun, 6 Feb 2022 21:24:14 +0000 (16:24 -0500)]
Split out `match_as_ref`

2 years agoSplit out `wildcard_enum_match_arm` and `match_wildcard_for_single_variants`
Jason Newcomb [Sun, 6 Feb 2022 21:18:05 +0000 (16:18 -0500)]
Split out `wildcard_enum_match_arm` and `match_wildcard_for_single_variants`

2 years agoSplit out `match_wild_err_arm`
Jason Newcomb [Sun, 6 Feb 2022 21:08:05 +0000 (16:08 -0500)]
Split out `match_wild_err_arm`

2 years agoSplit out `overlapping_arms`
Jason Newcomb [Sun, 6 Feb 2022 19:36:24 +0000 (14:36 -0500)]
Split out `overlapping_arms`

2 years agoSplit out `match_bool`
Jason Newcomb [Sun, 6 Feb 2022 19:25:53 +0000 (14:25 -0500)]
Split out `match_bool`

2 years agoSplit out `single_match`
Jason Newcomb [Sun, 6 Feb 2022 19:18:00 +0000 (14:18 -0500)]
Split out `single_match`

2 years agoSplit out `redundant_pattern_match`
Jason Newcomb [Sun, 6 Feb 2022 19:03:45 +0000 (14:03 -0500)]
Split out `redundant_pattern_match`

2 years agoSplit out `match_same_arms`
Jason Newcomb [Sun, 6 Feb 2022 18:53:51 +0000 (13:53 -0500)]
Split out `match_same_arms`

2 years agoSplit out `match_like_matches_macro`
Jason Newcomb [Sun, 6 Feb 2022 18:42:17 +0000 (13:42 -0500)]
Split out `match_like_matches_macro`

2 years agoMove `matches.rs` to `mod.rs`
Jason Newcomb [Sun, 6 Feb 2022 18:35:57 +0000 (13:35 -0500)]
Move `matches.rs` to `mod.rs`

2 years agoAuto merge of #8305 - camsteffen:util-cleanup, r=flip1995
bors [Mon, 7 Feb 2022 15:23:23 +0000 (15:23 +0000)]
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.

2 years agoAuto merge of #8326 - matthiaskrgr:warn_on_multi_configs, r=xFrednet
bors [Sun, 6 Feb 2022 17:19:11 +0000 (17:19 +0000)]
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

2 years agoignore test on windows since I don't know why compiletest does not hand paths properl...
Matthias Krüger [Wed, 2 Feb 2022 20:21:20 +0000 (21:21 +0100)]
ignore test on windows since I don't know why compiletest does not hand paths properly there

2 years agoAuto merge of #8398 - Jarcho:unordered_transmute, r=llogiq
bors [Sun, 6 Feb 2022 16:05:00 +0000 (16:05 +0000)]
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`

2 years agoSmall `transmute_float_to_int` cleanup
Jason Newcomb [Sun, 6 Feb 2022 14:42:10 +0000 (09:42 -0500)]
Small `transmute_float_to_int` cleanup

2 years agoSupport `cargo dev bless` for tests with revisions
Alex Macleod [Sun, 30 Jan 2022 16:39:30 +0000 (16:39 +0000)]
Support `cargo dev bless` for tests with revisions

2 years agoAdd lint `transumte_undefined_repr`
Jason Newcomb [Tue, 1 Feb 2022 19:53:12 +0000 (14:53 -0500)]
Add lint `transumte_undefined_repr`

2 years agoAuto merge of #8365 - Alexendoo:explicit-write-suggestion, r=camsteffen
bors [Sat, 5 Feb 2022 17:44:37 +0000 (17:44 +0000)]
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!()`

2 years agoAuto merge of #8372 - tamaroning:unwrap_used, r=llogiq
bors [Sat, 5 Feb 2022 14:56:42 +0000 (14:56 +0000)]
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()`

2 years agoAdd `explicit_write` suggestions for `write!`s with format args
Alex Macleod [Fri, 28 Jan 2022 14:58:14 +0000 (14:58 +0000)]
Add `explicit_write` suggestions for `write!`s with format args

2 years agoUse source callsite in FormatArgsExpn::inputs_span
Alex Macleod [Fri, 28 Jan 2022 14:42:19 +0000 (14:42 +0000)]
Use source callsite in FormatArgsExpn::inputs_span

2 years agoAuto merge of #8376 - dswij:8373, r=camsteffen
bors [Sat, 5 Feb 2022 00:32:10 +0000 (00:32 +0000)]
Auto merge of #8376 - dswij:8373, r=camsteffen

[`chars_next_cmp`] Fix unescaped suggestion

closes #8373

changelog: [`chars_next_cmp`] Fix unescaped suggestion

2 years agoRemove defaultness from ImplItem.
Camille GILLOT [Wed, 2 Feb 2022 11:44:51 +0000 (12:44 +0100)]
Remove defaultness from ImplItem.

2 years agoLazily resolve type-alias-impl-trait defining uses
Oli Scherer [Fri, 20 Aug 2021 14:47:12 +0000 (14:47 +0000)]
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.

2 years agoAuto merge of #8382 - tamaroning:suggest_iter_instead_of_into_iter, r=giraffate
bors [Wed, 2 Feb 2022 12:37:18 +0000 (12:37 +0000)]
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

2 years agochore
tamaron [Wed, 2 Feb 2022 02:25:15 +0000 (11:25 +0900)]
chore

2 years agoAuto merge of #8370 - smoelius:master, r=flip1995
bors [Tue, 1 Feb 2022 21:18:45 +0000 (21:18 +0000)]
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

2 years agoAuto merge of #8387 - Jarcho:ptr_arg_8386, r=flip1995
bors [Tue, 1 Feb 2022 20:48:07 +0000 (20:48 +0000)]
Auto merge of #8387 - Jarcho:ptr_arg_8386, r=flip1995

Fix ICE in `ptr_arg`

fixes: #8386

changelog: None

2 years agoFix ICE in `ptr_arg`
Jason Newcomb [Tue, 1 Feb 2022 20:05:20 +0000 (15:05 -0500)]
Fix ICE in `ptr_arg`

2 years agoAuto merge of #8330 - flip1995:changelog, r=llogiq
bors [Tue, 1 Feb 2022 19:30:25 +0000 (19:30 +0000)]
Auto merge of #8330 - flip1995:changelog, r=llogiq

Update Changelog

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

changelog: none

2 years agoMinor cleanup on transmute lints
Jason Newcomb [Tue, 1 Feb 2022 15:53:25 +0000 (10:53 -0500)]
Minor cleanup on transmute lints

2 years agoRollup merge of #93290 - lcnr:same_type, r=jackh726
Matthias Krüger [Tue, 1 Feb 2022 15:08:05 +0000 (16:08 +0100)]
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

2 years agoremove `TyS::same_type`
lcnr [Tue, 25 Jan 2022 07:42:52 +0000 (08:42 +0100)]
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

2 years agosilence lint in clippy
lcnr [Tue, 1 Feb 2022 09:13:32 +0000 (10:13 +0100)]
silence lint in clippy

2 years agoupdate test suites
tamaron [Tue, 1 Feb 2022 04:44:24 +0000 (13:44 +0900)]
update test suites

2 years agofix code
tamaron [Tue, 1 Feb 2022 04:43:39 +0000 (13:43 +0900)]
fix code

2 years agomultiple configs: add tests
Matthias Krüger [Sun, 30 Jan 2022 12:32:35 +0000 (13:32 +0100)]
multiple configs: add tests

2 years agowarn if we find multiple clippy configs
Matthias Krüger [Thu, 20 Jan 2022 22:00:50 +0000 (23:00 +0100)]
warn if we find multiple clippy configs

Fixes #8323

2 years agoAuto merge of #8369 - Jarcho:ptr_arg_8366, r=flip1995
bors [Mon, 31 Jan 2022 15:17:38 +0000 (15:17 +0000)]
Auto merge of #8369 - Jarcho:ptr_arg_8366, r=flip1995

Don't lint `ptr_arg` for `&mut _` types in trait items

fixes #8366

changelog: Don't lint `ptr_arg` for `&mut _` types in trait items

2 years agoFix `chars_next_cmp` suggestion not escaped
dswij [Mon, 31 Jan 2022 05:35:14 +0000 (13:35 +0800)]
Fix `chars_next_cmp` suggestion not escaped

2 years agoAuto merge of #90891 - nbdd0121:format, r=Mark-Simulacrum
bors [Mon, 31 Jan 2022 00:04:46 +0000 (00:04 +0000)]
Auto merge of #90891 - nbdd0121:format, r=Mark-Simulacrum

Create `core::fmt::ArgumentV1` with generics instead of fn pointer

Split from (and prerequisite of) #90488, as this seems to have perf implication.

`@rustbot` label: +T-libs

2 years agoAuto merge of #8322 - jubnzv:8282-single-match, r=llogiq
bors [Sun, 30 Jan 2022 22:00:36 +0000 (22:00 +0000)]
Auto merge of #8322 - jubnzv:8282-single-match, r=llogiq

single_match: Don't lint non-exhaustive matches; support tuples

`single_match` lint:
* Don't lint exhaustive enum patterns without a wild.
  Rationale: The definition of the enum could be changed, so the user can get non-exhaustive match after applying the suggested lint (see https://github.com/rust-lang/rust-clippy/issues/8282#issuecomment-1013566068 for context).
* Lint `match` constructions with tuples (as suggested at https://github.com/rust-lang/rust-clippy/issues/8282#issuecomment-1015621148)

Closes #8282

---

changelog: [`single_match`]: Don't lint exhaustive enum patterns without a wild.
changelog: [`single_match`]: Lint `match` constructions with tuples

2 years agoadd attributes
tamaron [Sun, 30 Jan 2022 06:39:47 +0000 (15:39 +0900)]
add attributes

2 years agoupdate get_unwrap.rs
tamaron [Sun, 30 Jan 2022 05:59:46 +0000 (14:59 +0900)]
update get_unwrap.rs

2 years agofix code
tamaron [Sun, 30 Jan 2022 05:59:25 +0000 (14:59 +0900)]
fix code

2 years agoupdate testsuite
tamaron [Sun, 30 Jan 2022 03:58:49 +0000 (12:58 +0900)]
update testsuite