Commit graph

16597 commits

Author SHA1 Message Date
bors
c976ad07ee Auto merge of #10675 - c410-f3r:bbbbbbbbbbb, r=llogiq
[arithmetic_side_effects] Cache symbols

An internal-only modification to speed up the processing of symbols because "intern" isn't very cheap, even more when you are doing the same thing for every method expression.

changelog: none
2023-04-20 18:34:16 +00:00
Caio
0b16f80c40 [arithmetic_side_effects] Cache symbols 2023-04-20 14:59:02 -03:00
bors
06dace2920 Auto merge of #10669 - oli-obk:@, r=Alexendoo
Update to a compiletest-rs version that requires `//@` for commands

Requires https://github.com/Manishearth/compiletest-rs/pull/261 to get published

This PR is a smaller step towards https://github.com/rust-lang/rust-clippy/pull/10426

changelog: Move to a version of compiletest-rs that allows us to require `//`@`` for test suite commands.
2023-04-20 14:51:33 +00:00
Oli Scherer
def1705a27 Update to a compiletest-rs version that requires //@ for commands 2023-04-20 14:44:03 +00:00
bors
523c8fa2ed Auto merge of #10615 - c410-f3r:bbbbbbbbbbb, r=giraffate
[arithmetic_side_effects] Fix #10590

Fix #10590

changelog: [`arithmetic_side_effects`]: Detect integer methods that can introduce side effects
2023-04-20 13:27:22 +00:00
bors
4d35b5e27b Auto merge of #10668 - xFrednet:changelog-1-69, r=flip1995
Changelog for Rust 1.69 🌸

Roses are blue,
Violets are red,
Something is wrong,
We still commit!

---

changelog: none
2023-04-19 17:24:44 +00:00
xFrednet
6ce346c942
Changelog for Rust 1.69 🌸 2023-04-19 16:37:28 +02:00
Caio
3db7352b81 [arithmetic_side_effects] Fix #10590 2023-04-19 10:58:00 -03:00
bors
f1a552ccec Auto merge of #10203 - c410-f3r:macro-lint, r=giraffate
Suppress the triggering of some lints in derived structures

Fixes #10185
Fixes #10417

For `integer_arithmetic`, `arithmetic_side_effects` and `shadow_reuse`.

* ~~Not sure how to test these use-cases so feel free to point any method or any related PR.~~

---

