Commit graph

6340 commits

Author SHA1 Message Date
dswij
8fbf75e0f9 mut_range_bound to check for immediate break from loop 2021-09-08 10:41:37 +08:00
bors
b7c25e1679 Auto merge of #7642 - mikerite:fix-7641, r=flip1995
Add `TAU` to `approx_constant`

changelog: [`approx_constant`]: Add `TAU`
2021-09-07 08:16:36 +00:00
Michael Wright
a7a5a5d9b0 Add TAU to approx_constant 2021-09-07 05:50:04 +02:00
bors
17294b8161 Auto merge of #7634 - chansuke:update-eval-order-depends-docs, r=Manishearth
Fix documentation of eval_order_dependence

Fixes #7624.

changelog: fix documentation of eval_order_dependence
2021-09-06 07:51:55 +00:00
bors
7a0d7d8283 Auto merge of #7596 - lengyijun:option_needless_deref, r=llogiq
New lint: option_needless_deref

changelog: [`option_needless_deref`]
fix #7571
2021-09-05 18:11:56 +00:00
bors
051286d7ec Auto merge of #7638 - xFrednet:7569-avoid-indexing-in-clippy, r=Manishearth
Avoid slice indexing in Clippy (down with the ICEs)

While working on #7569 I got about 23 lint reports where we can avoid slice indexing by destructing the slice early. This is a preparation PR to avoid fixing them in the lint PR. (The implementation already takes about 300 lines without tests 😅). Either way, this should hopefully be easy to review 🙃

---

changelog: none
2021-09-05 17:01:50 +00:00
bors
e5ae3f5491 Auto merge of #7629 - mikerite:fix-7623-2, r=xFrednet
Make `approx_const` MSRV aware

changelog: [`approx_const`]: Add MRSV checks for LOG10_2 and LOG2_10.

Fixes #7623
2021-09-05 13:17:02 +00:00
xFrednet
62b46125cb Avoid slice indexing in Clippy (down with the ICEs) 2021-09-05 14:50:13 +02:00
Michael Wright
19d8a3e53c Improve approx_constant output 2021-09-05 08:47:45 +02:00
Michael Wright
4ee9ec960e Add MSRV to approx_constant documentation 2021-09-05 08:44:37 +02:00
lyj
37af742bbb
Update clippy_lints/src/needless_option_as_deref.rs
Co-authored-by: llogiq <bogusandre@gmail.com>
2021-09-05 08:33:04 +08:00
bors
a8c269ad50 Auto merge of #7570 - HKalbasi:derivable-impls, r=camsteffen
Add the `derivable_impls` lint

Fix #7550

changelog: Add new derivable_impls lint. mem_replace_with_default now covers non constructor cases.
2021-09-04 21:40:04 +00:00
hamidreza kalbasi
8221f9e795 add derivable impls lint 2021-09-05 01:25:59 +04:30
lengyijun
4184cc369a needless_option_as_deref 2021-09-04 22:18:23 +08:00
chansuke
b2f01ef6f6 Fix documentation of eval_order_dependence 2021-09-04 21:07:25 +09:00
Michael Wright
a23af89447 Make approx_const MSRV aware
Fixes #7623.
2021-09-03 08:34:34 +02:00
Michael Wright
265b8ec622 Reorder approx_consts constant to match rust docs 2021-09-03 06:41:30 +02:00
Jake Goulding
b4775435e8 Adjust the output of unnecessary_unwrap and provide a suggestion 2021-09-02 20:52:16 -04:00
Jake Goulding
03d3131cb4 Extend unnecessary_unwrap to look for expect in addition to unwrap
Closes #7581
2021-09-02 20:44:39 -04:00
flip1995
01b17af108
Fix fallout from re-applying patches 2021-09-02 13:04:47 +01:00
xFrednet
8bf2940abb
Fix matadata collection configuration formatting 2021-09-02 12:42:00 +01:00
Cameron Steffen
c2bb313e7a
Add higher docs and remove some unneeded fields 2021-09-02 12:41:30 +01:00
Cameron Steffen
588367b62e
Fix dogfood 2021-09-02 12:39:54 +01:00
Cameron Steffen
5722a7dacd
Fix manual_match with let-expressions 2021-09-02 12:38:59 +01:00
flip1995
61bb96738c
Merge remote-tracking branch 'upstream/master' into rustup2 2021-09-02 12:38:17 +01:00
xordi
83f1454ade Fix function and variable names 2021-08-31 09:06:14 +02:00
xordi
aee4f1fc0c Fix CI errors 2021-08-31 08:56:53 +02:00
xordi
f75d1b2bc5 Check for Not trait implementation 2021-08-31 08:56:53 +02:00
Cameron Steffen
78bf4acc3a Fix clippy for let-else 2021-08-30 20:18:41 -05:00
bors
fd30241281 Auto merge of #7573 - Jarcho:option_if_let_else, r=giraffate
Fix `option_if_let_else`

fixes: #5822
fixes: #6737
fixes: #7567

The inference from #6137 still exists so I'm not sure if this should be moved from the nursery. Before doing that though I'd almost want to see this split into two lints. One suggesting `map_or` and the other suggesting `map_or_else`.

`map_or_else` tends to have longer expressions for both branches so it doesn't end up much shorter than a match expression in practice. It also seems most people find it harder to read. `map_or` at least has the terseness benefit of being on one line most of the time, especially when the `None` branch is just a literal or path expression.

