Commit Graph

1020 Commits

Author SHA1 Message Date
Samuel "Sam" Tardieu ffabdab8cf New lint to detect `&std::path::MAIN_SEPARATOR.to_string()` 2023-03-16 21:42:04 +01:00
blyxyas 4b9cb857f9
Rename lint 2023-03-15 23:18:25 +01:00
blyxyas 0f1474ea27
Add `allow_attribute` lint 2023-03-11 00:30:30 +01:00
Philipp Krones c34d04a3dd
Update changelog for beta-accepted labels 2023-03-10 11:28:10 +01:00
xFrednet 7ce9ca0508
Mark Rust 1.68.0 as release in the changelog 2023-03-09 23:09:51 +01:00
blyxyas ca3bf94c43
Add `let_with_type_underscore` lint 2023-03-09 17:18:03 +01:00
Samuel Tardieu d5429eab8a Add new `redundant_async_block` lint 2023-03-08 10:48:54 +01:00
Burak Varlı ea2547b8c6 Add `missing_assert_message` lint
Co-authored-by: Weihang Lo <me@weihanglo.tw>
2023-03-08 08:50:21 +00:00
bors 41fa24cef8 Auto merge of #10415 - schubart:collection_is_never_read, r=llogiq
Add `collection_is_never_read`

Fixes #9267

`@flip1995` and `@llogiq,` I talked with you about this one at Rust Nation in London last week. :-)

This is my first contribution to Clippy, so lots of feedback would be greatly appreciated.

