Commit Graph

1342 Commits

Author SHA1 Message Date
Samuel Tardieu
62c4daf358 New lint needless_as_bytes 2024-10-28 09:19:17 +01:00
bors
dae1be90ee Auto merge of #13525 - xFrednet:changelog-1-82, r=dswij
Changelog for Clippy 1.82 ✈️

```
Roses are red,
Violets are blue,
EuroRust in Austria,
    RustConf in Canada.
```

---

### The cat of this release is *Racka*:

<img height=500 src="https://github.com/user-attachments/assets/e5e3cc95-6fc3-4214-aab0-4f26e0967ae5" alt="The cats of this Clippy release" />

Cats for the next release can be nominated in the comments :D

---

changelog: none
2024-10-17 11:13:09 +00:00
GnomedDev
42511a3ffa
Add lint for unnecessary lifetime bounded &str return 2024-10-15 17:06:21 +01:00
xFrednet
512ad86d68
Changelog: Update category for too_long_first_doc_paragraph 2024-10-15 17:13:19 +02:00
bors
c71f0bebd2 Auto merge of #13334 - nyurik:ascii-str-eq, r=xFrednet
Add manual_ignore_cast_cmp lint

```rust
// bad
fn compare(a: &str, b: &str) -> bool {
    a.to_ascii_lowercase() == b.to_ascii_lowercase()
    || a.to_ascii_lowercase() == "abc"
}

// good
fn compare(a: &str, b: &str) -> bool {
   a.eq_ignore_ascii_case(b)
   || a.eq_ignore_ascii_case("abc")
}
```