changelog: `break` and `continue` statments local to the would-be closure are allowed in `option_if_let_else`
changelog: don't lint in const contexts  in `option_if_let_else`
changelog: don't lint when yield expressions are used  in `option_if_let_else`
changelog: don't lint when the captures made by the would-be closure conflict with the other branch  in `option_if_let_else`
changelog: don't lint when a field of a local is used when the type could be pontentially moved from  in `option_if_let_else`
changelog: in some cases, don't lint when scrutinee expression conflicts with the captures of the would-be closure  in `option_if_let_else`
2021-08-30 13:57:21 +00:00
inquisitivecrystal
c8262ade90 Teach tools that macros are now HIR items 2021-08-28 00:24:39 -07:00
inquisitivecrystal
8c4056fd4a Treat macros as HIR items 2021-08-28 00:16:34 -07:00
Jason Newcomb
3e5dcba2ee
Small cleanup of option_if_let_else and additional tests. 2021-08-26 11:44:36 -04:00
flip1995
c6e420266a
Set applicability of needless_collect to MaybeIncorrect 2021-08-26 10:01:11 +01:00
lcnr
afd892a549 update TypeFlags to deal with missing ct substs 2021-08-26 11:00:30 +02:00
lcnr
b1786f62ed add tcx to fn walk 2021-08-26 11:00:30 +02:00
lcnr
19d1fe21c7 make unevaluated const substs optional 2021-08-26 11:00:30 +02:00
lcnr
4d627fc41b require a tcx for TypeVisitor 2021-08-26 10:54:01 +02:00
bors
de80188c64 Auto merge of #7543 - DevinR528:disallowed-mod, r=Manishearth
Add module_style lint to style

changelog: Add new [`module_style`] style lint

This is a configurable (no mod file/mod file) lint that determines if `mod.rs` is used consistently or if `mod.rs` is never used (using the new mod layout).
2021-08-25 15:20:28 +00:00
bors
305177342f Auto merge of #7453 - F3real:assume_function_calls_have_side_effect, r=flip1995
Don't report function calls as unnecessary operation if used in array index

Attempts to fix: #7412

changelog: Don't report function calls used in indexing as unnecessary operation. [`unnecessary_operation`]
2021-08-25 08:31:20 +00:00
Devin Ragotzy
31738b1da3 Add module_style lint to restriction
Add tests for disallowed_mod in ui-cargo test section

Use correct algorithm to determine if mod.rs is missing

Move to two lints and remove config option

Switch lint names so they read "warn on ..."

Emit the same help info for self_named_mod_file warnings

Bail when both lints are Allow

Reword help message for both module_style lints
2021-08-24 15:53:58 -04:00
bors
87c6f32756 Auto merge of #7592 - lengyijun:redundant_allocation, r=camsteffen
redundant_allocation: fix 7487

Fixes #7487

changelog: [`redundant_allocation`] - allow `Box<Box<dyn T>>` which replaces wide pointers with thin pointers
2021-08-24 12:32:01 +00:00
lengyijun
641be558fc redundant_allocation: fix 7487 2021-08-24 13:03:48 +08:00
Mara Bos
4c847c0dbd Rollup merge of #88230 - steffahn:a_an, r=oli-obk
Fix typos “a”→“an”

Fix typos in comments; found using a regex to find some easy instance of incorrect usage of a vs. an.

While automation was used to find these, every change was checked manually.

Changes in submodules get separate PRs:
* https://github.com/rust-lang/stdarch/pull/1201
* https://github.com/rust-lang/cargo/pull/9821
* https://github.com/rust-lang/miri/pull/1874
* https://github.com/rust-lang/rls/pull/1746
* https://github.com/rust-analyzer/rust-analyzer/pull/9984
  _folks @ rust-analyzer are fast at merging…_
  * https://github.com/rust-analyzer/rust-analyzer/pull/9985
  * https://github.com/rust-analyzer/rust-analyzer/pull/9987
  * https://github.com/rust-analyzer/rust-analyzer/pull/9989

_For `clippy`, I don’t know if the changes should better better be moved to a PR to the original repo._

<hr>

This has some overlap with #88226, but neither is a strict superset of the other.

If you want multiple commits, I can split it up; in that case, make sure to suggest a criterion for splitting.
2021-08-23 20:45:49 +02:00
Cameron Steffen
2f73776525 Move branches_sharing_code to nursery 2021-08-23 13:40:04 -05:00
bors
22606e7358 Auto merge of #7539 - Labelray:master, r=camsteffen
Add new lint `negative_feature_names` and `redundant_feature_names`

Add new lint [`negative_feature_names`] to detect feature names with prefixes `no-` or `not-` and new lint [`redundant_feature_names`] to detect feature names with prefixes `use-`, `with-` or suffix `-support`
changelog: Add new lint [`negative_feature_names`] and [`redundant_feature_names`]
2021-08-23 13:56:18 +00:00
Labelray
0a021d5900 Add new lints negative_feature_names and redundant_feature_names 2021-08-23 21:05:44 +08:00
Guillaume Gomez
5868e28537 Rollup merge of #88211 - petrochenkov:withhilo, r=jyn514
cleanup: `Span::new` -> `Span::with_lo`

Extracted from https://github.com/rust-lang/rust/pull/84373 as suggested in https://github.com/rust-lang/rust/pull/84373#issuecomment-857773867.
It turned out less useful then I expected, but anyway.
r? `@cjgillot`
`@bors` rollup
2021-08-22 20:52:54 +02:00
Frank Steffahn
8b6529e048 Fix typos “an”→“a” and a few different ones that appeared in the same search 2021-08-22 18:15:49 +02:00
Frank Steffahn
21da42ce29 Fix more “a”/“an” typos 2021-08-22 17:27:18 +02:00