Commit Graph

236 Commits

Author SHA1 Message Date
flip1995
d02016d686
Merge remote-tracking branch 'upstream/master' into rustup 2021-08-12 10:58:44 +02:00
bors
e62a6cad1e Auto merge of #7516 - lf-:unwrap-or-default, r=xFrednet
Add `unwrap_or_else_default` lint

---

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

changelog: Add a new [`unwrap_or_else_default`] style lint. This will catch `unwrap_or_else(Default::default)` on Result and Option and suggest `unwrap_or_default()` instead.
2021-08-12 08:02:44 +00:00
Jade
295df88986 Reword is_trait_item description 2021-08-11 18:28:42 -07:00
Jade
23d398b184 tree-wide: Fix all the rustdoc warnings 2021-08-10 14:40:26 -07:00
Jade
c78cc7ac1f Add is_trait_item, refactor or_fun_call and unwrap_or_else_default 2021-08-10 14:40:26 -07:00
Jade
11ef04728c Add unwrap_or_else_default lint
This will catch `unwrap_or_else(Default::default)` on Result and Option
and suggest `unwrap_or_default()` instead.
2021-08-10 14:40:26 -07:00
hamidreza kalbasi
6d36d1a835 merge XOR_SWAP with MANUAL_SWAP 2021-08-09 02:15:10 +04:30
Jade
6c2199ea9f rfc3052: Remove authors field from Cargo manifests
Since RFC 3052 soft deprecated the authors field anyway, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information, we should remove it from
crates in this repo.
2021-07-29 14:56:05 -07:00
flip1995
2b20f49841 Merge commit '0cce3f643bfcbb92d5a1bb71858c9cbaff749d6b' into clippyup 2021-07-29 12:16:06 +02:00
flip1995
80116f9009
Bump Clippy Version -> 0.1.56 2021-07-29 11:15:11 +02:00
flip1995
490beda6be
Merge remote-tracking branch 'upstream/master' into rustup 2021-07-29 11:14:25 +02:00
Devin Ragotzy
a1bab3bc63 Add primitive type support to disallowed_type lint
Fix docs of disallowed_type

Add ability to name primitive types without import path

Move primitive resolution to clippy_utils path_to_res fn

Refactor Res matching, fix naming and docs from review

Use tcx.def_path_str when emitting the lint
2021-07-27 10:01:38 -04:00
bors
ceb7a868d3 Auto merge of #7466 - xFrednet:5393-use-more-diagnostic-items, r=flip1995
Use diagnostic items where possible

Clippy still uses a bunch of paths in places that could easily use already defined diagnostic items. This PR updates all references to such paths and also removes a bunch of them that are no longer needed after this cleanup.

Some paths are also used to construct new paths and can therefore not be removed that easily. I've added a doc comment to those instances that recommends the use of the diagnostic item where possible.

And that's it, cleaning crew signing off 🧹 🗑️

---

changelog: none

(only internal improvements)

cc: #5393
2021-07-27 08:19:23 +00:00
kadmin
74379d4d85 Actually infer args in visitors 2021-07-26 21:15:18 +00:00
kadmin
8286824ab2 Add inferred args to typeck 2021-07-25 07:28:51 +00:00
kadmin
00faed9f0c Add generic arg infer 2021-07-25 07:28:51 +00:00
flip1995
884ef4c287 Merge commit '4c41a222ca5d1325fb4b6709395bd06e766cc042' into clippyup 2021-07-19 11:52:05 +02:00
flip1995
26321b35c8
Merge remote-tracking branch 'upstream/master' into rustup 2021-07-19 11:48:49 +02:00
bors
46363df926 Auto merge of #7474 - camsteffen:binop, r=Manishearth
Use lang items for BinOp lints

changelog: none
2021-07-18 15:52:49 +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
Jason Newcomb
5bfc2568a2
Fix ICE in is_integer_const when the expression is inside an AnonConst body 2021-07-17 19:01:19 -04: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
flip1995
b98e2ec527
Fix ICE in redundant_pattern_matching 2021-07-16 10:45:28 +02: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
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
xFrednet
ecf85f4bdc Use diagnostic items for Vec, VecDeque and connected refactorings 2021-07-15 00:02:46 +02:00
xFrednet
6ce6b29527 Use diagnostic items for intrinsics::transmute, TryInto 2021-07-14 23:34:19 +02:00
xFrednet
6030428fd2 Use diagnostic items for Into, IntoIterator, LinkedList, ptr::null, prt::null_mut 2021-07-14 22:50:59 +02:00
xFrednet
2ac21889bc Use diagnostic items for BinaryHeap, BTreeMap, BTreeSet, HashMap, HashSet, Borrow, Default 2021-07-14 22:02:59 +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
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
Cameron Steffen
e6ab222b81 Refactor format macro parsing 2021-07-13 08:57:16 -05:00
Yoshitomo Nakanishi
4e8cd4d346 Fix NumericLiteral::format that may produce a invalid literal 2021-07-13 22:57:02 +09: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
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
flip1995
795868dd88
Rename run_lints -> lints_enabled 2021-07-08 15:45:19 +02:00
Aman Arora
f0f3b3acf8 Make type_implements_trait not a query 2021-07-06 14:38:10 -04:00
Mateusz Gacek
59a164e86c Add new lint: strlen_on_c_strings 2021-07-05 11:10:45 +02:00
Niko Matsakis
26e57f05cc revert broken formatting 2021-07-04 12:50:41 -04:00
Niko Matsakis
89f6c4cfe2 allow inference vars in type_implements_trait 2021-07-04 11:28:20 -04:00
bors
7cd0643eb2 Auto merge of #86782 - flip1995:clippyup, r=Manishearth
Update Clippy

Biweekly Clippy Update

r? `@Manishearth`
2021-07-02 02:56:45 +00:00
flip1995
ebe52869a3 Merge commit '61eb38aeda6cb54b93b872bf503d70084c4d621c' into clippyup 2021-07-01 18:17:38 +02:00
bjorn3
59cf7e3882 Rename all_crate_nums query to crates and remove useless wrapper 2021-07-01 16:51:11 +02:00
Mara Bos
38569c03eb Don't suggest unstable and doc(hidden) variants. 2021-06-26 15:28:38 +02:00