]> git.lizzy.rs Git - rust.git/log
rust.git
23 months agoAuto merge of #9318 - lukaslueg:ifletmutexref, r=xFrednet
bors [Mon, 15 Aug 2022 21:31:37 +0000 (21:31 +0000)]
Auto merge of #9318 - lukaslueg:ifletmutexref, r=xFrednet

Fix if_let_mutex not checking Mutexes behind refs

Fixes #9193

We can always peel references because we are looking for a method-call, for which autoderef applies.

---

changelog: [`if_let_mutex`]: detect calls to `Mutex::lock()` if mutex is behind a ref
changelog: [`if_let_mutex`]: Add labels to the two instances of the same Mutex that will deadlock

23 months agoFix label not starting with lcase-letter
lukaslueg [Mon, 15 Aug 2022 18:13:31 +0000 (20:13 +0200)]
Fix label not starting with lcase-letter

Co-authored-by: Fridtjof Stoldt <xFrednet@gmail.com>
23 months agoAuto merge of #9329 - xphoniex:fix-#9317, r=flip1995
bors [Mon, 15 Aug 2022 10:01:20 +0000 (10:01 +0000)]
Auto merge of #9329 - xphoniex:fix-#9317, r=flip1995

Skip `unnecessary_to_owned` when `t != t.to_string()`

Fixes #9317

changelog: [`unnecessary_to_owned`]: none

23 months agoSkip `unnecessary_to_owned` when `t != t.to_string()`
xphoniex [Sun, 14 Aug 2022 16:29:26 +0000 (16:29 +0000)]
Skip `unnecessary_to_owned` when `t != t.to_string()`

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
23 months agoAuto merge of #9187 - sgued:iter-once, r=flip1995
bors [Sun, 14 Aug 2022 15:45:17 +0000 (15:45 +0000)]
Auto merge of #9187 - sgued:iter-once, r=flip1995

Add lint recommending using `std::iter::once` and `std::iter::empty`

```
changelog: [`iter_once`]: add new lint
changelog: [`iter_empty`]: add new lint
```

fixes #9186

- \[ ] Followed [lint naming conventions][lint_naming]
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints`
- \[x] Added lint documentation
- \[x] Run `cargo dev fmt`

[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints

The lint doesn't really follow the naming conventions. I don't have any better idea so I'm open to suggestions.

23 months agoAuto merge of #9167 - aldhsu:fix-trait-duplication-false-pos, r=flip1995
bors [Sun, 14 Aug 2022 14:46:26 +0000 (14:46 +0000)]
Auto merge of #9167 - aldhsu:fix-trait-duplication-false-pos, r=flip1995

Fixes [`trait_duplication_in_bounds`] false positives

Fixes #9076 #9151 #8757.
Partially fixes #8771.

changelog: [`trait_duplication_in_bounds`]: Reduce number of false positives.

23 months agoAuto merge of #9326 - flip1995:version-update, r=xFrednet
bors [Sat, 13 Aug 2022 10:02:57 +0000 (10:02 +0000)]
Auto merge of #9326 - flip1995:version-update, r=xFrednet

Update lint versions for 1.63 release

r? `@xFrednet`

changelog: none

23 months agoUpdate lint versions for 1.63 release
flip1995 [Fri, 12 Aug 2022 21:19:53 +0000 (23:19 +0200)]
Update lint versions for 1.63 release

23 months agoAuto merge of #9324 - flip1995:changelog, r=xFrednet
bors [Fri, 12 Aug 2022 21:11:33 +0000 (21:11 +0000)]
Auto merge of #9324 - flip1995:changelog, r=xFrednet

1.63 Changelog

r? `@xFrednet`

changelog: none

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

23 months agoUpdate Changelog to 1.63
flip1995 [Mon, 8 Aug 2022 19:42:27 +0000 (21:42 +0200)]
Update Changelog to 1.63

23 months agoAuto merge of #9289 - mkrasnitski:9094, r=xFrednet
bors [Fri, 12 Aug 2022 06:25:59 +0000 (06:25 +0000)]
Auto merge of #9289 - mkrasnitski:9094, r=xFrednet

Extend `if_then_some_else_none` to also suggest `bool::then_some`

Closes #9094.

changelog: Extend `if_then_some_else_none` to also suggest `bool::then_some`

23 months agoLint trait duplication in one pass.
Allen Hsu [Fri, 12 Aug 2022 02:51:58 +0000 (12:51 +1000)]
Lint trait duplication in one pass.

23 months agoAdjust lint description for better clarity
Michael Krasnitski [Fri, 12 Aug 2022 02:41:25 +0000 (22:41 -0400)]
Adjust lint description for better clarity

23 months agoAuto merge of #9323 - flip1995:rustup, r=flip1995
bors [Thu, 11 Aug 2022 17:28:47 +0000 (17:28 +0000)]
Auto merge of #9323 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

23 months agoBump Clippy version -> 0.1.65
Philipp Krones [Thu, 11 Aug 2022 17:26:38 +0000 (19:26 +0200)]
Bump Clippy version -> 0.1.65

23 months agoBump nightly version -> 2022-08-11
Philipp Krones [Thu, 11 Aug 2022 17:26:26 +0000 (19:26 +0200)]
Bump nightly version -> 2022-08-11

23 months agoMerge remote-tracking branch 'upstream/master' into rustup
Philipp Krones [Thu, 11 Aug 2022 17:26:04 +0000 (19:26 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

23 months agoAdd labels to if_let_mutex
Lukas Lueg [Wed, 10 Aug 2022 18:56:44 +0000 (20:56 +0200)]
Add labels to if_let_mutex

23 months agoFix if_let_mutex not checking Mutexes behind refs
Lukas Lueg [Wed, 10 Aug 2022 17:40:42 +0000 (19:40 +0200)]
Fix if_let_mutex not checking Mutexes behind refs

Fixes #9193

23 months agoAuto merge of #9308 - daxpedda:missing-const-for-fn, r=Jarcho
bors [Tue, 9 Aug 2022 03:44:21 +0000 (03:44 +0000)]
Auto merge of #9308 - daxpedda:missing-const-for-fn, r=Jarcho

Use `check_proc_macro` for `missing_const_for_fn`

This uses `@Jarcho's` #8694 implementation to fix `missing_const_for_fn` linting in proc-macros.
I'm not 100% sure what I'm doing here, any feedback is appreciated.