- \[ ] 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`

`dogfood` found one true positive (see #9509) and no false positives.

`lintcheck` found no (true or false) positives, even when running on an extended set of crates.

---

changelog: new lint [`collection_is_never_read`]
[#10415](https://github.com/rust-lang/rust-clippy/pull/10415)
<!-- changelog_checked -->
2023-03-07 13:35:07 +00:00
xFrednet 917ebc3af6
Changelog for Rust 1.68 🐶 2023-02-28 22:06:53 +01:00
Michael Schubart 2a9c254e23 Add `collection_is_never_read` 2023-02-27 07:14:55 +00:00
Krishna Sundarram 00c294ad05 Add new lint no_mangle_with_rust_abi 2023-02-23 17:35:06 +00:00
bors 5ef3cc8ca1 Auto merge of #10197 - blyxyas:impl_trait_param, r=Jarcho
Add `impl_trait_in_params` lint

As this is a lint about style, and using `impl Trait` is purely cosmetical (even with downsides), a lot of unrelated files needed to allow this lint.

---

Resolves #10030

changelog: New lint: [`impl_trait_in_params`]
[10197](https://github.com/rust-lang/rust-clippy/pull/10197)
<!-- changelog_checked -->
2023-02-21 03:02:48 +00:00
Jirka Vebr 6d0df84f6f
Add the `transmute_int_to_non_zero` lint 2023-02-16 16:58:05 +01:00
bors 52c8b536c9 Auto merge of #10342 - mitsuhiko:feature/question-mark-used, r=Alexendoo
Add question-mark-used lint

This lint complains when the question mark operator (try operator) is used.  This is a restriction lint that can be useful on local scopes where a custom error handling macro is supposed to be used to augment the error based on local scope data before returning.

Fixes #10340

---

changelog: New lint [`question_mark_used`]
[#10342](https://github.com/rust-lang/rust-clippy/pull/10342)
<!-- changelog_checked -->
2023-02-16 14:21:43 +00:00
bors 99d4ea4f39 Auto merge of #10356 - JirkaVebr:let_underscore_untyped, r=llogiq
Add `let_underscore_untyped`

Fixes #6842

This adds a new pedantic `let_underscore_untyped` lint which checks for `let _ = <expr>`, and suggests to either provide a type annotation, or to remove the `let` keyword. That way the author is forced to specify the type they intended to ignore, and thus get forced to re-visit the decision should the type of `<expr>` change. Alternatively, they can drop the `let` keyword to truly just ignore the value no matter what.

r? `@llogiq`

changelog: New lint: [let_underscore_untyped]
2023-02-16 12:58:43 +00:00
bors 4369a67a9b Auto merge of #10163 - c410-f3r:lock-1, r=llogiq
[significant_drop_tightening] Add MVP

cc #9399

Creates the lint with minimum functionalities, which is a good start IMO.

---

changelog: new lint: [`significant_drop_tightening`]
[#10163](https://github.com/rust-lang/rust-clippy/pull/10163)
<!-- changelog_checked -->
2023-02-16 12:30:26 +00:00
Jirka Vebr 2d4d39de53
Add the `let_underscore_untyped` lint 2023-02-16 13:05:33 +01:00
blyxyas 6c9983b936
Exec `cargo dev update_lints` 2023-02-15 21:34:47 +01:00
blyxyas ade4c9b2b6
Rename lint to better fit lint naming conventions 2023-02-15 21:34:47 +01:00
blyxyas 8ec9543f13
Add `impl_trait_param` lint
As this is a lint about "style", and a purely cosmetical choice (using `<A: Trait>` over `impl Trait`), a lot of other files needed to be allowed this lint.
2023-02-15 21:29:58 +01:00
Armin Ronacher 89314a0805 Add question-mark-used lint
This lint complains when the question mark operator (try operator)
is used.  This is a restriction lint that can be useful on local
scopes where a custom error handling macro is supposed to be used
to augment the error based on local scope data before returning.
2023-02-13 20:59:26 +01:00
Caio 078f149aa4 [significant_drop_tightening] Add MVP 2023-02-10 15:07:34 -03:00
Mara Bos 8f56767c94 Update lints. 2023-02-10 19:03:20 +01:00
Michael Krasnitski fba16e2e3a Add `extra_unused_type_parameters` lint 2023-02-02 19:37:34 -05:00
xFrednet 4441753127
Mark Rust 1.67 as released in the changelog 2023-01-26 17:13:40 +01:00
xFrednet a7ae84bc84
Address PR feedback and change text for early merge 2023-01-20 09:21:41 +01:00
xFrednet f64efd4d31
Changelog for Rust 1.67 🐞 2023-01-19 22:28:12 +01:00
Niki4tap 875e36f7e4 Add `multiple_unsafe_ops_per_block` lint 2023-01-18 10:00:31 +03:00
Robert Bastian 8ca900b01c rename 2023-01-10 11:12:54 +01:00
Philipp Krones 08535408e8
Merge remote-tracking branch 'upstream/master' into rustup 2022-12-29 14:24:30 +01:00
bors e8703a0ce2 Auto merge of #10098 - lukaslueg:size_of_ref, r=Jarcho
Add size_of_ref lint

This addresses #9995, which is likely raising a valid point about `std::mem::size_of_val()`: It's [very easy to use double-references as the argument](https://github.com/apache/arrow-datafusion/pull/4371#discussion_r1032385224), which the function will happily accept and give back the size of _the reference_, not the size of the value _behind_ the reference. In the worst case, if the value matches the programmer's expectation, this seems to work, while in fact, everything will go horribly wrong e.g. on a different platform.

The size of a `&T` is independent of what `T` is, and people might want to use `std::mem::size_of_val()` to actually get the size of _any_ reference (e.g. via `&&()`). I would rather suggest that this is always bad behavior, though ([instead](https://doc.rust-lang.org/reference/type-layout.html#pointers-and-references-layout), [and](https://doc.rust-lang.org/stable/std/primitive.usize.html#associatedconstant.BITS)). I, therefore, put this lint into `correctness`.

Since the problem is usually easily fixed by removing extra `&`, I went light on suggesting code.

---

changelog: New lint: [`size_of_ref`]
[#10098](https://github.com/rust-lang/rust-clippy/pull/10098)
<!-- changelog_checked -->
2022-12-24 23:33:13 +00:00
Lukas Lueg d7b9e195c2 Add size_of_ref lint
Fixes #9995
2022-12-24 23:39:54 +01:00
alexey semenyuk faebca37e9
Changelog fix 2022-12-23 14:24:23 +03:00
dboso 30e6e85508 add [`permissions_set_readonly_false`] #9702 2022-12-20 00:37:51 +09:00
Niki4tap 42106e0495 Add lint `fn_null_check` 2022-12-18 03:02:45 +03:00
Niki4tap 6afe5471cf Add lint `transmute_null_to_fn` 2022-12-18 03:02:37 +03:00
Philipp Krones 1c422524c7 Merge commit '4bdfb0741dbcecd5279a2635c3280726db0604b5' into clippyup 2022-12-17 14:12:54 +01:00
bors 3905f51230 Auto merge of #10073 - xFrednet:changelog-1-66, r=Alexendoo
Changelog 1.66

It's really nice to see a changelog with so many suggestion fixes and improvements. Not much else to say. This should be merged with the coming release on 2022-12-15. For the reviewer, please review it and approve it if it looks good. The merge should wait until the release :)

---

changelog: none

<!-- changelog_checked -->
2022-12-15 16:12:12 +00:00
Fridtjof Stoldt 71019aa076
Address review comments <3
Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>
Co-authored-by: Alex Macleod <alex@macleod.io>
2022-12-14 19:48:49 +01:00
xFrednet 2855a0f117
Changelog for Rust 1.66 🎅 2022-12-13 23:48:27 +01:00
Hannah Town 4c80f210c3 Add lint `almost_complete_range`
This replaces and expands `almost_complete_letter_range`.
2022-12-09 13:29:50 -05:00
bors d4cd91c288 Auto merge of #9826 - Veykril:semi-blocks, r=Alexendoo
Add semicolon-outside/inside-block lints

changelog: Add `semicolon_outside_block` and `semicolon_inside_block` lints

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

An earlier attempt at this can be found here https://github.com/rust-lang/rust-clippy/pull/7564. This PR still implements two separate lints but I am open to merging them into a single one that's configurable.
2022-12-09 11:41:24 +00:00
Philipp Krones d05e2865a0 Merge commit 'd822110d3b5625b9dc80ccc442e06fc3cc851d76' into clippyup 2022-12-01 18:29:38 +01:00
Lukas Wirth 93b5c893e6 Add semicolon-outside/inside-block lints 2022-11-25 17:10:10 +01:00
Lukas Wirth a116b9bdba Lint unnecessary safety comments on items 2022-11-25 10:09:34 +01:00
Philipp Krones 46c5a5d234 Merge commit 'f4850f7292efa33759b4f7f9b7621268979e9914' into clippyup 2022-11-21 20:51:52 +01:00
Sosthène Guédon 3428da6e00 Fix typo missnamed -> misnamed 2022-11-20 13:45:12 +01:00
Sosthène Guédon 31b83d0895 Add missnamed_getters lint 2022-11-20 13:45:11 +01:00
bors 5b0d727bad Auto merge of #9570 - nfejzic:lint-unchecked-duration-subtraction, r=llogiq
feat: lint unchecked subtraction of a 'Duration' from an 'Instant'

Hello all, I tried to tackle the open issue #9371 and this is what I came up with.

I have a difficulty currently - some tests are failing:

```
failures:
    [ui] ui/manual_instant_elapsed.rs
```

The `manual_instant_elapsed` is failing because of `Instant::now() - duration` test, this now gets also picked by `unchecked_duration_subtraction` lint.
What is the correct way to proceed in this case? Simply update the `.stderr` file for `manual_instant_elapsed` lint?

changelog: [`unchecked_duration_subtraction`]: Add lint for unchecked subtraction of a `Duration` from an `Instant`.

fixes #9371
2022-11-15 06:09:10 +00:00