Commit graph

14593 commits

Author SHA1 Message Date
Jason Newcomb
20ea26234a Lint field accesses in explicit_auto_deref 2022-06-28 12:48:26 -04:00
Jason Newcomb
a187d6412b Merge different parent walking loops in dereference.rs
`needless_borrow` will now walk further to find the target type.
2022-06-28 12:48:26 -04:00
Jason Newcomb
ee532c0222 Don't lint explicit_auto_deref on reborrows 2022-06-28 12:48:26 -04:00
Jason Newcomb
8a74d33570 Add explicit_auto_deref lint 2022-06-28 12:48:24 -04:00
Jason Newcomb
c107c97e69 Better support projection types when finding the signature for an expression 2022-06-28 12:47:26 -04:00
xFrednet
d11618e6fa
Update boxed_local expect attribute location 2022-06-28 12:38:52 +02:00
xFrednet
c5820022d5
Changelog for Rust 1.62 🦖 2022-06-28 12:20:24 +02:00
bors
b776fb8294 Auto merge of #8774 - hellow554:cargo-rust-version, r=flip1995
try reading rust-version from Cargo.toml

Cargo.toml can contain a field `rust-version`, that acts like a MSRV of
clippy.toml file: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
This will try to read that field and use it, if the clippy.toml config
has no `msrv` entry

changelog: respect `rust-version` from `Cargo.toml`

closes #8746
closes #7765
2022-06-28 07:27:08 +00:00
bors
373bb573af Auto merge of #8639 - Jarcho:trivially_copy_pass_by_ref_5953, r=dswij
`trivially_copy_pass_by_ref` fixes

fixes #5953
fixes #2961

The fix for #5953 is overly aggressive, but the suggestion is so bad that it's worth the false negatives. Basically three things together:
* It's not obviously wrong
* It compiles
* It may actually work when tested

changelog: Don't lint `trivially_copy_pass_by_ref` when unsafe pointers are used.
changelog: Better track lifetimes when linting `trivially_copy_pass_by_ref`.
2022-06-28 07:03:57 +00:00
Marcel Hellwig
f0a1cd5645 add uitests for cargo rust-version field 2022-06-28 08:04:10 +02:00
Marcel Hellwig
6384765665 parse Cargo.toml file in ui-cargo tests
compiletest_rs is not meant to test full cargo projects, but instead
only files.
So we need to parse the `Cargo.toml` file ourself and set the
corresponding environment variable. In this case we just set
`CARGO_PKG_RUST_VERSION`, nothing more. But, of course, this can be
extended.
2022-06-28 08:03:48 +02:00
Marcel Hellwig
83511d1d9a update README.md to reflect rust-version in cargo.toml 2022-06-28 08:03:44 +02:00
Marcel Hellwig
81737bf850 try reading rust-version from Cargo.toml
Cargo.toml can contain a field `rust-version`, that acts like a MSRV of
clippy.toml file: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
This will try to read that field and use it, if the clippy.toml config
has no `msrv` entry
2022-06-28 08:01:50 +02:00
Preston From
7bc40967a4 Run cargo dev fmt 2022-06-27 23:01:47 -06:00
Preston From
3cfd1e5233 Make messages more accurate, check lint enabled 2022-06-27 22:52:22 -06:00
bors
d85539571f Auto merge of #9045 - alex-semenyuk:self_assignment_example, r=llogiq
Fix example `SELF_ASSIGNMENT`

changelog: Fix example in `SELF_ASSIGNMENT` docs
2022-06-27 17:33:31 +00:00
bors
fdd0e727e2 Auto merge of #8649 - ebobrow:imperative_find, r=flip1995
add [`manual_find`] lint for function return case

part of the implementation discussed in #7143

changelog: add [`manual_find`] lint for function return case
2022-06-27 17:15:25 +00:00
Jason Newcomb
c10101cf1c Don't lint trivially_copy_pass_by_ref when unsafe pointers are used 2022-06-27 13:14:27 -04:00
Jason Newcomb
2315f76f9d Actually check lifetimes in trivially_copy_pass_by_ref 2022-06-27 13:14:25 -04:00
alexey semenyuk
c6a2221393 Fix example SELF_ASSIGNMENT 2022-06-27 18:21:09 +03:00
bors
eaa03ea911 Auto merge of #8972 - kyoto7250:use_retain, r=llogiq
feat(new lint): new lint `manual_retain`

close #8097

This PR is  a new  lint implementation.
This lint checks if the `retain` method is available.

Thank you in advance.

changelog: add new ``[`manual_retain`]`` lint
2022-06-27 13:58:26 +00:00
bors
889b3613ae Auto merge of #8990 - tsoutsman:master, r=llogiq
Fix `let_undescore_lock` false-positive when binding without locking

Fixes #8486.

