Commit Graph

227 Commits

Author SHA1 Message Date
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
Igor Aleksanov
28d3873ef5 Do not spawn blacklisted_name lint in test context
Fix detecting of the 'test' attribute

Update UI test to actually check that warning is not triggered in the test code

Fix approach for detecting the test module

Add nested test case

Remove code duplication by extracting 'is_test_module_or_function' into 'clippy_utils'

Cleanup the code
2021-06-25 12:36:22 +03:00
Alexander Melentyev
dab42cff02 Delete spaces 2021-06-21 12:11:37 +03:00
flip1995
8302eefacd
Bump Clippy version -> 0.1.55 2021-06-17 10:23:08 +02:00
flip1995
e3eede7b90
Merge remote-tracking branch 'upstream/master' into rustup 2021-06-17 10:21:47 +02:00
Ryan Levick
611b74e1fe Add support for using qualified paths with structs in expression and pattern
position.
2021-06-10 13:18:41 +02:00
Cameron Steffen
b792bb301c Factor out match_var 2021-06-09 09:47:42 -05: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
967d815a42 Extracting is_expr_identity_function into clippy_utils for reusability 2021-06-07 22:42:11 +02:00