Commit graph

4838 commits

Author SHA1 Message Date
flip1995
e3eede7b90
Merge remote-tracking branch 'upstream/master' into rustup 2021-06-17 10:21:47 +02:00
bors
2d1e9ab980 Auto merge of #7345 - DevinR528:disallowed-fix, r=Manishearth
Remove requirement of fully qualified path for disallowed_method/type

changelog: Remove the need for fully qualified paths in disallowed_method and disallowed_type

After fixing this issue in [import_rename](https://github.com/rust-lang/rust-clippy/pull/7300#discussion_r650127720) I figured I'd fix it for these two.

If this does in fact fix the **Known problems:** section I was planning to remove them from both lints after confirmation.
2021-06-14 14:57:56 +00:00
bors
a36a7c808c Auto merge of #7270 - Valentine-Mario:vec_extend_to_append, r=flip1995
Vec extend to append

This PR adds a check to suggest changes of vector from

```
vec.extend(other_vec.drain(..))
```

could be written as

```
vec![].append(&mut vec![]);
```

changelog: Add vec_extend_to_append lint
issue: #7209
2021-06-14 06:58:12 +00:00
bors
6379d260e7 Auto merge of #7288 - camsteffen:use-self2, r=phansch
Fix use_self FPs on type params

changelog: Fix [`use_self`] false positives on type parameters

Fixes #4140
Fixes #7139
2021-06-14 05:49:29 +00:00
Devin Ragotzy
70ce0c2c55 Remove requirement of fully qualified path for disallowed_method/type 2021-06-11 17:25:32 -04:00
bors
f1f5ccd63a Auto merge of #7160 - flip1995:field_reassign_macros, r=xFrednet,camsteffen
Don't trigger `field_reassign_with_default` in macros

Fixes #7155

Producing a good suggestion for this lint is already hard when no macros
are involved. With macros the lint message and the suggestion are just
confusing. Since both, producing a good suggestion and figuring out if
this pattern can be re-written inside a macro is nearly impossible, just
bail out.

changelog: [`field_reassign_with_default`] No longer triggers in macros

---

No that our reviewing queue is under control, I want to start hacking on Clippy myself again. Starting with an easy issue to get back in :)
2021-06-11 15:58:58 +00:00
valentine-mario
44608b1857 added lint to check for full range of vector and suggest append 2021-06-10 09:12:06 +01:00
bors
c4636abe72 Auto merge of #7315 - DevinR528:disallowed-ty, r=giraffate
Add disallowed_type lint, this adds a field to the conf struct

Fixes #7277

changelog: Add ``[`disallowed_type`]`` a lint that can enforce banning types specified in the config.
2021-06-10 00:30:36 +00:00
Thomas de Zeeuw
0d3f289b66 Add FreeBSD as identifier not needing ticks
For the doc-markdown lint.
2021-06-09 17:16:10 +02:00
Devin Ragotzy
ea45e2a9cf Add disallowed_types lint, this adds a field to the Conf struct
Replace use of node_type -> node_type_opt, fix clippy warnings

Don't walk the hir unnecessarily let the visitor do it
2021-06-09 07:21:16 -04:00
bors
dd0246813f Auto merge of #7326 - 1c3t3a:1c3t3a-issue-7324, r=flip1995
Fix false positive on `semicolon_if_nothing_returned`

Currently the [`semicolon_if_nothing_returned`](https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned) lint fires in unwanted situations where a block only spans one line. An example of this was given in #7324. This code:

```rust
use std::mem::MaybeUninit;
use std::ptr;

fn main() {
    let mut s = MaybeUninit::<String>::uninit();
    let _d = || unsafe { ptr::drop_in_place(s.as_mut_ptr()) };
}
```

yields the following clippy error:
```
error: consider adding a `;` to the last statement for consistent formatting
 --> src/main.rs:6:26
  |
6 |     let _d = || unsafe { ptr::drop_in_place(s.as_mut_ptr()) };
  |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `ptr::drop_in_place(s.as_mut_ptr());`
  |
  = note: `-D clippy::semicolon-if-nothing-returned` implied by `-D clippy::pedantic`
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
```

I updated the lint to check if the statement is inside an `unsafe` block, a closure or a normal block and if the block only spans one line, in that case the lint is not emitted.

This closes #7324.

changelog: enhanced semicolon if nothing returned according to  #7324.
2021-06-09 08:39:56 +00:00
bors
da0538eaca Auto merge of #7330 - xFrednet:0000-refactor-map-identity, r=flip1995
Refactoring identity function lints

I've noticed that we have several lints that all check for identity functions and each used their own check implementation. I moved the `is_expr_identity_function` function to `clippy_utils` and adapted all lints to reuse that one function. This should make the addition of new lints like this also easier in the future.

I've also moved the `map_identity` lint into the `methods` module. It's probably the best to review this PR by checking each commit individually. And that's it, have a great day 🙃

changelog: none
2021-06-09 08:27:05 +00:00
bors
07217e3370 Auto merge of #7262 - Jarcho:while_let_on_iter_closure, r=xFrednet,flip1995
fix `while_let_on_iterator` suggestion in a closure

fixes: #7249

A future improvement would be to check if the closure is being used as `FnOnce`, in which case the original suggestion would be correct.

changelog: Suggest `&mut iter` inside a closure for `while_let_on_iterator`
2021-06-08 15:52:40 +00:00
xFrednet
9e54ce865c Reuse is_expr_identity_function for filter_map_identity 2021-06-07 23:31:17 +02:00
xFrednet
bb3b58cfcc Reuse is_expr_identity_function for flat_map_identity 2021-06-07 23:20:11 +02:00
Yoshitomo Nakanishi
d7a380e4b9 Fix FP in default_numeric_fallback with external macro expansion 2021-06-06 12:43:22 +09:00
Bastian Kersting
96747c1a46 Enhance semicolon_if_nothing_returned according to #7324 2021-06-05 18:54:41 +02:00
lyj
f877f54767 rc_mutex: fix test 2021-06-05 22:42:48 +08:00
lyj
896c19e2cf rc_mutex: update doc 2021-06-05 21:42:45 +08:00
lyj
e2ec85c697 rc_mutex: add struct test 2021-06-05 21:20:02 +08:00
lyj
a5ced1fc2b rc_mutex use span_lint instead of span_lint_and_sugg 2021-06-05 21:19:05 +08:00
Joshua Nelson
390893c600 Remove doc(include) 2021-06-04 08:05:54 -04:00
Mara Bos
38ab1a6166 Add test for not linting on assert!(cfg!(..)). 2021-06-04 10:47:03 +02:00
lyj
c0f3c2fe27 correct lint 2021-06-04 10:44:34 +08:00
flip1995
6c27482115 Merge commit '3ae8faff4d46ad92f194c2a4b941c3152a701b31' into clippyup 2021-06-03 08:41:37 +02:00
Jason Newcomb
cfddf0927b
Fix type checks for manual_str_repeat 2021-05-31 09:37:13 -04:00
Jason Newcomb
97311f0906
Add lint manual_str_repeat 2021-05-30 23:26:48 -04:00
Steven Engler
58491d386a Update message for 'not_unsafe_ptr_arg_deref' lint 2021-05-30 20:19:57 -04:00
bors
d1308aecaf Auto merge of #7292 - Jarcho:suspicious_splitn, r=flip1995
Add lint `suspicious_splitn`

fixes: #7245
changelog: Add lint `suspicious_splitn`
2021-05-30 20:32:22 +00:00
Jason Newcomb
5fa08eaf53
Evaluate constant expressions in suspicious_splitn 2021-05-30 13:25:24 -04:00
Jason Newcomb
898b6a0e07
Add lint suspicious_splitn 2021-05-30 09:49:55 -04:00
Jason Newcomb
4ba6afd192
Fix ICE in too_many_lines due to wrong assumptions on braces. 2021-05-27 22:44:08 -04:00
Cameron Steffen
29b4b4c10d Do not lint use_self on type parameters 2021-05-27 20:18:07 -05:00
Cameron Steffen
6c54f61beb Move mini-macro to auxilary 2021-05-27 11:32:14 -05:00
bors
2fa9362448 Auto merge of #7281 - camsteffen:has-doc-fp, r=flip1995
Fix missing_docs_in_private_items false negative

changelog: Fix [`missing_docs_in_private_items`] false negative when the item has any `#[name = "value"]` attribute

Closes #7247 (decided not to use the rustc method since it calls `Session::check_name`, which is for rustc only)
2021-05-27 08:37:08 +00:00
bors
8066f836ec Auto merge of #7282 - camsteffen:lint-stmt-expr, r=flip1995
Fix allow on some statement lints

changelog: Fix `#[allow(..)]` over statements for [`needless_collect`], [`short_circuit_statement`] and [`unnecessary_operation`]

Fixes #7171
Fixes #7202
2021-05-27 08:23:21 +00:00
Cameron Steffen
f3e77a454a Fix allow on some statement lints 2021-05-26 22:07:53 -05:00
Cameron Steffen
3af95846a2 Add deprecated lint tests 2021-05-26 21:53:43 -05:00
Cameron Steffen
c51472b4b0 Add clippy.toml to project and tests 2021-05-26 16:53:13 -05:00
Cameron Steffen
1ce581d706 Use break api config for unnecessary_wraps 2021-05-26 16:53:13 -05:00
Cameron Steffen
3d77a2b861 Use break api config for enum_variant_names 2021-05-26 16:53:13 -05:00
Cameron Steffen
ee79077d80 Use break api config for pass by value or ref 2021-05-26 16:53:13 -05:00
Cameron Steffen
d7f47f280e Use break api config for wrong_pub_self_convention 2021-05-26 16:53:13 -05:00
Cameron Steffen
2e2021bbda Add avoid_breaking_exported_api config option 2021-05-26 16:35:22 -05:00
Cameron Steffen
c21b965d43 Fix missing_docs_in_private_items FP 2021-05-26 16:25:38 -05:00
bors
6d50cff45a Auto merge of #7256 - xFrednet:7172-trick-cargos-caching-for-collection, r=flip1995
Adding the ability to invalidate caches to force metadata collection