Previously: https://github.com/Jarcho/rust-clippy/pull/1.
Fixes #8854.

changelog: [`missing_const_for_fn`]: No longer lints in proc-macros

23 months agoAddress review take 2
dAxpeDDa [Tue, 9 Aug 2022 03:14:03 +0000 (05:14 +0200)]
Address review take 2

23 months agoAddress review
dAxpeDDa [Tue, 9 Aug 2022 02:48:05 +0000 (04:48 +0200)]
Address review

23 months agoUse `check_proc_macro` for `missing_const_for_fn`
dAxpeDDa [Tue, 9 Aug 2022 01:26:08 +0000 (03:26 +0200)]
Use `check_proc_macro` for `missing_const_for_fn`

23 months agoAuto merge of #9288 - lukaslueg:partialeqnone, r=Jarcho
bors [Tue, 9 Aug 2022 00:12:29 +0000 (00:12 +0000)]
Auto merge of #9288 - lukaslueg:partialeqnone, r=Jarcho

Add partialeq_to_none lint

Initial implementation of #9275, adding lint `partialeq_to_none`. This is my first time working on `clippy`, so please review carefully.

I'm unsure especially about the `Sugg`, as it covers the entire `BinOp`, instead of just covering one of the sides and the operator (see the multi-line example). I was unsure if pinpointing the suggestion wouldn't be brittle...

changelog: [`PARTIALEQ_TO_NONE`]: Initial commit

23 months agoRename new lints to iter_on_empty_collections and iter_on_single_items
Sosthène Guédon [Sat, 30 Jul 2022 11:39:55 +0000 (13:39 +0200)]
Rename new lints to iter_on_empty_collections and iter_on_single_items

23 months agoPrevent some false positives
Sosthène Guédon [Thu, 28 Jul 2022 20:54:23 +0000 (22:54 +0200)]
Prevent some false positives

23 months agoImprove suggestions
Sosthène Guédon [Tue, 19 Jul 2022 20:08:03 +0000 (22:08 +0200)]
Improve suggestions

23 months agoMove iter_once and iter_empty to methods as a late pass
Sosthène Guédon [Sat, 16 Jul 2022 21:07:06 +0000 (23:07 +0200)]
Move iter_once and iter_empty to methods as a late pass

