Commit graph

6195 commits

Author SHA1 Message Date
Cameron Steffen
afe5962d38 clippy::author improvements 2021-07-23 17:03:12 -05:00
bors
610381455c Auto merge of #7221 - th1000s:keyword_, r=giraffate
similar_names: No longer suggest inserting or appending an underscore

changelog: [`similar_names`] lint no longer suggests to insert or add an underscore to "fix" too similar names
2021-07-19 14:18:59 +00:00
flip1995
26321b35c8
Merge remote-tracking branch 'upstream/master' into rustup 2021-07-19 11:48:49 +02:00
bors
f467750680 Auto merge of #7470 - DevinR528:fix-ice7447, r=flip1995
Add check if ty has_escaping_bound_vars in zero_sized_map_values lint

Fixes: #7447

changelog: fix ICE in [`zero_sized_map_values`]
2021-07-19 09:22:34 +00:00
bors
f70a07454b Auto merge of #7403 - Anthuang:redundant-method-names, r=Manishearth
New lint: [`self_named_constructor`]

Adds the `self_named_constructor` lint for detecting when an implemented method has the same name as the type it is implemented for.

changelog: [`self_named_constructor`]

closes: #7142
2021-07-19 06:49:51 +00:00
Cameron Steffen
98c500cf83 Factor BinOp utils 2021-07-17 20:49:19 -05:00
Cameron Steffen
efbf7ca61e Use From to convert BinOpKind 2021-07-17 20:25:26 -05:00
bors
1b0e57800c Auto merge of #87140 - camsteffen:pat-slice-refs, r=oli-obk
Remove refs from Pat slices

Changes `PatKind::Or(&'hir [&'hir Pat<'hir>])` to `PatKind::Or(&'hir [Pat<'hir>])` and others. This is more consistent with `ExprKind`, saves a little memory, and is a little easier to use.
2021-07-16 13:35:48 +00:00
Guillaume Gomez
5c54d04ef6 Rollup merge of #87069 - sexxi-goose:copy_ref_always, r=nikomatsakis
ExprUseVisitor: Treat ByValue use of Copy types as ImmBorrow

r? ```@nikomatsakis```
2021-07-16 10:08:05 +02:00
Devin Ragotzy
7312611207 Add check if ty has_escaping_bound_vars in zero_sized_map_values lint 2021-07-15 18:37:02 -04:00
Cameron Steffen
81904a413e Remove refs from pat slices 2021-07-15 16:09:57 -05:00
flip1995
1d084b13a5 Merge commit '54a20a02ecd0e1352a871aa0990bcc8b8b03173e' into clippyup 2021-07-15 10:44:10 +02:00
flip1995
69fbd64e2a
Merge remote-tracking branch 'upstream/master' into rustup 2021-07-15 10:32:06 +02:00
lyj
e575610fb3 redundant_allocation: add Arc; some refractoring. 2021-07-15 07:10:55 +08:00
bors
2b193e247f Auto merge of #7462 - xFrednet:7369-branches-sharing-code-else-expr-fp, r=camsteffen
FP fix and documentation for `branches_sharing_code` lint

Closes rust-lang/rust-clippy#7369

Related rust-lang/rust-clippy#7452 I'm still thinking about the best way to fix this. I could simply add another visitor to ensure that the moved expressions don't modify values being used in the condition, but I'm not totally happy with this due to the complexity. I therefore only documented it for now

changelog: [`branches_sharing_code`] fixed false positive where block expressions would sometimes be ignored.
2021-07-14 20:29:56 +00:00
xFrednet
61e280863f Fixed branches_sharing_code FP with block expressions in else
And added `branches_sharing_code` PF note to lint doc for `rust-clippy#7452`
2021-07-14 21:37:17 +02:00
bors
4acbff9eb0 Auto merge of #7437 - ebobrow:redundant-closure-move, r=flip1995
suggest `&mut` for redundant FnMut closures

fixes #6903

changelog: suggest `&mut` for redundant FnMut closures
2021-07-14 15:15:28 +00:00
Elliot Bobrow
4c398e07e0 suggest &mut for redundant FnMut closures 2021-07-14 07:56:27 -07:00
Aman Arora
a9e9b7f9b2 ExprUseVisitor::Delegate consume only when moving 2021-07-14 02:21:08 -04:00
lyj
10910020ec rename possible_borrowed to possible_origin; pass dogfood 2021-07-14 13:46:33 +08:00
lyj
251c3b64da fix 5707 2021-07-14 10:57:47 +08:00
Thomas Otto
e8f57c3ac4 No longer suggest inserting or appending an underscore
changelog: [`similar_names`] lint no longer suggests to insert or add an underscore
to "fix" too similar names
2021-07-13 23:21:24 +02:00
bors
2fd8dbc8af Auto merge of #86827 - camsteffen:hash-lint-resolved, r=oli-obk
Fix internal `default_hash_types` lint to use resolved path