This adds the discussed hack to touch `clippy_lints/src/lib.rs` to invalidate cargos cache and force metadata collection. I've decided to use the [`filetime`](https://github.com/alexcrichton/filetime) crate instead of the touch command to make is cross-platform and just cleaner in general. Looking at the maintainers I would say that it's a save crate to use xD.

---

cc: #7172 I know this ID without looking it up now... This is not good

changelog: none

r? `@flip1995`
2021-05-25 14:08:02 +00:00
bors
41bb092185 Auto merge of #7255 - whatisaphone:feat/similar-names-wparam-lparam, r=giraffate
Allow wparam and lparam in similar_names

`wparam` and `lparam` are often used as generic parameter names in win32 (for example [WindowProc](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms633573(v=vs.85))). This PR adds them to the similar_names exception list.

changelog: [`similar_names`] don't treat wparam and lparam as similar
2021-05-24 00:20:17 +00:00
bors
297e7433bf Auto merge of #7264 - yotamofek:from_iter_instead_collect_as_trait, r=llogiq
Fix invalid syntax in `from_iter_instead_of_collect` suggestion

First attempt at contributing, hopefully this is a good start and can be improved. :)

fixes #7259

changelog: [`from_iter_instead_of_collect`] fix invalid suggestion involving "as Trait"
2021-05-22 23:08:51 +00:00
Yotam Ofek
ae0d4da764 Fix invalid syntax in from_iter_instead_of_collect suggestion with "as Trait" 2021-05-22 21:47:11 +03:00
Jason Newcomb
60dd2b65dc
Fix redundant_closure for vec![] macro in a closure with arguments 2021-05-21 15:48:29 -04:00
Jason Newcomb
7db0e4f791
Suggest &mut iter inside a closure for while_let_on_iterator 2021-05-21 12:27:40 -04:00
xFrednet
e3a1ae7bfe Adding the ability to invalidate caches to force metadata collection 2021-05-20 22:30:49 +02:00
John Simon
2eafec182d Allow wparam and lparam in similar_names 2021-05-20 10:20:14 -04:00
Jason Newcomb
6d4dc35882
Improve needless_borrow lint
Suggest changing usages of ref bindings to match the new type
Split out some cases into new lint `ref_binding_to_reference`
2021-05-20 09:03:47 -04:00
flip1995
97705b7ea6 Merge commit '9e3cd88718cd1912a515d26dbd9c4019fd5a9577' into clippyup 2021-05-20 13:07:57 +02:00
flip1995
451ff5668b
Merge remote-tracking branch 'upstream/master' into rustup 2021-05-20 12:05:02 +02:00
bors
aa1959b90c Auto merge of #7089 - Jarcho:multiple_impls_generic, r=Jarcho
Don't lint `multiple_inherent_impl` with generic arguments

fixes: #5772
changelog: Treat different generic arguments as different types in `multiple_inherent_impl`
2021-05-18 16:35:48 +00:00
Jason Newcomb
760f70312e
Improve multiple_inherent_impl lint
Treat different generic arguments as different types.
Allow the lint to be ignored on the type definition, or any impl blocks.
2021-05-18 11:45:51 -04:00
Jason Newcomb
a149ba26fa
Fix ICE in implicit_return
async functions always return a value
2021-05-18 10:51:59 -04:00
Philipp Krones
99fb776ace
Rollup merge of #7235 - camsteffen:manual-unwrap-or-deref, r=flip1995
Fix another manual_unwrap_or deref FP