changelog: FP: [`integer_arithmetic`], [`arithmetic_side_effects`]: No longer lint inside proc macros
[#10203](https://github.com/rust-lang/rust-clippy/pull/10203)
<!-- changelog_checked -->
2023-04-19 12:56:19 +00:00
xFrednet
747ff0656b
Update version attribute for 1.69 lints 2023-04-19 14:55:18 +02:00
bors
0c44586ff7 Auto merge of #10651 - lukaslueg:issue10641, r=xFrednet
Add size-parameter to unecessary_box_returns

Fixes #10641

This adds a configuration-knob to the `unecessary_box_returns`-lint which allows _not_ linting a `fn() -> Box<T>` if `T` is "large". The default byte size above which we no longer lint is 128 bytes (due to https://github.com/rust-lang/rust-clippy/issues/4652#issue-505670554, also used in #9373). The overall rational is given in #10641.

---

changelog: Enhancement: [`unnecessary_box_returns`]: Added new lint configuration `unnecessary-box-size` to set the maximum size of `T` in `Box<T>` to be linted
[#10651](https://github.com/rust-lang/rust-clippy/pull/10651)
<!-- changelog_checked -->
2023-04-19 12:42:33 +00:00
Lukas Lueg
4bc68f9c60 Add size-parameter to unecessary_box_returns
Fixes #10641
2023-04-19 14:32:05 +02:00
bors
8099f19516 Auto merge of #10667 - Alexendoo:manual-slice-size-calculation-macros, r=llogiq
Ignore `manual_slice_size_calculation` in code from macro expansions

changelog: none, assuming same release as #10659
2023-04-18 18:05:51 +00:00
Alex Macleod
2f4f798f9b Ignore manual_slice_size_calculation in code from macro expansions 2023-04-18 17:54:26 +00:00
bors
203c909d04 Auto merge of #10661 - timvisee:manual-slice-size-calc-suggestion, r=Manishearth
Add `manual_slice_size_calculation` applicable suggestion

Continuation of https://github.com/rust-lang/rust-clippy/pull/10659#issuecomment-1511688869.

This adds applicable suggestions to the `manual_slice_size_calculation` lint:

```
error: manual slice size calculation
  --> $DIR/manual_slice_size_calculation.rs:11:13
   |
LL |     let _ = s_i32.len() * size_of::<i32>(); // WARNING
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::mem::size_of_val(s_i32)`
   |
   = note: `-D clippy::manual-slice-size-calculation` implied by `-D warnings`
```

changelog: [`manual_slice_size_calculation`]: add machine applicable suggestion
2023-04-17 19:43:39 +00:00
timvisee
a2580db642
Use clippy_utils::std_or_core in manual slice size calculation lint 2023-04-17 21:19:49 +02:00
timvisee
b8fee8b504
Add run-rustfix marker and test file 2023-04-17 21:19:44 +02:00
timvisee
503fd56a42
Suggest applicable expression for manual slice size calculation lint 2023-04-17 20:31:25 +02:00
bors
e57deaace5 Auto merge of #10659 - timvisee:fix-size-of-val, r=Manishearth
Suggest `std::mem::size_of_val` instead of `std::mem::size_of_value`

This fixes the incorrect suggestion to use `std::mem::size_of_value`. It should be [`std::mem::size_of_val`](https://doc.rust-lang.org/std/mem/fn.size_of_val.html).

changelog: [`manual_slice_size_calculation`]: suggest `std::mem::size_of_val` rather than `std::mem::size_of_value`
2023-04-17 16:16:52 +00:00
timvisee
4fb38cfb29
Rename std::mem::size_of_value to std::mem::size_of_val 2023-04-17 18:02:04 +02:00
bors
90cb0fa2f3 Auto merge of #10652 - blyxyas:book-macro_expansions, r=flip1995
Clippy Book Chapter Updates Reborn: Macro Expansions

This PR adds a new chapter to the book: "Macro Expansions". There weren't big changes apart from grammar, re-phrasing and stylistic choices.

## Notes

- **Does not require any other chapter** to be merged before this
- To talk about the whole project, please use the tracking issue for the project #10597 (It also contains a timeline, discussions and more information)

changelog: Add a new "Macro Expansions" chapter to the book

r? `@flip1995`
2023-04-16 21:17:46 +00:00
blyxyas
e3a352d0bb
Add new chapter: "Macro Expansions"
Co-authored-by: Nahua <kangnahua@gmail.com>
2023-04-16 23:16:27 +02:00
bors
a34e75be59 Auto merge of #10653 - flip1995:book-type_passes_corrections, r=llogiq
Book: Improve type checking and lint passes chapters

- Adds the lint passes chapter to the index.
- Moves additional reading material for beginners to the front page of the development section.
- Clarify some details in `hir::Ty` vs `ty::Ty`.

`@blyxyas` I started reviewing the chapters that were already merged. Great work. I liked the additional reading chapter so much, that I moved it front and center. Other than that I only had some minor corrections to make. Please review.

r? `@llogiq`

changelog: none
2023-04-16 21:01:15 +00:00
Philipp Krones
b842e99ddf
Make warning about hir_ty_to_ty more visible 2023-04-16 21:08:59 +02:00
Philipp Krones
fbb69dea91
Improve type checking and lint passes chapters
Adds the lint passes chapter to the index.

Moves additional reading material for beginners to the front page of the
development section.

Clarify some details in hir::Ty vs ty::Ty.
2023-04-16 20:59:25 +02:00
Caio
d6390625dc Address comments 2023-04-15 16:05:46 -03:00
bors
004981647f Auto merge of #10622 - blyxyas:book-lint_passes, r=llogiq
Clippy Book Chapter Updates Reborn: Lint Passes

This PR adds a new chapter to the book: "Lint passes". No major changes apart from some re-phrasing, fixing typos... etc.

## Notes

- Requires #10595 to be merged before this one (Or else, a link will be broken).
- To talk about the whole project, please use the tracking issue for the project #10597 (It also contains a timeline, discussions and more information)

changelog: Add a new "Lint passes" chapter to the book
r? `@flip1995`
2023-04-14 17:04:54 +00:00
Manish Goregaokar
b2edd42b24
Merge pull request #10603 from robertbastian/octal
Fix false positives and false negatives in `octal_escapes`
2023-04-13 15:50:00 -07:00
blyxyas
b4732679fc
Talk about symbol information in "Early Lint Pass" 2023-04-12 23:59:56 +02:00
bors
d9c2957221 Auto merge of #10629 - Alexendoo:as-ptr-cast-mut-docs-ub, r=Jarcho
Fix UB in `as_ptr_cast_mut` documentation

changelog: none

Fixes #10628

There's no `String::as_mut_ptr` surprisingly, so the example is actually calling `str::as_mut_ptr` on an empty `str`
2023-04-12 16:47:34 +00:00
bors
d2f1b2c052 Auto merge of #10638 - bluthej:standardize-lint-formulation, r=Alexendoo
Standardize lint formulation

Fixes #10631

changelog: Standardize a very frequent lint formulation which had variations
2023-04-12 16:34:12 +00:00
bluthej
6409556926 Standardize lint formulation 2023-04-12 13:48:03 +02:00
bors
0d06001449 Auto merge of #10621 - fee1-dead-contrib:bump_syn, r=flip1995
bump syn to 2.0

changelog: none
2023-04-12 08:27:12 +00:00
Deadbeef
d406f653c9 bless test error 2023-04-12 09:06:51 +08:00
Deadbeef
3813b8e10d Update ui tests auxiliary to syn 2.0 2023-04-12 08:51:11 +08:00
bors
2a774bb2c7 Auto merge of #10627 - schubart:collection_is_never_read_all_types, r=xFrednet
Test all types supported by [`collection_is_never_read`]

changelog: none
2023-04-11 19:51:06 +00:00
bors
83e42a2337 Auto merge of #10630 - flip1995:book-link-fix, r=xFrednet
Fix links in Clippy book

Links to README.md files must actually be links to index.md files,
because of the inner workings of `mdbook`.

Also use the latest mdbook version in CI.

---

Blocks https://github.com/rust-lang/rust/pull/110003#issuecomment-1500249457

changelog: none
2023-04-11 13:16:06 +00:00
Philipp Krones
0266a9e9a3
Fix links in Clippy book
Links to README.md files must actually be links to index.md files,
because of the inner workings of `mdbook`.

Also use the latest mdbook version in CI.
2023-04-11 14:43:47 +02:00
Alex Macleod
8f979af3d1 Fix UB in as_ptr_cast_mut documentation 2023-04-11 11:17:18 +00:00
Michael Schubart
b85deea3f5 Test all types supported by [collection_is_never_read] 2023-04-11 12:27:25 +09:00
bors
3b5b2ed01a Auto merge of #10492 - schubart:collection_is_never_read_unit_type, r=Manishearth
`collection_is_never_read`: Handle unit type

changelog: [`collection_is_never_read`]: Fix false negative
fixes: #10488
2023-04-11 03:05:57 +00:00
Michael Schubart
3d711455c2 Add test case from #10488 2023-04-11 10:37:00 +09:00
Michael Schubart
008ba7326b Ignore fake read access 2023-04-11 10:32:09 +09:00
Michael Schubart
63030acf4f Refactor 2023-04-11 10:27:32 +09:00
bors
5ec2e192f5 Auto merge of #10614 - bluthej:clear-with-drain, r=Manishearth
Clear with drain

Fixes #10572: both the original intent of the issue (extending `clear_with_drain`) and the false negative for `collection_is_never_read` I found in the process are fixed by this PR.

changelog: [`clear_with_drain`]: extend to 5 other types of containers. [`collection_is_never_read`]: fix false negative for `String`s.
2023-04-11 00:29:21 +00:00
bors
e22019d0b7 Auto merge of #10593 - feniljain:fix-needless-return, r=xFrednet
fix(needless_return): do not trigger on ambiguous match arms return

If we see a case where match returns something other than `()`, we just skip `needless_return` lint in that case

Should fix #10546

Relevant Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Issue.20.2310546

---

changelog: FP: [`needless_return`]: No longer lints match statements with incompatible branches
[#10593](https://github.com/rust-lang/rust-clippy/pull/10593)
<!-- changelog_checked -->
2023-04-10 21:52:47 +00:00
bors
4904d754e0 Auto merge of #10624 - the8472:remove-drain-filter-feature, r=xFrednet
remove unusued `#![feature(drain_filter)]`

The unstable feature does not appear to be used and its presence blocks work in https://github.com/rust-lang/rust/pull/104455

changelog: none
2023-04-10 12:55:50 +00:00
The 8472
d6fe73db3f remove unusued feature 2023-04-10 13:13:09 +02:00
blyxyas
c19c08f4b2
Fix CI 2023-04-10 11:09:52 +02:00
blyxyas
0b1b535116
Add "Lint Passes" chapter 2023-04-10 10:59:12 +02:00