This enables more thorough checking of types to avoid triggering on
custom Some and None enum variants

23 months agoFix the lint in clippy itself
Sosthène Guédon [Sat, 16 Jul 2022 10:44:33 +0000 (12:44 +0200)]
Fix the lint in clippy itself

23 months agoAdd iter_once and iter_empty lints
Sosthène Guédon [Sat, 16 Jul 2022 08:22:43 +0000 (10:22 +0200)]
Add iter_once and iter_empty lints

23 months agoAdd partialeq_to_none lint
Lukas Lueg [Wed, 3 Aug 2022 20:13:06 +0000 (22:13 +0200)]
Add partialeq_to_none lint

Fixes #9275

23 months agoAuto merge of #9306 - guerinoni:rename-logic-bug, r=llogiq,xFrednet
bors [Mon, 8 Aug 2022 17:04:06 +0000 (17:04 +0000)]
Auto merge of #9306 - guerinoni:rename-logic-bug, r=llogiq,xFrednet

Rename `logic_bug` to `overly_complex_bool_expr`

Closes #1916

changelog: Rename `logic_bug` to [`overly_complex_bool_expr`]

23 months agoRename `logic_bug` to `overly_complex_bool_expr`
Federico Guerinoni [Mon, 8 Aug 2022 16:12:24 +0000 (18:12 +0200)]
Rename `logic_bug` to `overly_complex_bool_expr`

Closes #1916

23 months agoAuto merge of #9126 - Jarcho:auto_deref_sugg, r=Manishearth
bors [Mon, 8 Aug 2022 15:20:24 +0000 (15:20 +0000)]
Auto merge of #9126 - Jarcho:auto_deref_sugg, r=Manishearth

`explicit_auto_deref` changes

fixes #9123
fixes #9109
fixes #9143
fixes #9101

This avoid suggesting code which hits a rustc bug. Basically `&{x}` won't use auto-deref if the target type is `Sized`.

changelog: Don't suggest using auto deref for block expressions when the target type is `Sized`
changelog: Include the borrow in the suggestion for `explicit_auto_deref`
changelog: Don't lint `explicit_auto_deref` on `dyn Trait` return
changelog: Don't lint `explicit_auto_deref` when other adjustments are required
changelog: Lint `explicit_auto_deref` in implicit return positions for closures

23 months agoLint `explicit_auto_deref` in implicit return positions for closures
Jason Newcomb [Mon, 8 Aug 2022 14:25:05 +0000 (10:25 -0400)]
Lint `explicit_auto_deref` in implicit return positions for closures

23 months agoFix ICE when checking the HIR ty of closure args.
Jason Newcomb [Mon, 8 Aug 2022 14:09:05 +0000 (10:09 -0400)]
Fix ICE when checking the HIR ty of closure args.

23 months agoAuto merge of #9303 - Jarcho:ice_9297, r=Alexendoo
bors [Mon, 8 Aug 2022 11:36:27 +0000 (11:36 +0000)]
Auto merge of #9303 - Jarcho:ice_9297, r=Alexendoo

Fix ICE when reading literals with weird proc-macro spans

fixes #9297
changelog: Fix ICE when reading literals with weird proc-macro spans

23 months agoAuto merge of #8694 - Jarcho:check_proc_macro, r=xFrednet
bors [Mon, 8 Aug 2022 09:27:33 +0000 (09:27 +0000)]
Auto merge of #8694 - Jarcho:check_proc_macro, r=xFrednet

More proc-macro detection

fixes #6514
fixes #8683
fixes #6858
fixes #6594

This is a more general way of checking if an expression comes from a macro and could be trivially applied to other lints. Ideally this would be fixed in rustc's proc-macro api, but I don't see that happening any time soon.

changelog: FPs: [`unit_arg`] [`default_trait_access`] [`missing_docs_in_private_items`]: No longer trigger in code generated from proc-macros.

23 months agoAuto merge of #9302 - Jarcho:sig_drop_nursery, r=flip1995
bors [Mon, 8 Aug 2022 08:28:06 +0000 (08:28 +0000)]
Auto merge of #9302 - Jarcho:sig_drop_nursery, r=flip1995

Move `significant_drop_in_scrutinee` into `nursey`