changelog: none (since this just piggybacks on #7233)

Fixes #6960
2021-05-18 10:21:55 +02:00
bors
9028173b24 Auto merge of #7201 - mucinoab:master, r=giraffate
Remove powi, "square can be computed more efficiently"

powi(2) produces exactly the same native code as x * x
powi was part of the [`suboptimal_flops`] lint

fixes #7058
changelog: Remove powi [`suboptimal_flops`], "square can be computed more efficiently"
2021-05-18 05:28:42 +00:00
Bruno A. Muciño
be540e6596 Remove powi, "square can be computed more efficiently"
powi(2) produces exactly the same native code as x * x
2021-05-17 21:59:08 -05:00
Cameron Steffen
8356c485a9 Fix manual_unwrap_or FP deref reference 2021-05-17 14:20:26 -05:00
bors
a3223af9fe Auto merge of #7133 - arya-k:master, r=llogiq
Add `needless_bitwise_bool` lint

fixes #6827
fixes #1594

changelog: Add ``[`needless_bitwise_bool`]`` lint

Creates a new `bitwise_bool` lint to convert `x & y` to `x && y` when both `x` and `y` are booleans. I also had to adjust thh `needless_bool` lint slightly, and fix a couple failing dogfood tests. I made it a correctness lint as per flip1995's comment [here](https://github.com/rust-lang/rust-clippy/pull/3385#issuecomment-434715723), from a previous WIP attempt at this lint.
2021-05-17 18:57:14 +00:00
bors
1aad7541db Auto merge of #7223 - ThibsG:FpUselessConversion7205, r=camsteffen
Fix FPs about generic args

Fix 2 false positives in [`use_self`] and [`useless_conversion`] lints, by taking into account generic args and comparing them.

Fixes: #7205
Fixes: #7206

changelog: Fix FPs about generic args in [`use_self`] and [`useless_conversion`] lints
2021-05-17 17:40:48 +00:00
bors
cec8d95729 Auto merge of #7233 - giraffate:fix_manual_unwrap_or_fp_with_deref_coercion, r=flip1995
Fix a `manual_unwrap_or` FP with deref coercion

Fix https://github.com/rust-lang/rust-clippy/issues/7228.

changelog: Fix a [`manual_unwrap_or`] FP with deref coercion
2021-05-17 17:13:57 +00:00
ThibsG
2fb35ce4f0 Add generic args for comparison in use_self and useless_conversion lints 2021-05-17 17:27:16 +02:00
Takayuki Nakata
ebf065e517 Fix a manual_unwrap_or FP with deref coercion 2021-05-17 22:18:50 +09:00
bors
acdf43f257 Auto merge of #7225 - InquisitivePenguin:unnessecary-async, r=llogiq
New lint: `unused_async`

changelog: Adds a lint, `unused_async`, which checks for async functions with no await statements

`unused_async` is a lint that reduces code smell and overhead by encouraging async functions to be refactored into synchronous functions.

Fixes #7176

### Examples

```rust
async fn get_random_number() -> i64 {
    4 // Chosen by fair dice roll. Guaranteed to be random.
}
```

Could be written as:

```rust
fn get_random_number() -> i64 {
    4 // Chosen by fair dice roll. Guaranteed to be random.
}
```

Something like this, however, should **not** be caught by clippy:
```rust
#[async_trait]
trait AsyncTrait {
    async fn foo();
}

struct Bar;

#[async_trait]
impl AsyncTrait for Bar {
    async fn foo() {
        println!("bar");
    }
}
```
2021-05-17 06:00:55 +00:00
bors
44e0747664 Auto merge of #7216 - ThibsG:OptionIfLetElse7006, r=llogiq
Stop linting `else if let` pattern in [`option_if_let_else`] lint

For readability concerns, it is counterproductive to lint `else if let` pattern.
Unfortunately the suggested code is much less readable.

Fixes: #7006

changelog: stop linting `else if let` pattern in [`option_if_let_else`] lint
2021-05-17 05:45:24 +00:00
bors
6bbee5c584 Auto merge of #7217 - xFrednet:7172-metadata-collection-cargo-alias, r=flip1995
Add `cargo collect-metadata` as an cargo alias for the metadata collection lint

This PR adds a new alias to run the metadata collection monster on `clippy_lints`. I'm currently using it to create the `metadata_collection.json` file and I plan to use it in the `deply.sh` script. Having it as a new alias enables us to simply use:

```sh
cargo collect-metadata
```

It sometimes requires running `cargo clean` before collecting the metadata due to caching. I'm still debating if I should include a cargo clean as part of the `run_metadata_collection_lint` test or not. Input on this would be greatly appreciated 🙃

That's it, just a small change that can be reviewed and merged in parallel to #7214.

---

See: #7172 for the full metadata collection to-do list or to suggest a new feature in connection to it.

---

changelog: none

r? `@flip1995` btw. feel free to pass these PRs one to other team members as well if you want.
2021-05-16 16:57:15 +00:00
Jackson Lewis
1d8f3b51e6
Unnecessary -> Unused 2021-05-14 17:07:30 -07:00
Jackson Lewis
c6e0e843d2
Implement unnecessary-async and UI test 2021-05-14 16:45:18 -07:00
ayushmishra2005
9013bf299e Addressed PR coments 2021-05-14 17:30:26 +05:30
ayushmishra2005
7d83f98ff3 Improve match statements 2021-05-14 08:57:33 +05:30
ThibsG
18c702955b Add sized trait for wrong_self_convention lint test 2021-05-13 23:28:40 +02:00
bors
10db5a6064 Auto merge of #7188 - mgacek8:issue7164_needless_collect_FP, r=xFrednet,flip1995
`needless_collect` enhancements

fixes #7164
changelog: `needless_collect`: For `BTreeMap` and `HashMap` lint only `is_empty`, as `len` might produce different results than iter's `count`
changelog: `needless_collect`: Lint `LinkedList` and `BinaryHeap` in direct usage case as well
2021-05-13 16:35:42 +00:00
bors
08ce8bb703 Auto merge of #7215 - ThibsG:WrongSelfFix7179, r=Manishearth
Trigger [`wrong_self_convention`] only if it has implicit self

Lint [`wrong_self_convention`] only if the impl or trait has `self` _per sé_.

Fixes: #7179

changelog: trigger [`wrong_self_convention`] only if it has implicit self
2021-05-13 16:00:58 +00:00
bors
1fd9975249 Auto merge of #7095 - Y-Nak:match_single_binding, r=giraffate
match_single_binding: Fix invalid suggestion when match scrutinee has side effects

fixes #7094

changelog: `match_single_binding`: Fix invalid suggestion when match scrutinee has side effects

---
`Expr::can_have_side_effects` is used to determine the scrutinee has side effects, while this method is a little bit conservative for our use case. But I'd like to use it to avoid reimplementation of the method and too much heuristics. If you think this is problematic, then I'll implement a custom visitor to address it.
2021-05-13 13:55:47 +00:00
ThibsG
368e621265 Stop linting else if let pattern in option_if_let_else lint 2021-05-13 11:50:25 +02:00
ThibsG
cd241b33cb Trigger wrong_self_convention only if it has implicit self 2021-05-13 10:24:29 +02:00
Jason Newcomb
cd0db8a459
Fix test comment for while_let_on_iterator 2021-05-12 21:51:23 -04:00
Jason Newcomb
4713e25ab0
Cleanup of while_let_on_iterator 2021-05-12 21:51:19 -04:00
Jason Newcomb
daca50a515
Improvements to while_let_on_iterator
* Suggest `&mut iter` when the iterator is used after the loop.
* Suggest `&mut iter` when the iterator is a field in a struct.
* Don't lint when the iterator is a field in a struct, and the struct is
used in the loop.
* Lint when the loop is nested in another loop, but suggest `&mut iter`
unless the iterator is from a local declared inside the loop.
2021-05-12 21:49:22 -04:00
Yoshitomo Nakanishi
8214bf0445 match_single_binding: Fix invalid suggestion when match scrutinee has side effects 2021-05-13 10:36:09 +09:00
xFrednet
0d4604dc05 Added cargo collect-metadata as a alias for the metadata collection lint 2021-05-13 01:41:22 +02:00
Aaron Hill
4698b366c4 Show macro name in 'this error originates in macro' message
When there are multiple macros in use, it can be difficult to tell
which one was responsible for producing an error.
2021-05-12 19:03:06 -04:00
Arya Kumar
5ba236f303 added needless_bitwise_bool lint 2021-05-11 19:34:14 +00:00
bors
918a1a20b1 Auto merge of #85109 - RalfJung:remove-const_fn, r=oli-obk
remove const_fn feature gate

Fixes https://github.com/rust-lang/rust/issues/84510
r? `@oli-obk`
2021-05-11 10:25:14 +00:00
Ralf Jung
c0095be6ee fix clippy test 2021-05-11 11:15:33 +02:00
bors
a8804e7bdb Auto merge of #85053 - camsteffen:duplicate-lint, r=davidtwco
Fix duplicate unknown lint errors

Fixes rust-lang/rust-clippy#6602
2021-05-10 09:45:28 +00:00
bors
65951c969f Auto merge of #7165 - camsteffen:question-mark, r=Manishearth
Fix needless_quesiton_mark false positive

changelog: Fix [`needless_question_mark`] false positive where the inner value is implicity dereferenced by the question mark.

Fixes #7107
2021-05-08 00:04:14 +00:00
Cameron Steffen
4d283ce8e4 Fix duplicate unknown lint errors 2021-05-07 17:26:32 -05:00
Mateusz Gacek
171789eb45 needless_collect: Lint LinkedList and BinaryHeap in direct usage.
Those two types are supported already when used indirectly.
This commit adds support for direct usage as well.
2021-05-07 09:00:51 -07:00
Mateusz Gacek
a21607d9b5 needless_collect: For BTreeMap and HashMap lint only is_empty
- `len` might produce different results than `count`
- they don't have `contain` but `contains_key` method
2021-05-07 08:39:00 -07:00
bors
af8cf9444c Auto merge of #7183 - th1000s:write_nl_hint, r=flip1995
Handle write!(buf, "\n") case better

Make `write!(buf, "\n")` suggest `writeln!(buf)` by removing
the trailing comma from `writeln!(buf, )`.

changelog: [`write_with_newline`] suggestion on only "\n" improved
2021-05-07 12:13:35 +00:00
Thomas Otto
5f3aae61af Handle write!(buf, "\n") case better
Make `write!(buf, "\n")` suggest `writeln!(buf)` by removing
the trailing comma from `writeln!(buf, )`.

changelog: [`write_with_newline`] suggestion on only "\n" improved
2021-05-07 00:53:13 +02:00
Mateusz Gacek
ab3094b3db wrong_self_convention: For to_* variant don't lint in trait impl taking self when non-Copy type
It relaxes rules for `to_*` variant, so it doesn't lint in trait definitions
and implementations anymore.
Although, non-`Copy` type implementing trait's `to_*` method taking
`self` feels not good (consumes ownership, so should be rather named `into_`), it would be better if this case was a pedantic lint (allow-by-default) instead.
2021-05-06 10:49:31 -07:00
flip1995
d605882023 Merge commit 'b71f3405606d49b9735606b479c3415a0ca9810f' into clippyup 2021-05-06 12:20:44 +02:00
flip1995
767cc7cd89
Merge remote-tracking branch 'upstream/master' into rustup 2021-05-06 11:32:03 +02:00
bors
7191675ab1 Auto merge of #7166 - TaKO8Ki:refactor_misc_early_module, r=llogiq
Refactor: arrange lints in misc_early module

This PR arranges misc_early lints so that they can be accessed more easily.
Basically, I refactored them following the instruction described in #6680.

cc: `@Y-Nak,` `@flip1995,` `@magurotuna`

changelog: Move lints in misc_early module into their own modules.
2021-05-06 07:46:52 +00:00
bors
9dd87051c7 Auto merge of #7175 - camsteffen:filter-map-none, r=Manishearth
Fix unnecessary_filter_map false positive

changelog: Fix an [`unnecessary_filter_map`] false positive

Fixes #6804
2021-05-05 22:57:05 +00:00
Cameron Steffen
d66d37303c Fix unnecessary_filter_map false positive 2021-05-05 16:44:00 -05:00
bors
93fe3562d0 Auto merge of #7174 - camsteffen:eval-order-async, r=flip1995
Fix eval_order_dependence async false positive

changelog: Fix [`eval_order_dependence`] false positive in async code

Fixes #6925
2021-05-05 21:18:05 +00:00
Cameron Steffen
7a7b8bd3e8 Fix eval_order_dependence async false positive 2021-05-05 15:08:44 -05:00
Cameron Steffen
2b38399920 Improve eval_order_dependence output 2021-05-05 15:03:14 -05:00
bors
182a1853c3 Auto merge of #7170 - flip1995:revert_drop_order, r=llogiq
Fix stack overflow issue in `redundant_pattern_matching`

Fixes #7169

~~cc `@Jarcho` Since tomorrow is release day and we need to get this also fixed in beta, I'll just revert the PR instead of looking into the root issue. Your changes are good, so if you have an idea what could cause this stack overflow and know how to fix it, please open a PR that reverts this revert with a fix.~~

r? `@llogiq`

changelog: none (fixes stack overflow, but this was introduced in this release cycle)
2021-05-05 17:33:46 +00:00
xFrednet
c1fa1102d4 ENABLE_METADATA_COLLECTION env-value to disable default metadata collection 2021-05-05 18:38:26 +02:00
xFrednet
4fc960301b Metadata collection: Rounding up the implementation 2021-05-05 18:38:26 +02:00
xFrednet
a39912cfbb Metadata collection: Some refactoring for readability 2021-05-05 18:35:33 +02:00
xFrednet
8dca1b8f61 Metadata collection: Collecting Applicability assign values 2021-05-05 18:35:33 +02:00
xFrednet
637751ff62 Metadata collection lint: Basic lint collection
WIP-2021-02-01

WIP-2021-02-01

WIP-2021-02-13
2021-05-05 18:34:24 +02:00
bors
0baf6bf226 Auto merge of #7163 - mgacek8:issue7110_needless_collect_with_type_annotations, r=flip1995
needless_collect: Lint cases with type annotations for indirect usage and recognize `BinaryHeap`

fixes #7110
changelog: needless_collect: Lint cases with type annotations for indirect usage and recognize `BinaryHeap`.
2021-05-05 15:43:02 +00:00
flip1995
59874f3bea
Add regression test for stack overflow in redundant_pattern_matching 2021-05-05 16:12:39 +02:00
Cameron Steffen
83329ec705 Fix unused_unit macro false positive 2021-05-04 17:20:33 -05:00
Cameron Steffen
919ed2ba03 Fix needless_quesiton_mark false positive 2021-05-04 16:28:13 -05:00
Mateusz Gacek
1835d8a238 needless_collect: Add BinaryHeap for indirect usage lint 2021-05-04 12:38:30 -07:00
Mateusz Gacek
0dc38c047e Fix copy_iterator uitest 2021-05-04 12:38:30 -07:00
Mateusz Gacek
b1faaaeb0c needless_collect: Lint cases with type annotations 2021-05-04 12:38:30 -07:00
flip1995
0854f0caee
Don't trigger field_reassign_with_default in macros
Producing a good suggestion for this lint is already hard when no macros
are involved. With macros the lint message and the suggestion are just
confusing. Since both, producing a good suggestion and figuring out if
this pattern can be re-written inside a macro is nearly impossible, just
bail out.
2021-05-04 16:48:43 +02:00
bors
9735470bb4 Auto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakis
Update BARE_TRAIT_OBJECT and ELLIPSIS_INCLUSIVE_RANGE_PATTERNS to errors in Rust 2021

This addresses https://github.com/rust-lang/rust/pull/81244 by updating two lints to errors in the Rust 2021 edition.

r? `@estebank`
2021-05-04 08:09:23 +00:00
Takayuki
64eb18e675 move builtin_type_shadow to its own module 2021-05-04 17:04:10 +09:00
bors
5e3160ca0b Auto merge of #7156 - hellow554:single_char_strip, r=flip1995
[single_char_pattern] add strip_prefix and strip_suffix

Title says it all. Adjusted ui tests.

I added the second commit in case you don't like that I moved that table into `single_char_pattern.rs` directly. I don't see any reason why it shouldn't be in that file. It isn't used anywhere else.

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: add strip_prefix and strip_suffix to single_char_pattern lint
2021-05-03 14:44:44 +00:00
Marcel Hellwig
c080899848 add strip_{prefix,suffix} to PATTERN_METHODS
this will warn, if a single_char_pattern is used in one of the above
methods
2021-05-03 16:18:41 +02:00
Cameron Steffen
857d9f15da Fix error punctuation 2021-05-02 16:56:46 -05:00
Kornel
b75354034c Add ErrorKind::OutOfMemory 2021-05-02 11:40:31 +01:00
Cameron Steffen
1e22e564e4 Refactor config deserialization 2021-05-01 17:38:05 -05:00
bors
a300b0e66c Auto merge of #7144 - rust-lang:while_immutable_mut_cond, r=flip1995
while_immutable_cond: check condition for mutation

This fixes #6689 by also checking the bindings mutated in the condition, whereas it was previously only checked in the loop body.

---

changelog: Fix FP in [`while_immutable_cond`] where mutation in the loop variable wasn't picked up.
2021-04-30 15:08:27 +00:00
bors
5e49c4bd67 Auto merge of #6951 - Jarcho:implicit_return_fp, r=flip1995
`implicit_return` improvements

fixes: #6940

changelog: Fix `implicit_return` suggestion for async functions
changelog: Improve `implicit_return` suggestions when returning the result of a macro
changelog: Check for `break` expressions inside a loop which are then implicitly returned
changelog: Allow all diverging functions in `implicit_return`, not just panic functions
2021-04-30 14:55:56 +00:00
bors
14f1551075 Auto merge of #7118 - TaKO8Ki:fix-false-positive-in-comparison-chain, r=giraffate
Fix a false-positive inside const fn in `comparison_chain`

closes https://github.com/rust-lang/rust-clippy/issues/7082

changelog: fix a false-positive inside const fn in [`comparison_chain`]
2021-04-30 06:30:38 +00:00
Ryan Levick
6ddd3c9e36 Fix clippy error 2021-04-29 18:37:22 +02:00
bors
bbd81f2fe1 Auto merge of #84189 - jyn514:clippy-dev, r=Mark-Simulacrum
Implement `x.py test src/tools/clippy --bless`

- Add clippy_dev to the rust workspace

  Before, it would give an error that it wasn't either included or
  excluded from the workspace:

  ```
  error: current package believes it's in a workspace when it's not:
  current:   /home/joshua/rustc/src/tools/clippy/clippy_dev/Cargo.toml
  workspace: /home/joshua/rustc/Cargo.toml

  this may be fixable by adding `src/tools/clippy/clippy_dev` to the `workspace.members` array of the manifest located at: /home/joshua/rustc/Cargo.toml
  Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest.
  ```

- Change clippy's copy of compiletest not to special-case
  rust-lang/rust. Using OUT_DIR confused `clippy_dev` and it couldn't find
  the test outputs. This is one of the reasons why `cargo dev bless` used
  to silently do nothing (the others were that `CARGO_TARGET_DIR` and
  `PROFILE` weren't set appropriately).

- Run clippy_dev on test failure

I tested this by removing a couple lines from a stderr file, and they
were correctly replaced.

- Fix clippy_dev warnings
2021-04-29 12:03:43 +00:00
Andre Bogus
63425de77d while_immutable_cond: check condition for mutation 2021-04-29 10:10:58 +02:00
Joshua Nelson
af0dde24b9 Implement x.py test src/tools/clippy --bless
- Add clippy_dev to the rust workspace

  Before, it would give an error that it wasn't either included or
  excluded from the workspace:

  ```
  error: current package believes it's in a workspace when it's not:
  current:   /home/joshua/rustc/src/tools/clippy/clippy_dev/Cargo.toml
  workspace: /home/joshua/rustc/Cargo.toml

  this may be fixable by adding `src/tools/clippy/clippy_dev` to the `workspace.members` array of the manifest located at: /home/joshua/rustc/Cargo.toml
  Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest.
  ```

- Change clippy's copy of compiletest not to special-case
  rust-lang/rust. Using OUT_DIR confused `clippy_dev` and it couldn't find
  the test outputs. This is one of the reasons why `cargo dev bless` used
  to silently do nothing (the others were that `CARGO_TARGET_DIR` and
  `PROFILE` weren't set appropriately).

- Run clippy_dev on test failure

I tested this by removing a couple lines from a stderr file, and they
were correctly replaced.

- Fix clippy_dev warnings
2021-04-27 16:57:29 +00:00
flip1995
ae72f1adb9 Merge commit '7c7683c8efe447b251d6c5ca6cce51233060f6e8' into clippyup 2021-04-27 16:55:11 +02:00
bors
7c7683c8ef Auto merge of #7128 - Jarcho:const_fn_ice, r=flip1995
Fix ICE checking for feature gated const fn

fixes: #7126
changelog: Fix ICE in `missing_const_for_fn` when using a feature-gated `const fn`
2021-04-27 14:21:11 +00:00
bors
9af07e65aa Auto merge of #7138 - mgacek8:issue6808_iter_cloned_collect_FN_with_large_array, r=Manishearth
Fix FN in `iter_cloned_collect` with a large array

fixes #6808
changelog: Fix FN in `iter_cloned_collect` with a large array

I spotted that [is_iterable_array](a362a4d1d0/clippy_lints/src/loops/explicit_iter_loop.rs (L67-L75)) function that `explicit_iter_loop` lint is using only works for array sizes <= 32.
There is this comment:
> IntoIterator is currently only implemented for array sizes <= 32 in rustc

I'm a bit confused, because I read that [IntoIterator for arrays](https://doc.rust-lang.org/src/core/array/mod.rs.html#194-201) with const generic `N` is stable since = "1.0.0". Although Const Generics MVP were stabilized in Rust 1.51.

Should I set MSRV for the current change? I will try to test with older compilers soon.
2021-04-27 13:44:51 +00:00
bors
0a330e6824 Auto merge of #7136 - mgacek8:issue6965_manual_unwrap_or_invalid_sugg_macro_expansion, r=llogiq
manual_unwrap_or: fix invalid code suggestion, due to macro expansion

fixes #6965

changelog: fix invalid code suggestion in `manual_unwrap_or` lint, due to macro expansion
2021-04-26 21:39:40 +00:00
Cameron Steffen
33ed8b5b24 Remove needless_question_mark MSRV 2021-04-26 16:02:11 -05:00
Mateusz Gacek
d7627dcfc8 Fix FN in iter_cloned_collect with a large array 2021-04-26 13:03:51 -07:00
Mateusz Gacek
84003aa7a1 fix invalid code suggestion in manual_unwrap_or, due to macro expansion 2021-04-26 12:19:23 -07:00
bors
a362a4d1d0 Auto merge of #7134 - camsteffen:copied-msrv, r=Manishearth
Finish MSRV for cloned_instead_of_copied

changelog: none

r? `@Manishearth`
2021-04-26 16:12:04 +00:00
Cameron Steffen
dcf4e07458 Finish MSRV for cloned_instead_of_copied 2021-04-26 11:09:24 -05:00
Andre Bogus
efc4c6c957 extend single_element_loop to match .iter() 2021-04-26 15:58:58 +02:00
Jason Newcomb
db7ad648e7
Fix ICE checking for feature gated const fn 2021-04-25 10:18:15 -04:00
bors
74f55996fe Auto merge of #7120 - cherryblossom000:7106, r=Manishearth
`single_component_path_imports`: ignore `pub(crate) use some_macro;`

Fixes #7106

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: Ignore exporting a macro within a crate using `pub(crate) use some_macro;` for [`single_component_path_imports`]
2021-04-22 14:36:21 +00:00
bors
0ab7acc890 Auto merge of #7100 - ABouttefeux:unused_io_amount, r=camsteffen
Unused io amount detects `.read().ok()?`

fixes #7096
changelog: unused_io_amount now detect expertion like `.read().ok()?`,  `.read().or_else(|err| ...)?` and similar expressions.
2021-04-22 13:57:06 +00:00
Aliénore Bouttefeux
5625d58f9f add detection unused_io_amount of "or", "or_else" and "ok" 2021-04-22 15:52:42 +02:00
Jason Newcomb
74cf5f2fc6
Fix implicit_return suggestion for async functions 2021-04-22 09:36:32 -04:00
Jason Newcomb
22f8c13cf5
Improve implicit_return
Better suggestions when returning macro calls.
Suggest changeing all the break expressions in a loop, not just the final statement.
Don't lint divergent functions.
Don't suggest returning the result of any divergent fuction.
2021-04-22 09:13:06 -04:00
cherryblossom
b48699e4cf
single_component_path_imports: ignore pub(crate) use some_macro; (fixes #7106) 2021-04-22 19:34:36 +10:00
flip1995
02bf692169 Merge commit '98e2b9f25b6db4b2680a3d388456d9f95cb28344' into clippyup 2021-04-22 11:31:13 +02:00
flip1995
44c8057f4d
Merge remote-tracking branch 'upstream/master' into rustup 2021-04-22 11:24:26 +02:00
Takayuki
65778fa5e8 fix a false-positive inside const fn in comparison_chain 2021-04-22 16:58:12 +09:00
bors
79b9eb5371 Auto merge of #7072 - ebobrow:imports-ending-with-self, r=camsteffen
add unnecessary_self_imports lint

fixes #6552

changelog: add `unnecessary_self_imports` lint
2021-04-21 14:47:49 +00:00
Elliot Bobrow
224881b94d add unnecessary_self_imports lint 2021-04-21 07:17:42 -07:00
bors
bbc22e2ef3 Auto merge of #7083 - GuillaumeGomez:bool-assert-eq, r=camsteffen
Add lint to check for boolean comparison in assert macro calls

This PR adds a lint to check if an assert macro is using a boolean as "comparison value". For example:

```rust
assert_eq!("a".is_empty(), false);
```

Could be rewritten as:

```rust
assert!(!"a".is_empty());
```

PS: The dev guidelines are amazing. Thanks a lot for writing them!

changelog: Add `bool_assert_comparison` lint
2021-04-21 13:58:53 +00:00
bors
926286acfe Auto merge of #7109 - ctennis:ct/asm_syntax_aarch64, r=flip1995
Ignore aarch64 for this test as it's x86 assembly only.  Fixes #7091

fixes #7091 - asm_syntax lint test will not compile on aarch64

changelog: none
2021-04-21 08:49:15 +00:00
bors
ec38ea1ac1 Auto merge of #7097 - yawara:fix/7069, r=llogiq
Fixed inconsistent_struct_constructor triggers in macro-generated code

fixes #7069

changelog: `inconsistent_struct_constructor`: Fix FP in macro expansion.
2021-04-20 08:26:21 +00:00
Yawara ISHIDA
6eae905808 Add a test for FP in macro expansion 2021-04-20 13:34:30 +09:00
bors
b7c12f3aab Auto merge of #7092 - basavesh:fix#7066, r=giraffate
useless use of format! should return function directly

fixes #7066

changelog: [`useless_format`] wraps the content in the braces when it's needed.

r? `@giraffate`
2021-04-19 23:06:21 +00:00
Guillaume Gomez
e2e104b993 Add lint to check for boolean comparison in assert macro calls 2021-04-19 22:15:51 +02:00
lcnr
419bf6bbd8 fix suggestion for unsized function parameters 2021-04-19 20:06:19 +02:00
Caleb Tennis
42d070286e Ignore aarch64 for this test as it's x86 assembly only. Fixes #7091 2021-04-19 11:39:42 -04:00
Basavesh Shivakumar
c6b381c59b useless use of format! should return function directly 2021-04-19 17:20:21 +02:00
bors
fe5cefceba Auto merge of #7101 - camsteffen:flat-map-option, r=giraffate
Add flat_map_option lint

changelog: Add flat_map_option lint

Closes #2241
2021-04-19 13:34:23 +00:00
Andre Bogus
243dc46250 un-double return on try_err 2021-04-18 23:49:54 +02:00
bors
392d54963f Auto merge of #78880 - CDirkx:not_supported, r=joshtriplett
Add `Unsupported` to `std::io::ErrorKind`

I noticed a significant portion of the uses of `ErrorKind::Other` in std is for unsupported operations.
The notion that a specific operation is not available on a target (and will thus never succeed) seems semantically distinct enough from just "an unspecified error occurred", which is why I am proposing to add the variant `Unsupported` to `std::io::ErrorKind`.

**Implementation**:

The following variant will be added to `std::io::ErrorKind`:

```rust
/// This operation is unsupported on this platform.
Unsupported
```
`std::io::ErrorKind::Unsupported` is an error returned when a given operation is not supported on a platform, and will thus never succeed; there is no way for the software to recover. It will be used instead of `Other` where appropriate, e.g. on wasm for file and network operations.

`decode_error_kind` will be updated  to decode operating system errors to `Unsupported`:
- Unix and VxWorks: `libc::ENOSYS`
- Windows: `c::ERROR_CALL_NOT_IMPLEMENTED`
- WASI: `wasi::ERRNO_NOSYS`

**Stability**:
This changes the kind of error returned by some functions on some platforms, which I think is not covered by the stability guarantees of the std? User code could depend on this behavior, expecting `ErrorKind::Other`, however the docs already mention:

> Errors that are `Other` now may move to a different or a new `ErrorKind` variant in the future. It is not recommended to match an error against `Other` and to expect any additional characteristics, e.g., a specific `Error::raw_os_error` return value.

The most recent variant added to `ErrorKind` was `UnexpectedEof` in `1.6.0` (almost 5 years ago), but `ErrorKind` is marked as `#[non_exhaustive]` and the docs warn about exhaustively matching on it, so adding a new variant per se should not be a breaking change.

The variant `Unsupported` itself could be marked as `#[unstable]`, however, because this PR also immediately uses this new variant and changes the errors returned by functions I'm inclined to agree with the others in this thread that the variant should be insta-stabilized.
2021-04-18 20:03:54 +00:00
Christiaan Dirkx
024a49aed1 Fix clippy test using ErrorKind 2021-04-18 09:29:24 +02:00
bors
8c37e19da4 Auto merge of #84064 - hyd-dev:unknown-lints, r=petrochenkov
Do not ignore path segments in the middle in `#[allow]`/`#[warn]`/`#[deny]`/`#[forbid]` attributes

Fixes #83477.
2021-04-18 02:12:13 +00:00
hyd-dev
913780397a Do not ignore path segments in the middle in #[allow]/#[warn]/#[deny]/#[forbid] attributes 2021-04-17 18:11:07 +08:00
bors
e441b33ba0 Auto merge of #7099 - ABouttefeux:master, r=llogiq
add type in help message of from_over_into

fixes #7088
changelog: add type in help message of from_over_into
2021-04-16 21:22:24 +00:00
Cameron Steffen
5af078ac1b Add flat_map_option lint 2021-04-16 15:23:49 -05:00
bors
831c15737c Auto merge of #7087 - Jarcho:allman_style_else, r=camsteffen
Allow allman style braces in `suspicious_else_formatting`

fixes: #3864

Indentation checks could be added as well, but the lint already doesn't check for it.

changelog: Allow allman style braces in `suspicious_else_formatting`
2021-04-16 20:16:52 +00:00
Jason Newcomb
559deddb3b
Allow allman style braces in suspicious_else_formatting 2021-04-16 15:24:46 -04:00
bors
eaf0f3df15 Auto merge of #7075 - xFrednet:7054-fp-branches-sharing-code, r=camsteffen,flip1995
Fixing FPs for the `branches_sharing_code` lint

Fixes #7053
Fixes #7054
And an additional CSS adjustment to support dark mode for every inline code. It currently only works in paragraphs, which was an oversight on my part 😅. [Current Example](https://rust-lang.github.io/rust-clippy/master/index.html#blacklisted_name)

This also includes ~50 lines of doc comments and is therefor not as big as the changes would indicate. 🐧

---

changelog: none

All of these bugs were introduced in this dev version and are therefor not worth a change log entry.

r? `@phansch`
cc: `@camsteffen` since you have a pretty good overview of the `SpanlessEq` implementation 🙃
2021-04-16 18:33:45 +00:00
Aliénore Bouttefeux
ccd0f0b4af added missing line in test ouput 2021-04-16 20:13:25 +02:00
Aliénore Bouttefeux
2d050f4b2f add type in help of from over Into 2021-04-16 19:38:01 +02:00
bors
28dbcd85c8 Auto merge of #7098 - camsteffen:cloned-copied, r=Manishearth
Add `cloned_instead_of_copied` lint

Don't go cloning all willy-nilly.

Featuring a new `get_iterator_item_ty` util!

changelog: Add cloned_instead_of_copied lint

Closes #3870
2021-04-16 17:32:13 +00:00
bors
7f2068cc2b Auto merge of #6568 - Jarcho:redundant_pattern_matching, r=flip1995
Fix: redundant_pattern_matching drop order

Fixes #5746

A note about the change in drop order is added when the scrutinee (or any temporary in the expression) isn't known to be safe to drop in any order (i.e. doesn't implement the `Drop` trait, or contain such a type). There is a whitelist for some `std` types, but it's incomplete. Currently just `Vec<_>`, `Box<_>`, `Rc<_>` and `Arc<_>`, but only if the contained type is also safe to drop in any order.

Another lint for when the drop order changes could be added as allowed by default, but the drop order requirement is pretty subtle in this case. I think the note added to the lint should be enough to make someone think before applying the change.

changelog: Added a note to `redundant_pattern_matching` when the change in drop order might matter
2021-04-16 16:45:59 +00:00
Cameron Steffen
0462666c70 Add cloned_instead_of_copied lint 2021-04-16 11:39:31 -05:00
bors
1e0a3ff55c Auto merge of #6937 - Jarcho:map_entry_suggestion, r=giraffate
Improve `map_entry` suggestion

fixes: #5176
fixes: #4674
fixes: #4664
fixes: #1450

Still need to handle the value returned by `insert` correctly.

changelog: Improve `map_entry` suggestion. Will now suggest `or_insert`, `insert_with` or `match _.entry(_)` as appopriate.
changelog: Fix `map_entry` false positives where the entry api can't be used. e.g. when the map is used for multiple things.
2021-04-16 13:23:23 +00:00
bors
ddc2598230 Auto merge of #7093 - Jarcho:single_match_fp, r=llogiq
Fix `single_match`

fixes: #7038
changelog: Don't suggest an equality check for types which don't implement `PartialEq` in `single_match`
2021-04-16 06:44:26 +00:00
Charles Lew
696562d22d Remove #[main] attribute. 2021-04-16 13:04:02 +08:00
bors
faa97568a0 Auto merge of #7085 - Jarcho:manual_map_autoderef, r=giraffate
Don't allow adjustments for `manual_map`

fixes: #7077

The other option here would be to add the return type to the closure. It would be fine for simple types, but longer types can be rather unwieldy. Could also implement the adjustment manually.

changelog: Don't lint `manual_map` when type adjustments are added. e.g. autoderef
2021-04-16 03:05:52 +00:00
Jason Newcomb
9a55c0c176
Fix single_match
Check for `PartialEq` in addition to `StructuralPartialEq` before suggesting `==`
2021-04-15 22:09:20 -04:00
Jason Newcomb
b6581636bd
Improve redundant_pattern_matching
Add a note when the drop order change may result in different behaviour.
2021-04-15 20:37:15 -04:00
Jason Newcomb
f6c5d8d599
Remove all usages of match_path, match_qpath and match_path_ast except the author lint.
Add note to fix `MATCH_TYPE_ON_DIAG_ITEM`
Add false negative test for `uninit_assumed_init`
2021-04-15 19:27:25 -04:00
Jason Newcomb
779d98f6cc
Don't allow adjustments for manual_map 2021-04-15 10:37:42 -04:00
Jason Newcomb
bcf3488007
Minor cleanup of map_entry and a few additional tests. 2021-04-15 08:25:24 -04:00
Jason Newcomb
3323ff7145
map_entry improvements
Suggest using `or_insert_with` when possible
2021-04-15 08:22:40 -04:00
Jason Newcomb
b63a5b56d6
map_entry improvements
Lint `if _.[!]contains_key(&_) { .. } else { .. }` so long as one of the branches contains an insertion.
2021-04-15 08:19:59 -04:00
Jason Newcomb
ce5e927713
Improve map_entry lint
Fix false positives where the map is used before inserting into the map.
Fix false positives where two insertions happen.
Suggest using `if let Entry::Vacant(e) = _.entry(_)` when `or_insert` might be a semantic change
2021-04-15 08:19:40 -04:00
xFrednet
2992b19c82 Added inferred local type comparion to SpanlessEq 2021-04-14 20:06:26 +02:00
xFrednet
cbde4f2c67 parent_node_is_if_expr now also recognizes if let as parent if 2021-04-14 20:06:26 +02:00
bors
24921df7bd Auto merge of #7039 - phansch:melt-ice, r=flip1995
tabs_in_doc_comments: Fix ICE due to char indexing

This is a quick-fix for an ICE in `tabs_in_doc_comments`. The problem
was that we we're indexing into possibly multi-byte characters, such as '位'.

More specifically `get_chunks_of_tabs` was returning indices into
multi-byte characters. Those were passed on to a `Span` creation that
then caused the ICE.

This fix makes sure that we don't return indices that point inside a
multi-byte character. *However*, we are still iterating over unicode
codepoints, not grapheme clusters. So a seemingly single character like y̆ ,
which actually consists of two codepoints, will probably still cause
incorrect spans in the output. But I don't think we handle those cases
anywhere in Clippy currently?

Fixes #5835

changelog: Fix ICE in `tabs_in_doc_comments`
2021-04-14 04:53:24 +00:00
rail
26a1989041 Fix a FP in missing_const_for_fn
where a function that calls a standard library function whose constness
is unstable is considered as being able to be a const function
2021-04-14 09:23:44 +12:00
bors
2a96bc434b Auto merge of #7067 - TaKO8Ki:fix-false-negative-on-needless-return, r=llogiq
Fix a false negative on `needless return`

closes #7042

changelog: fix a false negative on `needless return`
2021-04-12 18:00:38 +00:00
bors
411c0df1d0 Auto merge of #7064 - ThibsG:WrongSelfFix, r=giraffate
Fix FP in `wrong_self_convention` lint

Previously, this lint didn't check into impl block when it was implementing a trait.
Recent improvements (#6924) have moved this check and some impl blocks are now checked but they shouldn't, such as in #7032.

Fixes #7032

changelog: Fix FP when not taking `self` in impl block for `wrong_self_convention` lint
2021-04-12 14:16:17 +00:00
Takayuki
e6c67ad2bf fix limit_stderr_length error 2021-04-12 21:58:34 +09:00
Takayuki
0218a3b12f add tests for a false negative on needless_return 2021-04-12 21:37:19 +09:00
bors
c3ef585328 Auto merge of #6982 - Jarcho:explicit_into_iter_loop_fp, r=flip1995
Fix `explicit_into_iter_loop`

fixes: #6900

changelog: Only lint when `into_iter` is an implementation of `IntoIterator`
2021-04-12 09:45:32 +00:00
bors
a6b514c603 Auto merge of #7059 - camsteffen:filter-map, r=flip1995
Deprecate `filter_map`

Since #6591, `filter_map` does not even lint `filter().map()`. The cases that are still linted make no sense IMO. So this just removes/deprecates it.

changelog: Deprecate `filter_map` lint

Closes #3424
Fixes #7050
2021-04-11 18:24:23 +00:00
bors
67fad0139f Auto merge of #6905 - ThibsG:fpSingleComponentPathImports5210, r=giraffate
Fix FP in `single_component_path_imports` lint

Fix FP in  `single_component_path_imports` lint when the import is reused with `self`, like in `use self::module`.

Fixes #5210

changelog: none
2021-04-11 14:18:38 +00:00
ThibsG
3ce6f0d022 Fix FP in wrong_self_convention lint 2021-04-11 13:29:08 +02:00
Cameron Steffen
a45faf66f3 Deprecate filter_map 2021-04-10 16:59:59 -05:00
daxpedda
cb14e7ebf4
Fix false-positive debug_assert in panic 2021-04-10 23:37:18 +02:00
daxpedda
8f4417faf2
Fix rustfmt 2021-04-10 17:45:55 +02:00
daxpedda
43e6c656ba
Remove debug_assert from panic_in_result_fn 2021-04-10 17:38:04 +02:00
Philipp Hansch
8b9331b49d Fix rustfmt error / Add comment for tab character 2021-04-10 14:43:52 +02:00
ThibsG
297e84f3f4 Handle imports which are nested directly 2021-04-10 10:26:53 +02:00
Joshua Nelson
012f9d47b2 Use register_renamed instead of register_removed for uplifted lints
This still applies the lint, and also adds a structured suggestion to
rename it.
2021-04-09 10:56:11 -04:00
bors
75efc144e7 Auto merge of #7023 - boxdot:invalid-null-usage-v2, r=camsteffen
Invalid null usage v2

This is continuation of #6192 after inactivity.

I plan to move paths into the compiler as diagnostic items after this is merged.

fixes #1703
changelog: none
2021-04-08 21:00:48 +00:00
boxdot
4f7fc11ef1
Add invalid null pointer usage lint. 2021-04-08 22:49:48 +02:00
bors
c40fa00113 Auto merge of #7022 - Jarcho:macro_use_import_ice, r=flip1995
Fix `macro_use_import` ICE

fixes: #7015
changelog: Fix `macro_use_import` ICE
2021-04-08 16:04:55 +00:00
flip1995
f6d1f368db Merge commit 'b40ea209e7f14c8193ddfc98143967b6a2f4f5c9' into clippyup 2021-04-08 17:50:13 +02:00
flip1995
ffa2b7da29
Merge remote-tracking branch 'upstream/master' into rustup 2021-04-08 17:36:41 +02:00
Jason Newcomb
6b5778eb17
Fix explicit_into_iter_loop
Only lint when `into_iter` is an implementation of `IntoIterator`
Minor cleanups
2021-04-06 12:12:32 -04:00
Jason Newcomb
12fce55766
Fix all occurences of needless_borrow internally 2021-04-06 10:43:47 -04:00
bors
d2ba777159 Auto merge of #7036 - horacimacias:master, r=giraffate
consider mutability on useless_vec suggestions

fixes #7035

changelog: Now the suggested by `useless_vec` considers mutability to suggest either `&[]`, as before, or `&mut []` if the used reference is mutable.
2021-04-06 13:38:08 +00:00
Horaci Macias
8a50923da4 consider mutability on useless_vec suggestions
https://github.com/rust-lang/rust-clippy/issues/7035
2021-04-06 11:09:52 +02:00
Philipp Hansch
1573d10325
tabs_in_doc_comments: Fix ICE due to char indexing
This is a quick-fix for an ICE in `tabs_in_doc_comments`. The problem
was that we we're indexing into possibly multi-byte characters, such as '位'.

More specifically `get_chunks_of_tabs` was returning indices into
multi-byte characters. Those were passed on to a `Span` creation that
then caused the ICE.

This fix makes sure that we don't return indices that point inside a
multi-byte character. *However*, we are still iterating over unicode
codepoints, not grapheme clusters. So a seemingly single character like y̆ ,
which actually consists of two codepoints, will probably still cause
incorrect spans in the output.
2021-04-06 07:20:55 +02:00
bors
57406c93df Auto merge of #7018 - Y-Nak:same_item_push, r=Manishearth
Don't trigger `same_item_push` if the vec is used in the loop body

fixes #6987
changelog: `same_item_push`: Don't trigger if the `vec` is used in the loop body
2021-04-05 22:57:33 +00:00
bors
25c1ed38aa Auto merge of #7029 - ABouttefeux:master, r=Manishearth
fix `missing_panics_doc` not detecting `assert_eq!` and `assert_ne!`

fixes #6997
changelog: `missing_panics_doc` detects `assert_eq!` and `assert_ne!`

---
searching for `assert_eq!` and `assert_ne!` in `FindPanicUnwrap`
2021-04-05 19:14:55 +00:00
bors
d91da405df Auto merge of #6463 - xFrednet:5234-shared-code-in-if-blocks, r=phansch
New Lint: `branches_sharing_code`

This lint checks if all `if`-blocks contain some statements that are the same and can be moved out of the blocks to prevent code duplication. Here is an example:

```rust
let _ = if ... {
    println!("Start"); // <-- Lint for code duplication
    let _a = 99;
    println!("End"); // <-- Lint for code duplication
    false
} else {
    println!("Start");
    let _b = 17;
    println!("End");
    false
};
```

This could be written as:

```rust
println!("Start");

let _ = if ... {
    let _a = 99;
    false
} else {
    let _b = 17;
    false
};

println!("End");
```

---

This lint will get masked by the `IF_SAME_THEN_ELSE` lint. I think it makes more sense to only emit one lint per if block. This means that the folloing example:

```rust
if ... {
    let _a = 17;
} else {
    let _a = 17;
}
```

Will only trigger the `IF_SAME_THEN_ELSE` lint and not the `SHARED_CODE_IN_IF_BLOCKS` lint.

---

closes: #5234

changelog: Added a new lint: `branches_sharing_code`

And hello to the one that is writing the changelog for this release :D
2021-04-05 19:00:41 +00:00
bors
1a45e437b8 Auto merge of #7026 - daxpedda:cargo-author, r=camsteffen
Remove author requirement for `cargo_common_metadata`

This PR follows https://github.com/rust-lang/cargo/pull/9282, I'm not fully informed about all of this, it would be great if somebody knowledgeable about this topic agrees.

changelog: Changed `cargo_common_metadata` to stop linting on the optional author field.
2021-04-05 18:02:32 +00:00
xFrednet
a6f54f5dfd Renaming the lint to branches_sharing_code and fixing typos 2021-04-05 13:35:51 +02:00
xFrednet
7c9e192e05 Test for empty blocks and update from master 2021-04-05 13:35:51 +02:00
xFrednet
617c65baa9 Moving shared_code_in_if_blocks to clippy::complexity and running lintcheck 2021-04-05 13:35:51 +02:00
xFrednet
c74e49eab9 Adapted the lint to use the new SpanlessEq 2021-04-05 13:35:51 +02:00
xFrednet
65ed5a632f Updated code for dogfood 2021-04-05 13:33:45 +02:00
xFrednet
b1d26e544f Improved shared_code_in_if_blocks message and added test stderrs 2021-04-05 13:33:45 +02:00
xFrednet
8efc6acc05 Improved shared_code_in_if_blocks output readability and added tests 2021-04-05 13:33:45 +02:00
xFrednet
469ff96db3 The shared_code_in_if_blocks lint only operats on entire if expr not else ifs 2021-04-05 13:33:45 +02:00
xFrednet
d1df73228a A new lint for shared code in if blocks
* Added expression check for shared_code_in_if_blocks
* Finishing touches for the shared_code_in_if_blocks lint
* Applying PR suggestions
* Update lints yay
* Moved test into subfolder
2021-04-05 13:33:45 +02:00
Aliénore Bouttefeux
8e5dd4b2e9 add test for missing_panic_doc on assert_eq/assert_ne 2021-04-05 09:16:48 +02:00
Jason Newcomb
a00de90ceb
Fix ICE in missing_panics_doc 2021-04-05 00:09:13 -04:00
ThibsG
81dfb9ecfb Check path imports per module 2021-04-04 14:25:05 +02:00
daxpedda
5102c9cc69
Remove author requirement for cargo_common_metadata 2021-04-03 22:52:48 +02:00
Cameron Steffen
7014340d57 Fix ICE 2021-04-03 14:17:58 -05:00
Vadim Petrochenkov
c7264483e7 Remove attribute #[link_args] 2021-04-03 21:25:53 +03:00
Jason Newcomb
c05760ff90
Fix macro_use_import ICE 2021-04-02 22:27:13 -04:00
Cameron Steffen
33798bb064 Improve needless_collect output 2021-04-02 10:10:54 -05:00
bors
1931db20b1 Auto merge of #6988 - mikerite:fix-6984, r=camsteffen
Fix hidden variant suggestion on single variant

Fixes #6984

changelog: Fix hidden variant suggestion on `match_wildcard_for_single_variants`
2021-04-02 12:42:40 +00:00
Yoshitomo Nakanishi
9f6f001988 same_item_push: Don't trigger same_item_push if the vec is used in the loop body 2021-04-02 16:28:16 +09:00
bors
72eb60a28b Auto merge of #7013 - Y-Nak:fix-needless-paren, r=flip1995
clippy_utils: fix needless parenthesis output from sugg::Sugg::maybe_par

changelog: clippy_utils: fix needless parenthesis output from `sugg::Sugg::maybe_par`

fixes: #6767
2021-04-01 15:09:46 +00:00
bors
92c4fc3cd8 Auto merge of #7011 - Jarcho:redundant_clone_fp, r=flip1995
Fix `redundant_clone` fp

fixes: #5973
fixes: #5595
fixes: #6998

changelog: Fix `redundant_clone` fp  where the cloned value is modified while the clone is in use.
2021-04-01 14:06:04 +00:00
bors
38b1fd0fa7 Auto merge of #7002 - mgacek8:issue6983_wrong_self_convention_inside_trait_impls, r=phansch
wrong_self_convention: fix FP inside trait impl for `to_*` method taking `&self`

fixes #6983
changelog: `wrong_self_convention`: fix FP inside trait impl for `to_*` method taking `&self`
2021-04-01 05:48:16 +00:00
bors
75d73e95a0 Auto merge of #6976 - Jarcho:manual_map_const, r=phansch
Don't lint `manual_map` in const functions

fixes: #6967

changelog: Don't lint `manual_map` in const functions
2021-04-01 05:34:34 +00:00
Yoshitomo Nakanishi
6325fe1f54 clippy_utils: fix needless parenthesis output from sugg::Sugg::maybe_par 2021-04-01 10:40:44 +09:00
Jason Newcomb
aaba9b78a2
Fix redundant_clone fp where the cloned value is modified while the clone is in use. 2021-03-31 15:35:34 -04:00
Cameron Steffen
5f887d09b8 Add if_chain lints 2021-03-31 14:06:27 -05:00
bors
775ef473d7 Auto merge of #6342 - bbqbaron:issue-6061, r=flip1995
Lint: filter(Option::is_some).map(Option::unwrap)

Fixes #6061

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog:
* add new lint for filter(Option::is_some).map(Option::unwrap)

First Rust PR, so I'm sure I've violated some idioms. Happy to change anything.

I'm getting one test failure locally -- a stderr diff for `compile_test`. I'm having a hard time seeing how I could be causing it, so I'm tentatively opening this in the hopes that it's an artifact of my local setup against `rustc`. Hoping it can at least still be reviewed in the meantime.

I'm gathering that since this is a method lint, and `.filter(...).map(...)` is already checked, the means of implementation needs to be a little different, so I didn't exactly follow the setup boilerplate. My way of checking for method calls seems a little too direct (ie, "is the second element of the expression literally the path for `Option::is_some`?"), but it seems like that's how some other lints work, so I went with it. I'm assuming we're not concerned about, eg, closures that just end up equivalent to `Option::is_some` by eta reduction.
2021-03-31 16:19:07 +00:00
bors
c1021b806c Auto merge of #6706 - Y-Nak:excessive-for-each, r=camsteffen
New Lint: needless_for_each

resolves: #6543

changelog: Added pedantic lint: `needless_for_each`
2021-03-31 15:59:55 +00:00
Eric Loren
56fbbf7b8f Suggest flatten instead of is_some -> unwrap 2021-03-31 11:35:24 -04:00
Yoshitomo Nakanishi
e61f9782c8 Tweak a suggestion message of needless_for_each 2021-04-01 00:08:59 +09:00
Yoshitomo Nakanishi
bf1e3f7a9f Skip needless_for_each if an input stmt is local 2021-04-01 00:05:42 +09:00
Yoshitomo Nakanishi
1109dc8838 Fix codes that make dogfood fail 2021-04-01 00:05:42 +09:00
Yoshitomo Nakanishi
f2cc995bcf Remove method_calls 2021-04-01 00:05:42 +09:00
Yoshitomo Nakanishi
527fbbef48 Refactor excessive_for_each 2021-04-01 00:05:42 +09:00
Yoshitomo Nakanishi
90cbbb2da3 Avoid to suggest using label 2021-04-01 00:05:42 +09:00
Yoshitomo Nakanishi
5bb0f16552 Trigger the lint iff exposure's body is ExprKind::Block. 2021-04-01 00:05:42 +09:00
Yoshitomo Nakanishi
5029dc805f New Lint: excessive_for_each 2021-04-01 00:05:42 +09:00
bors
3e42c35b72 Auto merge of #6981 - matthiaskrgr:6803_take_2, r=flip1995
disable upper_case_acronyms for pub items - enum edition

Fixes https://github.com/rust-lang/rust-clippy/issues/6803 (again... 😅  )

My previous fix did not work for enums because enum variants were checked separately in the `check_variant` function but it looks like we can't use that because we can't tell if the enum the variants belong to is declared as public or not (it always said `Inherited` for me)

I went and special-cased enums and iterated over all the variants "manually", but only, if the enums is not public.

---

changelog: fix upper_case_acronyms still firing on public enums (#6803)
2021-03-31 15:02:40 +00:00
bors
2e33bf6347 Auto merge of #6938 - Y-Nak:refactor-types, r=flip1995
Refactor types

r? `@flip1995`
This is the last PR to close #6724 🎉
Also, this fixes #6936.

changelog: `vec_box`: Fix FN in `const` or `static`
changelog: `linkedlist`: Fix FN in `const` or `static`
changelog: `option_option`: Fix FN in `const` or `static`
2021-03-31 14:35:48 +00:00
Michael Wright
8abab5561c Fix hidden variant suggestion on single variant
Fixes #6984
2021-03-31 07:36:09 +02:00
bors
0b76719638 Auto merge of #7007 - Y-Nak:result_unit_err, r=giraffate
result_unit_err: Fix typo

changelog: result_unit_err: fix typo in a diagnostic message

r? `@giraffate`
fixes https://github.com/rust-lang/rust-clippy/pull/6990#discussion_r603292920.
2021-03-31 04:01:15 +00:00
Yoshitomo Nakanishi
45164de59f result_unit_err: Fix typo 2021-03-31 11:18:48 +09:00
bors
4be72b0936 Auto merge of #7001 - ebobrow:non-octal-file-permissions, r=Manishearth
Add non_octal_unix_permissions lint

fixes #6934

changelog: add new lint that checks for non-octal values used to set unix file permissions
2021-03-30 23:23:50 +00:00
Elliot Bobrow
7fcd155712 Add non_octal_unix_permissions lint 2021-03-30 16:04:16 -07:00
Jason Newcomb
cc7f1daab2
Don't lint manual_map in const functions 2021-03-30 10:56:08 -04:00
bors
44bf60f62d Auto merge of #7004 - Jarcho:manual_map_if_then_else, r=camsteffen
Fix `manual_map` at the end of an if chain

changelog: Fix `manual_map` suggestion at the end of an if chain
2021-03-30 14:03:54 +00:00
Jason Newcomb
fa689f865e
Fix manual_map at the end of an if chain 2021-03-30 09:58:23 -04:00
Mateusz Gacek
6966c78be7
wrong_self_convention: fix FP inside trait impl for to_* method
When the `to_*` method takes `&self` and it is a trait implementation,
we don't trigger the lint.
2021-03-29 23:46:03 -07:00
bors
0552852d9a Auto merge of #7000 - Jarcho:clone_on_copy_fp, r=llogiq
Improve `clone_on_copy`

This also removes the `clone_on_copy_mut` test as the same thing is covered in the `clone_on_copy` test.

changelog: `copy_on_clone` lint on chained method calls taking self by value
changelog: `copy_on_clone` only lint when using the `Clone` trait
changelog: `copy_on_clone` correct suggestion when the cloned value is a macro call.
2021-03-30 05:25:28 +00:00
Jason Newcomb
d2657769a2
Improve clone_on_copy
Lint on `_.clone().method()` when method takes self by value
Set applicability correctly
Correct suggestion when the cloned value is a macro call. e.g. `m!(x).clone()`
Don't lint when not using the `Clone` trait
2021-03-29 16:10:37 -04:00
Yoshitomo Nakanishi
31afdfc12b missing_panics_doc: Ignore usage of debug_assert family 2021-03-29 17:20:04 +09:00
Yoshitomo Nakanishi
1f95940c24 Fix inconsistent test name 2021-03-29 16:25:30 +09:00
bors
c07103b4a2 Auto merge of #6993 - Jarcho:expl_impl_clone, r=llogiq
Improve `expl_impl_clone_on_copy`

fixes: #1254

changelog: Check to see if the generic constraints are the same as if using derive for `expl_impl_clone_on_copy`
2021-03-28 23:30:56 +00:00
Jason Newcomb
879fa5c972
Improve expl_impl_clone_on_copy
Check to see if the generic constraints are the same as if using derive
2021-03-28 07:54:00 -04:00
ThibsG
6985d13a97 Take into account sub modules 2021-03-28 09:37:59 +02:00
ThibsG
1768efa333 Fix FP in single_component_path_imports lint 2021-03-28 09:37:05 +02:00
Matthias Krüger
e006c77d61 redundant_pattern_matching: look inside Refs
look inside refs and detect if let &None = ...

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

changelog:  redundant_pattern_matching: look inside Refs to fix FNs with "if let &None = .. "
2021-03-28 00:04:44 +01:00
bors
dcee00d64b Auto merge of #6980 - Jarcho:len_without_is_empty_sig, r=llogiq
`len_without_is_empty` improvements

fixes: #6958
fixes: #6972

changelog: Check the return type of `len`. Only integral types, or an `Option` or `Result` wrapping one.
changelog: Ensure the return type of `is_empty` matches. e.g. `Option<usize>` -> `Option<bool>`
2021-03-27 13:10:43 +00:00
Jason Newcomb
12985afbca
len_without_is_empty improvements
Check the return type of `len`. Only integral types, or an `Option` or `Result` wrapping one.
Ensure the return type of `is_empty` matches. e.g. `Option<usize>` -> `Option<bool>`
2021-03-27 09:04:44 -04:00
Ömer Sinan Ağacan
ce4e668e39 format macro argument parsing fix
When the character next to `{}` is "shifted" (when mapping a byte index
in the format string to span) we should avoid shifting the span end
index, so first map the index of `}` to span, then bump the span,
instead of first mapping the next byte index to a span (which causes
bumping the end span too much).

Regression test added.

Fixes #83344
2021-03-27 13:06:36 +03:00
Matthias Krüger
ca7e95501c upper_case_acronyms: add ui and ui-toml tests for private/public enums 2021-03-27 01:08:14 +01:00
bors
6f2a6fe84f Auto merge of #6977 - flip1995:or_patterns_msrv, r=llogiq
Add MSRV options to `unnested_or_patterns`

changelog: [`unnested_or_patterns`] can now be configured with the `msrv` config/attribute.

Fixes #6953
2021-03-26 15:12:50 +00:00
flip1995
1a1adad81d
Add MSRV option to unnested_or_patterns lint 2021-03-26 14:36:09 +01:00
Yoshitomo Nakanishi
bd1201a263 Fix inconsistent test names 2021-03-26 20:19:34 +09:00
Yoshitomo Nakanishi
494bc8a30c Fix FN that types lints don't work with const or static 2021-03-26 20:19:34 +09:00
Jason Newcomb
0ff68bb151
Improve redundant_slicing
Fix bad suggestion when a reborrow might be required
Fix bad suggestion when the value being sliced is a macro call
Don't lint inside of a macro due to the previous context sensitive changes
2021-03-25 22:30:14 -04:00
flip1995
9f6b5de7de Merge commit '0e87918536b9833bbc6c683d1f9d51ee2bf03ef1' into clippyup 2021-03-25 19:29:11 +01:00
flip1995
1f5f184105
Merge remote-tracking branch 'upstream/master' into rustup 2021-03-25 18:38:13 +01:00
bors
981ffa7c14 Auto merge of #6959 - ebobrow:iss-6927-fix, r=camsteffen
Check for `.to_string().into_bytes()` in string_lit_to_bytes

fixes #6927

changelog: Add a check for `into_bytes()` to string_lit_to_bytes lint
2021-03-25 03:01:35 +00:00
Elliot Bobrow
e9ebc27525 check for .to_string().into_bytes() in string_lit_to_bytes
apply changes from review
2021-03-24 17:31:20 -07:00
Jason Newcomb
99b8a67198
Fix false positive with new_ret_no_self when returning Self with different generic arguments 2021-03-24 16:22:28 -04:00
Takayuki Maeda
3b8e85a5dc fix false positive in manual_flatten 2021-03-25 00:15:21 +09:00
Jamie Quigley
45e775697e
Ignore str::len() in or_fun_call lint. 2021-03-22 19:34:20 +00:00
bors
aca95aac7b Auto merge of #6942 - mgacek8:issue_6815_search_is_none, r=llogiq
search_is_some: add checking for `is_none()`

fixes: #6815
changelog: search_is_some: add checking for `is_none()`.

To be honest I don't know what is the process of renaming the lints. Appreciate any feedback if that needs to be handled differently. Thanks!
2021-03-22 12:58:47 +00:00