changelog: Fix `let_undescore_lock` false-positive when binding without locking.
2022-06-27 13:38:50 +00:00
Klim Tsoutsman
65f700fa89
Fix let_undescore_lock false-positive when binding without locking
Signed-off-by: Klim Tsoutsman <klimusha@gmail.com>
2022-06-27 20:35:26 +10:00
bors
6b762ee330 Auto merge of #9054 - alex-semenyuk:string_add_example, r=giraffate
STRING_ADD example

changelog: none
STRING_ADD example, how it should be
2022-06-27 06:08:00 +00:00
bors
57e7e1d7d8 Auto merge of #8871 - Serial-ATA:cargo-dev-deprecate, r=giraffate
Add `cargo dev deprecate`

changelog: none

I wrote this awhile ago when `regex` was still a dependency. Is it alright to add it back?
2022-06-27 00:32:22 +00:00
bors
88da5f2bb3 Auto merge of #8939 - Jarcho:transmute_ptr_to_ref_lt, r=giraffate
Suggest `pointer::cast` when possible in `transmute_ptr_to_ref`

fixes #8924

changelog: Suggest casting the pointer for any type containing lifetimes in `transmute_ptr_to_ref`.
changelog: Suggest `pointer::cast` when possible in `transmute_ptr_to_ref`.
2022-06-27 00:05:50 +00:00
kyoto7250
676af4530f cargo dev update_lints 2022-06-27 08:21:09 +09:00
kyoto7250
3a9c0ef8a1 fix for git rebase 2022-06-27 08:11:58 +09:00
kyoto7250
dd3d0fdad3 rename use_retain => manual_retain 2022-06-27 08:11:58 +09:00
kyoto7250
4decfdec76 check msrv 2022-06-27 08:11:58 +09:00
kyoto7250
14212115c4 rewrite without if_chain macro 2022-06-27 08:11:58 +09:00
kyoto7250
fd629c0cde check method 2022-06-27 08:11:58 +09:00
kyoto7250
3953c530f4 change lint type from style to perf 2022-06-27 08:11:58 +09:00
kyoto7250
e3afc72caa remove needless return 2022-06-27 08:11:58 +09:00
kyoto7250
b20b8f10dd Update clippy_lints/src/use_retain.rs
Co-authored-by: llogiq <bogusandre@gmail.com>
2022-06-27 08:11:58 +09:00
kyoto7250
5f2b8e67b3 feat(new lint): new lint use_retain 2022-06-27 08:11:58 +09:00
bors
9b150625a9 Auto merge of #9032 - kyoto7250:issue_9018, r=llogiq
enum_variant_names should ignore when all prefixes are _

close #9018

When Enum prefix is only an underscore, we should not issue warnings.

changelog: fix false positive in enum_variant_names
2022-06-26 16:11:06 +00:00
bors
ab58276146 Auto merge of #9055 - kyoto7250:update_nodejs_in_github_action, r=Manishearth
update node.js version in `remark.yml`

Optional chain (`?.`) is available in `node v14`, but node version in CI is `node v12`, so CI is failed now.

ref:
https://github.com/rust-lang/rust-clippy/runs/7059529735?check_suite_focus=true

optional chain:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining#browser_compatibility

Corresponding PR (maybe)
https://github.com/remarkjs/remark/pull/1007

changelog: None
2022-06-26 15:07:22 +00:00
kyoto7250
11bf291189 update node.js version 2022-06-26 20:19:32 +09:00
alexey semenyuk
16919143e4
STRING_ADD example 2022-06-26 08:36:50 +00:00
alexey semenyuk
4065702b1f
STRING_ADD example 2022-06-26 11:14:37 +03:00
kyoto7250
d827b834d9 use all instead of join 2022-06-26 16:11:04 +09:00
kyoto7250
bf317a83cf
treat argument as a slice.
Co-authored-by: llogiq <bogusandre@gmail.com>
2022-06-26 15:55:44 +09:00
bors
8789f4e88a Auto merge of #8985 - botahamec:single-match-option, r=llogiq
Lint `[single_match]` on `Option` matches

fixes #8928

changelog: did some cleanup of the logic for ``[`single_match`]`` and ``[`single_match_else`]`` which fixes the bug where `Option` matches were not linted unless a wildcard was used for one of the arms.
2022-06-25 16:48:34 +00:00
xFrednet
3a31ef7456
Give clippy some Dogfood to make it happy =^.^= 2022-06-25 14:53:54 +02:00
xFrednet
4d41a97735
Add note to is_lint_allowed about lint emission 2022-06-25 14:37:52 +02:00
xFrednet
6427ba4855
Fix #[expect] for clippy::manual_non_exhaustive 2022-06-25 14:37:51 +02:00
xFrednet
525f5ee7ac
Update useless_attribute docs and allow macro_use_imports 2022-06-25 14:37:51 +02:00
xFrednet
ae4900c9b8
Fix #[expect] for clippy::macro_use_imports 2022-06-25 14:37:50 +02:00
xFrednet
79fc2716dc
Fix #[expect] for unnecessary_unwrap, panicking_unwrap 2022-06-25 14:21:24 +02:00