I run into false positives now and then (mostly in Clippy) when I want to name some util after HashMap.
2021-07-13 15:06:10 +00:00
bors
8131445e53 Auto merge of #7446 - Y-Nak:fix-7445, r=xFrednet,flip1995
`default_numeric_fallback`: Fix FP with floating literal

Fix #7445

changelog: `default_numeric_fallback`: Fix FP with floating literal
2021-07-13 14:31:02 +00:00
Yoshitomo Nakanishi
25e4c7d73f default_numeric_fallback: Add rustfix tests 2021-07-13 23:18:31 +09:00
Cameron Steffen
306f9e843d Split a lint message into help 2021-07-13 08:57:16 -05:00
Cameron Steffen
73ffae6ea1 Reduce redundant code 2021-07-13 08:57:16 -05:00
Cameron Steffen
e6ab222b81 Refactor format macro parsing 2021-07-13 08:57:16 -05:00
Cameron Steffen
20dbb277cf Fix useless_format false positive 2021-07-13 08:57:16 -05:00
Cameron Steffen
3fc8dae46c Allow needless_bool in macro 2021-07-13 08:57:16 -05:00
flip1995
f05949f9ce
Add fixed example to unused_unit documentation 2021-07-13 10:54:29 +02:00
Vadim Petrochenkov
075a28996c rustc_span: Revert addition of proc_macro field to ExpnKind::Macro
The flag has a vague meaning and is used for a single diagnostic change that is low benefit and appears only under `-Z macro_backtrace`.
2021-07-10 23:03:35 +03:00
Cameron Steffen
dce274024e clippy: allow default_hash_types on bootstrap 2021-07-09 09:10:45 -05:00
flip1995
d2c8f50bbe
Rename is_allowed -> is_lint_allowed 2021-07-09 15:06:12 +02:00
flip1995
5add651223
Remove lints_enabled function
This function was redundant with the is_allowed function. Now is_allowed
is used everywhere lints_enabled was used before.
2021-07-09 15:00:24 +02:00
Guillaume Gomez
3fc34455f4 Rework SESSION_GLOBALS API to prevent overwriting it 2021-07-08 16:16:28 +02:00
flip1995
795868dd88
Rename run_lints -> lints_enabled 2021-07-08 15:45:19 +02:00
Yoshitomo Nakanishi
3bc5abef62 default_numeric_fallback: Fix FP with floating literal 2021-07-08 11:37:12 +09:00
Ryan Levick
30c5c2ff03 Add s to non_fmt_panic 2021-07-06 20:12:56 +02:00
iobtl
eeefbb7617 fix false positive (panic message) with assert macro using message parameter 2021-07-06 15:14:53 +08:00
Anthony Huang
357a8f0344 Add redundant_method_names lint 2021-07-05 14:15:20 -04:00
Mateusz Gacek
59a164e86c Add new lint: strlen_on_c_strings 2021-07-05 11:10:45 +02:00
bors
3cc6778512 Auto merge of #7431 - DevinR528:fix-macro-brace, r=llogiq
Fix emitting in nested (proc_)macros for nonstandard_macro_braces lint

fixes #7422

changelog: fixes false positives in [`nonstandard_macro_braces`]
2021-07-04 16:47:11 +00:00
Devin Ragotzy
1d110f8c2e Fix emitting in nested (proc_)macros for nonstandard_macro_braces lint 2021-07-04 07:06:23 -04:00
Cameron Steffen
cb4670deb3 Fix use_self ICE 2021-07-03 12:40:50 -05:00
bors
c195db7fee Auto merge of #7426 - ebobrow:doc-markdown-fp, r=llogiq
fix doc_markdown false positive

fixes #7421

changelog: don't lint unbalanced tick marks in code blocks
2021-07-03 16:53:21 +00:00
Elliot Bobrow
e9a5694597 fix doc_markdown false positive 2021-07-03 09:34:10 -07:00
bors
84209994ad Auto merge of #7316 - lengyijun:rc_mutex, r=llogiq
Add new lint: `rc_mutex`

changelog: Add new lint `rc_mutex`.

It lints on `Rc<Mutex<T>>`.

`Rc<Mutex<T>>` should be corrected to `Rc<RefCell<T>>`
2021-07-03 10:26:03 +00:00
David Tolnay
0f662e5833
Downgrade nonstandard_macro_braces to nursery 2021-07-02 22:16:04 -07:00
lyj
b9cc2feaaa rc_mutex: known problems 2021-07-02 22:10:13 +08:00