Commit Graph

4083 Commits

Author SHA1 Message Date
bors
583d644934 Auto merge of #5694 - wangtheo:issue-5626, r=matthiaskrgr
#5626: lint iterator.map(|x| x)

changelog: adds a new lint for iterator.map(|x| x) (see https://github.com/rust-lang/rust-clippy/issues/5626)

The code also lints for result.map(|x| x) and option.map(|x| x). Also, I'm not sure if I'm checking for type adjustments correctly and I can't think of an example where .map(|x| x) would apply type adjustments.
2020-06-23 15:59:27 +00:00
Teddy_Wang
fb4f9a0ad7 Fix pattern match of ExprKind::MethodCall 2020-06-23 11:40:38 -04:00
bors
c2c07fa9d0 Auto merge of #5740 - lzutao:unused-unused, r=flip1995
Remove unused allowed unused attributes

changelog: none
2020-06-23 14:34:18 +00:00
bors
c420382ac2 Auto merge of #5738 - mikerite:loops-20200623-2, r=matthiaskrgr
Improve end of expression check in for loop lints

changelog: none
2020-06-23 14:05:45 +00:00
Lzu Tao
7374185b36 Remove unused allowed unused attributes 2020-06-23 20:59:35 +07:00
Philipp Krones
e4cbd1df4e
Rollup merge of #5726 - sozysozbot:patch-1, r=flip1995
Fix typo

changelog: extending it's lifetime -> extending its lifetime
2020-06-23 14:39:50 +02:00
Philipp Krones
f562117788
Rollup merge of #5724 - ebroto:5697_const_result_option, r=Manishearth
redundant_pattern_matching: avoid non-`const fn` calls in const contexts

changelog: Avoid suggesting non-`const fn` calls in const contexts in [`redundant_pattern_matching`]

Fixes #5697
2020-06-23 14:39:49 +02:00
Philipp Krones
68c0b24e23
Rollup merge of #5716 - bugadani:patch-1, r=matthiaskrgr
Fix typo in wildcard_imports

changelog: none
2020-06-23 14:39:48 +02:00
Philipp Krones
598a79f309
Rollup merge of #5713 - flip1995:more_lints, r=Manishearth
Use lints in Clippy that are enabled in rustc bootstrap

cc https://github.com/rust-lang/rust/pull/73297#discussion_r439747061

changelog: none
2020-06-23 14:39:47 +02:00
Philipp Krones
0799be7156
Rollup merge of #5712 - ijijn:master, r=flip1995
Remove `bar` from blacklisted names

changelog: Remove `bar` from blacklisted names
fixes #5225
2020-06-23 14:39:45 +02:00
Philipp Krones
24b77ea72f
Rollup merge of #5710 - lcnr:patch-1, r=flip1995
typo

changelog: none
2020-06-23 14:39:44 +02:00
Philipp Krones
9505919be5
Rollup merge of #5709 - ebroto:5389_ice, r=Manishearth
Fix ICE in consts::binop

changelog: Fix ICE in `consts::binop`

Fixes #5389
2020-06-23 14:39:43 +02:00
Philipp Krones
1f39eeb06d
Rollup merge of #5705 - dtolnay:orpat, r=flip1995
Downgrade unnested_or_patterns to pedantic

Even with #5704 fixed, I don't believe it is a safe bet that if someone is using or-patterns anywhere in a codebase then they want to use it as much as possible in the whole codebase. I think it would be reasonable to reevaluate after the feature is stable. I feel that a warn-by-default lint suggesting use of an unstable feature, even if already being used in one place, is questionable.

changelog: Remove unnested_or_patterns from default set of enabled lints
2020-06-23 14:39:42 +02:00
flip1995
b886c06c1a
Fix fallout 2020-06-23 14:05:53 +02:00
flip1995
ed083cc959
Use lints in Clippy that are enabled in rustc bootstrap 2020-06-23 14:05:52 +02:00
bors
4cc2fa933b Auto merge of #5739 - flip1995:rustup, r=flip1995
Rustup

changelog: none

r? @ghost
2020-06-23 12:04:08 +00:00
Michael Wright
52c4864757 Improve end of expression check in for loop lints
The code should to check that the current expression _is_ the end
expression; not that it's equal to it. The equality check seems very
wasteful in terms of performance.
2020-06-23 07:51:51 +02:00
bors
c56c7e2d02 Auto merge of #5695 - esamudera:lint_mem_uninitialized, r=phansch,oli-obk
New lint: suggest `ptr::read` instead of `mem::replace(..., uninitialized())`

resolves: #5575

changelog: improvements to `MEM_REPLACE_WITH_UNINIT`:
- add a new test case in `tests/ui/repl_uninit.rs` to cover the case of replacing with `mem::MaybeUninit::uninit().assume_init()`.
- modify the existing `MEM_REPLACE_WITH_UNINIT` when replacing with `mem::uninitialized` to suggest using `ptr::read` instead.
- lint with `MEM_REPLACE_WITH_UNINIT` when replacing with `mem::MaybeUninit::uninit().assume_init()`
2020-06-23 05:14:21 +00:00
flip1995
51592f8587
Fix sync fallout 2020-06-23 02:23:27 +02:00
flip1995
018440c11e
Merge remote-tracking branch 'upstream/master' into rustup 2020-06-23 02:18:17 +02:00
Ralf Jung
b92602ba69 Make is_freeze and is_copy_modulo_regions take TyCtxtAt 2020-06-21 11:47:19 +02:00
Aman Arora
922ff8e485 Refactor hir::Place
For the following code
```rust
let c = || bar(foo.x, foo.x)
```

We generate two different `hir::Place`s for both `foo.x`.
Handling this adds overhead for analysis we need to do for RFC 2229.

We also want to store type information at each Projection to support
analysis as part of the RFC. This resembles what we have for
`mir::Place`

This commit modifies the Place as follows:
- Rename to `PlaceWithHirId`, where there `hir_id` is that of the
expressioin.
- Move any other information that describes the access out to another
struct now called `Place`.
- Removed `Span`, it can be accessed using the [hir
API](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.span)
- Modify `Projection` to be a strucutre of its own, that currently only
contains the `ProjectionKind`.

Adding type information to projections wil be completed as part of https://github.com/rust-lang/project-rfc-2229/issues/5

Closes https://github.com/rust-lang/project-rfc-2229/issues/3

Co-authored-by: Aman Arora <me@aman-arora.com>
Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
2020-06-18 18:59:38 -04:00
sozysozbot
f3a40f5eb1
Fix typo
extending it's lifetime -> extending its lifetime
2020-06-18 06:50:04 +09:00
Eduardo Broto
a7743e9084 redundant_pattern_matching: avoid non-const fn in const context 2020-06-17 00:32:47 +02:00
Ericko Samudera
8c1ee063bb mem_replace_with_uninit: suggest std::ptr::read 2020-06-17 01:26:37 +07:00
Ralf Jung
93696f45ff Rollup merge of #72938 - lzutao:stabilize_option_zip, r=dtolnay
Stabilize Option::zip

This PR stabilizes the following API:

```rust
impl<T> Option<T> {
    pub fn zip<U>(self, other: Option<U>) -> Option<(T, U)>;
}
```

This API has real world usage as seen in <https://grep.app/search?q=-%3E%20Option%3C%5C%28T%2C%5Cs%3FU%5C%29%3E&regexp=true&filter[lang][0]=Rust>.

The `zip_with` method is left unstably as this API is kinda niche
and it hasn't received much usage in Rust repositories on GitHub.

cc #70086
2020-06-15 12:01:03 +02:00
bors
9217ef2018 Auto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakis
Clean up type alias impl trait implementation

- Removes special case for top-level impl trait
- Removes associated opaque types
- Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types.
- Handle lifetimes in type alias impl trait more uniformly with other parameters

cc #69323
cc #63063
Closes #57188
Closes #62988
Closes #69136
Closes #73061
2020-06-15 04:10:24 +00:00
Dániel Buga
8a6f42a970
Fix typo in wildcard_imports 2020-06-14 11:07:44 +02:00
Iain Brandram-Adams
454ed47acf Update comment in conf.rs 2020-06-14 12:46:56 +12:00
Teddy_Wang
40ee620e51 Added a lint for .map(|x| x) 2020-06-13 10:08:12 -04:00
Iain Brandram-Adams
f663a21c8f Remove bar from blacklisted names 2020-06-14 01:24:36 +12:00
Bastian Kauschke
dee794f450
typo 2020-06-13 12:42:58 +02:00
Lzu Tao
994a839622 Stabilize Option::zip 2020-06-13 01:27:18 +00:00
Eduardo Broto
b21ef2b365 Fix ICE in consts::binop 2020-06-13 00:52:32 +02:00
Dylan DPC
7c15f30701 Rollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnay
Migrate to numeric associated consts

The deprecation PR is #72885

cc #68490
cc rust-lang/rfcs#2700
2020-06-12 12:28:23 +02:00
Matthew Jasper
af9b09235c Remove ImplItemKind::OpaqueTy from clippy 2020-06-11 16:24:01 +01:00
Matthew Jasper
857ea16feb Remove associated opaque types
They're unused now.
2020-06-11 16:24:01 +01:00
David Tolnay
56f25e3e62
Downgrade unnested_or_patterns to pedantic 2020-06-10 19:29:11 -07:00
Aaron Hill
e2e2a0fa83 Clippy fixes 2020-06-10 17:30:12 -04:00
Aaron Hill
6b3ee8f600 Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
Lzu Tao
c9bd35cac3 Migrate to numeric associated consts 2020-06-10 01:35:47 +00:00
Eduardo Broto
2f74283fce Add a comment linking to the issue 2020-06-10 00:14:02 +02:00
Eduardo Broto
a083b84b78 if_same_then_else: don't assume multiplication is always commutative 2020-06-09 23:49:21 +02:00
Devin R
e521a4ed38 Add enough attrs to the test file so the fix compiles with no errors, fmt/clippy 2020-06-09 16:39:31 -04:00
Lzu Tao
8db24840f7 Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
Devin R
288df59b25 Fix suggestion output, add run-rustfix to test file, stop sorting import segments duh 2020-06-08 16:00:33 -04:00
Devin R
8c5a5a92ec cleaned up import suggestion formatter, look into code reuse with wildcard impotrs 2020-06-08 16:00:33 -04:00
Devin R
d4f60b5ff4 wip: of handling nested import paths for multi-macro paths 2020-06-08 16:00:33 -04:00
Devin R
451363dc59 still working on displaying nested imports 2020-06-08 16:00:33 -04:00
Devin R
8bc106b29d fix some of the review, rename, fmt, refactor 2020-06-08 16:00:33 -04:00