The current suggestion of extending the lifetime of every sub-expression is not great and doesn't fix the error given in the lint's example, though it does make the potential deadlock easier to see, but it can also cause it's own issues by delaying the drop of the lock guard.

e.g.
```rust
match x.lock().foo {
    ..
}
// some stuff
let y = x.lock();
```
The suggestion would create a deadlock at the second `x.lock()` call.

This also lints even when a significant drop type isn't created as a temporary. (#9072)

I agree `@kpreid` (https://github.com/rust-lang/rust-clippy/issues/8987#issuecomment-1207464440) that this should be back-ported before the lint hits stable.

changelog: Move `significant_drop_in_scrutinee` into `nursey`

23 months agoFix ICE when reading literals with weird proc-macro spans
Jason Newcomb [Mon, 8 Aug 2022 02:22:17 +0000 (22:22 -0400)]
Fix ICE when reading literals with weird proc-macro spans

23 months agoSmall cleanup for `check_proc_macro.rs`
Jason Newcomb [Mon, 8 Aug 2022 01:44:32 +0000 (21:44 -0400)]
Small cleanup for `check_proc_macro.rs`

23 months agoAdd note to the docs on `is_from_proc_macro`
Jason Newcomb [Sun, 24 Apr 2022 14:04:33 +0000 (10:04 -0400)]
Add note to the docs on `is_from_proc_macro`

23 months agoDon't lint `default_trait_access` in proc-macro expansions
Jason Newcomb [Wed, 13 Apr 2022 14:13:39 +0000 (10:13 -0400)]
Don't lint `default_trait_access` in proc-macro expansions

23 months agoDon't lint `missing_docs_in_private_items` on proc-macro output
Jason Newcomb [Wed, 13 Apr 2022 13:23:12 +0000 (09:23 -0400)]
Don't lint `missing_docs_in_private_items` on proc-macro output

23 months agoUse new util function in `suspicious_else_formatting`
Jason Newcomb [Wed, 13 Apr 2022 05:13:47 +0000 (01:13 -0400)]
Use new util function in `suspicious_else_formatting`

23 months agoDon't lint `unit_arg` when expanded from a proc-macro
Jason Newcomb [Wed, 13 Apr 2022 04:36:13 +0000 (00:36 -0400)]
Don't lint `unit_arg` when expanded from a proc-macro

23 months agoMove `significant_drop_in_scrutinee` into `nursey`
Jason Newcomb [Mon, 8 Aug 2022 01:01:27 +0000 (21:01 -0400)]
Move `significant_drop_in_scrutinee` into `nursey`

23 months agoAuto merge of #99743 - compiler-errors:fulfillment-context-cleanups, r=jackh726
bors [Sat, 6 Aug 2022 06:48:15 +0000 (06:48 +0000)]
Auto merge of #99743 - compiler-errors:fulfillment-context-cleanups, r=jackh726

Some `FulfillmentContext`-related cleanups

Use `ObligationCtxt` in some places, remove some `FulfillmentContext`s in others...

r? types

23 months agoAuto merge of #9294 - alex-semenyuk:enable_def_id_nocore_on_windows, r=xFrednet
bors [Fri, 5 Aug 2022 21:08:19 +0000 (21:08 +0000)]
Auto merge of #9294 - alex-semenyuk:enable_def_id_nocore_on_windows, r=xFrednet

Enable test for def_id_nocore for windows

Verified that it actully works on windows
changelog: none

23 months agoEnable test for def_id_nocore for windows
alex-semenyuk [Fri, 5 Aug 2022 20:24:50 +0000 (23:24 +0300)]
Enable test for def_id_nocore for windows

23 months agoAuto merge of #9292 - alex-semenyuk:typos_fixed, r=Alexendoo
bors [Fri, 5 Aug 2022 09:19:07 +0000 (09:19 +0000)]
Auto merge of #9292 - alex-semenyuk:typos_fixed, r=Alexendoo

Fix some typos

changelog: none

23 months agoFix some typos
alex-semenyuk [Thu, 4 Aug 2022 21:59:21 +0000 (00:59 +0300)]
Fix some typos

23 months agoAuto merge of #9266 - alex-semenyuk:cast_abs_to_unsigned_paren_fix, r=Jarcho
bors [Thu, 4 Aug 2022 18:45:32 +0000 (18:45 +0000)]
Auto merge of #9266 - alex-semenyuk:cast_abs_to_unsigned_paren_fix, r=Jarcho

Fix cast_abs_to_unsigned with code in parens

Close #9185
changelog: none

23 months agoFix cast_abs_to_unsigned generates non-compiling code when original code is in parens
alex-semenyuk [Sat, 30 Jul 2022 14:21:37 +0000 (17:21 +0300)]
Fix cast_abs_to_unsigned generates non-compiling code when original code is in parens

23 months agoFix some typos
alex-semenyuk [Thu, 4 Aug 2022 16:53:07 +0000 (19:53 +0300)]
Fix some typos

23 months agoAdd `traits::fully_solve_obligation` that acts like `traits::fully_normalize`
Michael Goulet [Tue, 2 Aug 2022 06:02:04 +0000 (06:02 +0000)]
Add `traits::fully_solve_obligation` that acts like `traits::fully_normalize`

It spawns up a trait engine, registers the single obligation, then fully
solves it

23 months agoExtend `if_then_some_else_none` to also suggest `bool::then_some`
Michael Krasnitski [Thu, 4 Aug 2022 03:06:12 +0000 (23:06 -0400)]
Extend `if_then_some_else_none` to also suggest `bool::then_some`

2 years agoAuto merge of #9284 - lengyijun:typo, r=dswij
bors [Wed, 3 Aug 2022 10:33:45 +0000 (10:33 +0000)]
Auto merge of #9284 - lengyijun:typo, r=dswij

fix typo in tests/ui/redundant_allocation.rs

changelog: none

2 years agoWarn about dead tuple struct fields
Fabian Wolff [Mon, 25 Jul 2022 20:36:03 +0000 (22:36 +0200)]
Warn about dead tuple struct fields

2 years agoAuto merge of #9282 - macovedj:clone-on-copy-try-precedence, r=flip1995
bors [Wed, 3 Aug 2022 07:37:43 +0000 (07:37 +0000)]
Auto merge of #9282 - macovedj:clone-on-copy-try-precedence, r=flip1995

add paren before '?' when suggesting deref for clone_on_copy

changelog: none

fixes #9277

2 years agofix typo in tests/ui/redundant_allocation.rs
lengyijun [Wed, 3 Aug 2022 03:56:59 +0000 (03:56 +0000)]
fix typo in tests/ui/redundant_allocation.rs

2 years agoclean up
Daniel Macovei [Tue, 2 Aug 2022 17:06:22 +0000 (12:06 -0500)]
clean up

2 years agoadd paren before '?' when suggesting deref
Daniel Macovei [Tue, 2 Aug 2022 15:39:35 +0000 (10:39 -0500)]
add paren before '?' when suggesting deref

2 years agoRollup merge of #100053 - flip1995:clippy_backport, r=xFrednet
Matthias Krüger [Tue, 2 Aug 2022 15:17:36 +0000 (17:17 +0200)]
Rollup merge of #100053 - flip1995:clippy_backport, r=xFrednet

move [`assertions_on_result_states`] to restriction

"Backports" the first commit of https://github.com/rust-lang/rust-clippy/pull/9273, so that the lint doesn't go into beta as a warn-by-default lint.

The other changes in the linked PR can ride the train as usual.

r? ``@xFrednet`` (only Clippy changes, so we don't need to bother compiler people)

---

For Clippy:

changelog: none

2 years agoRollup merge of #99987 - Alexendoo:parse-format-position-span, r=fee1-dead
Matthias Krüger [Tue, 2 Aug 2022 15:17:30 +0000 (17:17 +0200)]
Rollup merge of #99987 - Alexendoo:parse-format-position-span, r=fee1-dead

Always include a position span in `rustc_parse_format::Argument`

Moves the spans from the `Position` enum to always be included in the `Argument` struct. Doesn't make any changes to use it in rustc, but it will be useful for some upcoming Clippy lints

2 years agoAuto merge of #9053 - AaronC81:fix-9052, r=flip1995
bors [Tue, 2 Aug 2022 12:39:37 +0000 (12:39 +0000)]
Auto merge of #9053 - AaronC81:fix-9052, r=flip1995

Fix suggestions for `async` closures in redundant_closure_call

Fixes #9052

changelog: Fix suggestions given by [`redundant_closure_call`] for async closures

2 years agoAdd extra test cases from #8771, #8757, #9076.
Allen Hsu [Wed, 13 Jul 2022 11:39:52 +0000 (21:39 +1000)]
Add extra test cases from #8771, #8757, #9076.

2 years agoSplit unfixable lints.
Allen Hsu [Wed, 13 Jul 2022 11:25:19 +0000 (21:25 +1000)]
Split unfixable lints.

2 years agoCompare where predicates to trait bounds.
Allen Hsu [Tue, 12 Jul 2022 12:29:12 +0000 (22:29 +1000)]
Compare where predicates to trait bounds.

- only compare where predicates to trait bounds when generating where
  clause specific message to fix #9151
- use comparable_trait_ref to account for trait bound generics to fix #8757

2 years agoAuto merge of #9264 - guerinoni:instant-elapsed, r=Alexendoo
bors [Tue, 2 Aug 2022 11:16:47 +0000 (11:16 +0000)]
Auto merge of #9264 - guerinoni:instant-elapsed, r=Alexendoo

Add `elapsed_instant` lint

Closes #8603

- \[x] Followed [lint naming conventions][lint_naming]
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints`
- \[x] Added lint documentation
- \[x] Run `cargo dev fmt`

---

changelog: [`elapsed_instant`]: Add lint

2 years agoAuto merge of #9279 - tabokie:weight-loss, r=flip1995
bors [Tue, 2 Aug 2022 10:33:19 +0000 (10:33 +0000)]
Auto merge of #9279 - tabokie:weight-loss, r=flip1995

chore: a few small improvements to code quality

Some improvements:
- Simplify implementation of `is_unit_type`
- Use slice matching to destruct `Call` or `MethodCall` whenever possible

changelog: none

r? `@flip1995`

2 years agouse slice match more often
tabokie [Tue, 2 Aug 2022 04:01:36 +0000 (12:01 +0800)]
use slice match more often

Signed-off-by: tabokie <xy.tao@outlook.com>
2 years agosimplify unit type check
tabokie [Tue, 2 Aug 2022 03:37:44 +0000 (11:37 +0800)]
simplify unit type check

Signed-off-by: tabokie <xy.tao@outlook.com>
2 years agomove [`assertions_on_result_states`] to restriction
tabokie [Mon, 1 Aug 2022 05:22:16 +0000 (13:22 +0800)]
move [`assertions_on_result_states`] to restriction

Signed-off-by: tabokie <xy.tao@outlook.com>
2 years agoAuto merge of #9254 - alex-semenyuk:enable_empty_loop_no_std_on_windows, r=dswij
bors [Tue, 2 Aug 2022 06:44:03 +0000 (06:44 +0000)]
Auto merge of #9254 - alex-semenyuk:enable_empty_loop_no_std_on_windows, r=dswij

Enable test empty_loop_no_std on windows

Verified that it actully works on windows
changelog: none

2 years agoAdd `elapsed_instant` lint
Federico Guerinoni [Sat, 30 Jul 2022 12:33:10 +0000 (14:33 +0200)]
Add `elapsed_instant` lint

Closes #8603

Signed-off-by: Federico Guerinoni <guerinoni.federico@gmail.com>
2 years agoRemove DefId from AssocItemContainer.
Camille GILLOT [Sat, 12 Mar 2022 23:52:25 +0000 (00:52 +0100)]
Remove DefId from AssocItemContainer.

2 years agoStore associated item defaultness in impl_defaultness.
Camille GILLOT [Sat, 12 Mar 2022 18:36:11 +0000 (19:36 +0100)]
Store associated item defaultness in impl_defaultness.

2 years agoAuto merge of #99884 - nnethercote:lexer-improvements, r=matklad
bors [Mon, 1 Aug 2022 12:52:49 +0000 (12:52 +0000)]
Auto merge of #99884 - nnethercote:lexer-improvements, r=matklad

Lexer improvements

Some cleanups and small speed improvements.

r? `@matklad`

2 years agoAuto merge of #9273 - tabokie:assert_ok_fp, r=flip1995
bors [Mon, 1 Aug 2022 12:16:45 +0000 (12:16 +0000)]
Auto merge of #9273 - tabokie:assert_ok_fp, r=flip1995

Move [`assertions_on_result_states`] to restriction

Close #9263

This lint causes regression on readability of code and log output. And printing runtime values is not particularly useful for majority of tests which should be reproducible.

changelog: Move [`assertions_on_result_states`] to restriction and don't lint it for unit type

Signed-off-by: tabokie <xy.tao@outlook.com>
2 years agodo not apply [`assertions_on_result_states`] to unwrap unit type
tabokie [Mon, 1 Aug 2022 05:30:43 +0000 (13:30 +0800)]
do not apply [`assertions_on_result_states`] to unwrap unit type

Signed-off-by: tabokie <xy.tao@outlook.com>
2 years agoAuto merge of #9270 - schubart:link_to_developer_guide, r=xFrednet
bors [Mon, 1 Aug 2022 08:11:50 +0000 (08:11 +0000)]
Auto merge of #9270 - schubart:link_to_developer_guide, r=xFrednet

Make it easier to find the developer guide

changelog: none

2 years agoMake it easier to find the developer guide
Michael Schubart [Sun, 31 Jul 2022 22:16:23 +0000 (23:16 +0100)]
Make it easier to find the developer guide

Adding the link that I wish had been there when I first looked for
this info.

2 years agomove [`assertions_on_result_states`] to restriction
tabokie [Mon, 1 Aug 2022 05:22:16 +0000 (13:22 +0800)]
move [`assertions_on_result_states`] to restriction

Signed-off-by: tabokie <xy.tao@outlook.com>
2 years agoAuto merge of #9223 - sgued:unwrap-expect-used, r=giraffate
bors [Mon, 1 Aug 2022 01:27:03 +0000 (01:27 +0000)]
Auto merge of #9223 - sgued:unwrap-expect-used, r=giraffate

unwrap_used: Don't recommend using `expect` when the `expect_used` lint is not allowed

Fixes #9222

```
changelog: [`unwrap_used`]: Don't recommend using `expect` when the `expect_used` lint is not allowed
```

2 years agoShrink `Token`.
Nicholas Nethercote [Wed, 27 Jul 2022 03:59:30 +0000 (13:59 +1000)]
Shrink `Token`.

From 72 bytes to 12 bytes (on x86-64).

There are two parts to this:
- Changing various source code offsets from 64-bit to 32-bit. This is
  not a problem because the rest of rustc also uses 32-bit source code
  offsets. This means `Token` is no longer `Copy` but this causes no
  problems.
- Removing the `RawStrError` from `LiteralKind`. Raw string literal
  invalidity is now indicated by a `None` value within
  `RawStr`/`RawByteStr`, and the new `validate_raw_str` function can be
  used to re-lex an invalid raw string literal to get the `RawStrError`.

There is one very small change in behaviour. Previously, if a raw string
literal matched both the `InvalidStarter` and `TooManyHashes` cases,
the latter would override the former. This has now changed, because
`raw_double_quoted_string` now uses `?` and so returns immediately upon
detecting the `InvalidStarter` case. I think this is a slight
improvement to report the earlier-detected error, and it explains the
change in the `test_too_many_hashes` test.

The commit also removes a couple of comments that refer to #77629 and
say that the size of these types don't affect performance. These
comments are wrong, though the performance effect is small.

2 years agoAlways include a position span in rustc_parse_format::Argument
Alex Macleod [Sun, 31 Jul 2022 15:11:00 +0000 (15:11 +0000)]
Always include a position span in rustc_parse_format::Argument

2 years agoRollup merge of #99186 - camsteffen:closure-localdefid, r=cjgillot
Dylan DPC [Sun, 31 Jul 2022 12:06:40 +0000 (17:36 +0530)]
Rollup merge of #99186 - camsteffen:closure-localdefid, r=cjgillot

Use LocalDefId for closures more

2 years agoUse LocalDefId for closures more
Cameron Steffen [Tue, 12 Jul 2022 14:10:22 +0000 (09:10 -0500)]
Use LocalDefId for closures more

2 years agoAuto merge of #99948 - Dylan-DPC:rollup-ed5136t, r=Dylan-DPC
bors [Sat, 30 Jul 2022 17:30:50 +0000 (17:30 +0000)]
Auto merge of #99948 - Dylan-DPC:rollup-ed5136t, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #99311 (change maybe_body_owned_by to take local def id)
 - #99862 (Improve type mismatch w/ function signatures)
 - #99895 (don't call type ascription "cast")
 - #99900 (remove some manual hash stable impls)
 - #99903 (Add diagnostic when using public instead of pub)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoAuto merge of #99887 - nnethercote:rm-TreeAndSpacing, r=petrochenkov
bors [Sat, 30 Jul 2022 14:50:05 +0000 (14:50 +0000)]
Auto merge of #99887 - nnethercote:rm-TreeAndSpacing, r=petrochenkov

Remove `TreeAndSpacing`.

A `TokenStream` contains a `Lrc<Vec<(TokenTree, Spacing)>>`. But this is
not quite right. `Spacing` makes sense for `TokenTree::Token`, but does
not make sense for `TokenTree::Delimited`, because a
`TokenTree::Delimited` cannot be joined with another `TokenTree`.

This commit fixes this problem, by adding `Spacing` to `TokenTree::Token`,
changing `TokenStream` to contain a `Lrc<Vec<TokenTree>>`, and removing the
`TreeAndSpacing` typedef.

The commit removes these two impls:
- `impl From<TokenTree> for TokenStream`
- `impl From<TokenTree> for TreeAndSpacing`

These were useful, but also resulted in code with many `.into()` calls
that was hard to read, particularly for anyone not highly familiar with
the relevant types. This commit makes some other changes to compensate:
- `TokenTree::token()` becomes `TokenTree::token_{alone,joint}()`.
- `TokenStream::token_{alone,joint}()` are added.
- `TokenStream::delimited` is added.

This results in things like this:
```rust
TokenTree::token(token::Semi, stmt.span).into()
```
changing to this:
```rust
TokenStream::token_alone(token::Semi, stmt.span)
```
This makes the type of the result, and its spacing, clearer.

These changes also simplifies `Cursor` and `CursorRef`, because they no longer
need to distinguish between `next` and `next_with_spacing`.

r? `@petrochenkov`

2 years agoApply suggestions from code review
Sosthene [Sat, 30 Jul 2022 11:17:51 +0000 (13:17 +0200)]
Apply suggestions from code review

The expect_used lint is allow-by-default, so it would be better to show the case where this is enabled.

Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
2 years agoAvoid ICE when fetching LocalDefId
Miguel Guarniz [Wed, 20 Jul 2022 02:51:52 +0000 (22:51 -0400)]
Avoid ICE when fetching LocalDefId

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoChange enclosing_body_owner to return LocalDefId
Miguel Guarniz [Tue, 19 Jul 2022 21:47:49 +0000 (17:47 -0400)]
Change enclosing_body_owner to return LocalDefId

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoRename local_did to def_id
Miguel Guarniz [Tue, 19 Jul 2022 21:06:52 +0000 (17:06 -0400)]
Rename local_did to def_id

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoChange maybe_body_owned_by to take local def id
Miguel Guarniz [Sat, 16 Jul 2022 03:13:04 +0000 (23:13 -0400)]
Change maybe_body_owned_by to take local def id

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoAuto merge of #8974 - Metaswitch:remove-blacklist-terminology, r=Manishearth
bors [Fri, 29 Jul 2022 19:12:49 +0000 (19:12 +0000)]
Auto merge of #8974 - Metaswitch:remove-blacklist-terminology, r=Manishearth

Remove "blacklist" terminology

Picking up where https://github.com/rust-lang/rust-clippy/pull/5896 left off, this renames the `blacklisted_name` lint to `disallowed_names` (pluralised for compliance with naming conventions).  The old name is still available though is deprecated (both in the lint name, and in the TOML configuration file).

This has been proposed/requested a few times, most recently in https://github.com/rust-lang/rust-clippy/issues/7582 where `@xFrednet` suggested pinging the Clippy team when a PR was created hence...

cc: `@rust-lang/clippy`

changelog: [`disallowed_names`] lint replaces `blacklisted_name`

2 years agoAdd deprecation test for old configuration entry
Andy Caldwell [Thu, 9 Jun 2022 15:11:19 +0000 (16:11 +0100)]
Add deprecation test for old configuration entry

2 years agoChange lint name to plural
Andy Caldwell [Wed, 8 Jun 2022 19:08:37 +0000 (20:08 +0100)]
Change lint name to plural

2 years agoRename "blacklisted name" to "disallowed name" throughout
Andy Caldwell [Wed, 8 Jun 2022 15:20:30 +0000 (16:20 +0100)]
Rename "blacklisted name" to "disallowed name" throughout