- [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: New lint: [`manual_ignore_case_cmp`] `perf`
[#13334](https://github.com/rust-lang/rust-clippy/pull/13334)

Closes #13204
2024-10-13 07:34:38 +00:00
xFrednet
731c473fd9
Changelog for Clippy 1.82 ✈️ 2024-10-09 19:04:21 +02:00
bors
753629bb33 Auto merge of #13412 - GnomedDev:regex-comp-in-loop, r=y21
Implement lint for regex::Regex compilation inside a loop

Closes #598.

Seems like a pretty simple one, I'm not sure if I sorted out all the lint plumbing correctly because I was adding it to the existing regex pass, but seems to work. The name is a bit jank and I'm super open to suggestions for changing it.

changelog: [`regex_creation_in_loops`]: Added lint for Regex compilation inside loops.
2024-10-05 18:41:45 +00:00
Yuri Astrakhan
d1dec199ee Add manual_ignore_cast_cmp lint 2024-10-01 01:11:05 -04:00
Yuri Astrakhan
73a16c10db Suggest Option<&T> instead of &Option<T> 2024-09-28 11:57:34 -04:00
GnomedDev
9f5bfe24eb Implement lint for regex::Regex compilation inside a loop 2024-09-21 12:46:08 +01:00
Ruairidh Williamson
05ebce8e1a
Add lint unused_trait_names 2024-09-21 00:56:38 +01:00
Lukas Lueg
290a01e448 Initial impl of unnecessary_first_then_check
Fixes #11212
2024-09-19 21:27:39 +02:00
Samarth1696
46f8d360de Lint ready 2024-09-07 13:21:09 +05:30
Sour1emon
d7996da9da Add manual_is_power_of_two 2024-09-05 18:38:06 -07:00
Artem Belyakov
9415e6e6eb Add manual_div_ceil 2024-09-06 00:55:42 +02:00
bors
c95c767663 Auto merge of #13323 - xFrednet:chnagelog-1-81, r=flip1995
Changelog for Clippy 1.81 🔰

Roses are red,
Violets are blue,
Expectations are stable,
And reasons are set

---

### The cat of this release is *Keepy* submitted by `@blyxyas:`

<img height=500 src="https://github.com/rust-lang/rust-clippy/assets/73757586/902dd802-5ac8-471e-bb93-e195526ba580" alt="The cats of this Clippy release" />

Cats for the next release can be nominated in the comments :D

---

changelog: none
2024-09-05 09:17:12 +00:00
Soveu
273b561609 add pointers_in_nomem_asm_block lint 2024-09-03 18:58:05 +02:00
bors
ac914d3457 Auto merge of #12476 - GuillaumeGomez:add-manual_arithmetic_check, r=y21
Extend `implicit_saturating_sub` lint

Fixes #10070.

It can serve as base if we want to add equivalent checks for other arithmetic operations.

Also one important note: when writing this lint, I realized that I could check for wrong conditions performed beforehand on subtraction and added another part in the lint. Considering they both rely on the same checks, I kept both in the same place. Not sure if it makes sense though...

changelog: Extend `implicit_saturating_sub` lint
2024-08-31 16:03:42 +00:00
Fridtjof Stoldt
cbc6910c35
Changelog: Correct lint level
Co-authored-by: Timo <30553356+y21@users.noreply.github.com>
2024-08-29 22:15:18 +02:00
xFrednet
9aa23b8317
Changelog for Clippy 1.81 🔰 2024-08-29 21:54:05 +02:00
Guillaume Gomez
d20fc38f0a Create new inverted_saturating_sub lint 2024-08-29 20:20:13 +02:00
y21
e8ac4ea418 new lint: zombie_processes 2024-08-27 21:51:02 +02:00
bors
603d5a19c9 Auto merge of #13294 - WeiTheShinobi:new_lint_used_underscore_items, r=llogiq
Add new lint: `used_underscore_items`

Closes #13260

---

changelog: new [`used_underscore_items`] lint against using items with a single leading underscore
2024-08-27 10:59:31 +00:00
bors
30e0b69908 Auto merge of #12993 - GuillaumeGomez:too_long_first_doc_paragraph, r=Centri3
Add new `too_long_first_doc_paragraph` first paragraph lint

Fixes https://github.com/rust-lang/rust-clippy/issues/12989.

changelog: Add new `too_long_first_doc_paragraph` first paragraph lint
2024-08-24 15:23:34 +00:00
WeiTheShinobi
b615c82180
Add new lint: used_underscore_items 2024-08-21 19:57:41 +08:00
bors
5ead90f13a Auto merge of #12150 - ithinuel:add_misleading_use_of_ok, r=y21
Add lint for `unused_result_ok`

This PR adds a lint to capture the use of `expr.ok();` when the result is not _really_ used.

This could be interpreted as the result being checked (like it is with `unwrap()` or `expect`) but
it actually only ignores the result.

`let _ = expr;` expresses that intent better.

This was also mentionned in #8994 (although not being the main topic of that issue).

changelog: [`misleading_use_of_ok`]: Add new lint to capture `.ok();` when the result is not _really_ used.
2024-08-06 19:01:41 +00:00
Jason Newcomb
2c34d58159 Store deprecated lints as an array of tuples.
Remove legacy deprecations.
Remove "View Source" link for deprecated lints.
2024-08-05 09:15:55 -04:00
Wilfried Chauveau
182c26891e
Add lint for unused_result_ok 2024-07-29 17:56:45 +01:00
Guillaume Gomez
855a9d1377 Add new too_long_first_doc_paragraph first paragraph lint 2024-07-26 11:21:32 +02:00
bors
df0cb6c51e Auto merge of #13125 - xFrednet:changelog-1-80, r=dswij
Changelog for Clippy 1.80 🌞

Roses are red,
Violets are blue,
Summer is fun,
So much sun

---

### The cat of this release is *Maunzer* submitted by `@llogiq:`

<img height=500 src="https://github.com/rust-lang/rust-clippy/assets/4200835/a1da6948-446d-4ccf-95a7-c816a8afdc3f" alt="The cats of this Clippy release" />

Cats for the next release can be nominated in the comments :D

---

changelog: none

I wish everyone reading this a beautiful and happy day =^.^=
2024-07-25 12:48:54 +00:00
lengyijun
cb77f12600 [pathbuf_init_then_push]: Checks for calls to push immediately after creating a new PathBuf
Co-authored-by: Fridtjof Stoldt <xFrednet@gmail.com>
2024-07-21 14:22:48 +08:00
xFrednet
642ab11a48
Changelog for Clippy 1.80 🌞 2024-07-18 20:58:50 +02:00
Jason Newcomb
23d96f65e4 Rename overflow_check_conditional to panicking_overflow_checks. 2024-07-07 10:24:42 -04:00
bors
3ed690f07a Auto merge of #12974 - alex-semenyuk:rename_thread_local_initializer_can_be_made_const, r=Alexendoo
Rename thread_local_initializer_can_be_made_const to missing_const_for_thread_local

Close #12934
As discussed at #12934 name `thread_local_initializer_can_be_made_const` sounds against convention for other lints which describe the issue/wrong code but not suggestion and it is quite long. The new name take example from existing lint `missing_const_for_fn`

changelog: `thread_local_initializer_can_be_made_const` : Rename to [`missing_const_for_thread_local`]
2024-07-05 17:50:06 +00:00
Alexey Semenyuk
6621e6cbfa Rename thread_local_initializer_can_be_made_const to missing_const_for_thread_local 2024-07-05 19:40:37 +05:00
Milo Moisson
2c09ac3d39
feat: add cfg_not_test lint 2024-07-05 10:28:26 +02:00
Marcel Müller
88c4a22480
New Lint: byte_char_slices
This patch adds a new lint that checks for potentially harder to read
byte char slices: `&[b'a', b'b']` and suggests to replace them with the
easier to read `b"ab"` form.

Signed-Off-By: Marcel Müller <m.mueller@ifm.com>
Co-authored-by: Matthias Beyer <matthias.beyer@ifm.com>

Use iterator to skip validation

Signed-off-by: Marcel Müller <m.mueller@ifm.com>
Suggested-by: Alex Macleod <alex@macleod.io>

Convert quote escapes to proper form

Signed-off-by: Marcel Müller <m.mueller@ifm.com>

Add more convertable test cases

Signed-off-by: Marcel Müller <m.mueller@ifm.com>
2024-07-04 14:31:15 +02:00
Renato Lochetti
6661e83e7b
Rename lint, generalize function, add known issues, use multispan 2024-07-03 19:42:34 +01:00
Renato Lochetti
0f915f6f30
Add new lint hashset_insert_after_contains 2024-07-03 19:41:26 +01:00
Roman Franchuk
b08b8b8a75 Implement a lint to replace bit manual rotations with rotate_left/rotate_right 2024-06-29 22:31:10 +02:00
Philipp Krones
e9e7a815a7
Merge remote-tracking branch 'upstream/master' into rustup 2024-06-27 18:49:59 +02:00
xFrednet
1b4c281fe7 RFC 2383: Stabilize lint_reasons in Clippy 🖇️ 2024-06-25 17:50:48 +02:00
vohoanglong0107
2f9f204123 feat: unnecessary_min_max lint 2024-06-20 13:57:16 +00:00
Jason Newcomb
22710f33a8 Add lint manual_inspect 2024-06-16 18:33:43 -04:00
kyle oneill
3405ce3bca Add field_scoped_visibility_modifiers lint 2024-06-16 15:54:48 -04:00
Philipp Krones
3bff119f63 Merge commit '3e5a02b13b1244545454752c6629b767522a44b1' into clippy-subtree-update 2024-06-13 12:30:48 +02:00
AurelienFT
c86b19f1ef Add lint to check manual pattern char comparison and merge its code with single_char_pattern lint 2024-06-11 21:56:14 +02:00
bors
336046c5e2 Auto merge of #12889 - xFrednet:changelog-1-79, r=flip1995,dswij
Changelog for Clippy 1.79 🎓

Two cat ears from waffle,
A tail and a dress,
That's our Jyn,
The magnificent cat

~ =^.^=

---

### The cat of this release is: *Jyn* submitted by `@jyn514:`

<img height=600 src="https://github.com/rust-lang/rust-clippy/assets/17087237/2f902dea-9ad5-4ad2-b281-1f152b7ad7c7" alt="The cat(s) of this Clippy release" />

Cats for the next release can be nominated in the comments :D

---

changelog: none
2024-06-07 10:02:32 +00:00
bors
6cfd4ac955 Auto merge of #10632 - Alexendoo:needless-maybe-sized, r=Jarcho
Add `needless_maybe_sized` lint

changelog: new lint: [`needless_maybe_sized`]

Closes #10600
2024-06-05 20:11:03 +00:00
xFrednet
a0e407c7c2
Address PR feedback <3 2024-06-05 16:26:51 +02:00