Commit graph

8821 commits

Author SHA1 Message Date
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
bors
9504efc94e Auto merge of #5735 - lzutao:issue-temp, r=flip1995
Add more specific GitHub issue templates

changelog: Make it easier to create feature request and bug reports with issue templates.
2020-06-23 13:40:02 +00:00
bors
b452ad3c0b Auto merge of #5741 - flip1995:rollup-8chbwhy, r=flip1995
Rollup of 9 pull requests

Successful merges:

 - #5178 (clippy-driver: pass all args to rustc if --rustc is present)
 - #5705 (Downgrade unnested_or_patterns to pedantic)
 - #5709 (Fix ICE in consts::binop)
 - #5710 (typo)
 - #5712 (Remove `bar` from blacklisted names)
 - #5713 (Use lints in Clippy that are enabled in rustc bootstrap)
 - #5716 (Fix typo in wildcard_imports)
 - #5724 (redundant_pattern_matching: avoid non-`const fn` calls in const contexts)
 - #5726 (Fix typo)

Failed merges:

r? @ghost

changelog: rollup
2020-06-23 12:52:46 +00: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
Philipp Krones
7c61be615a
Rollup merge of #5178 - matthiaskrgr:rustc_arg_pass, r=flip1995
clippy-driver: pass all args to rustc if --rustc is present

changelog: clippy-driver: pass all args to rustc if --rustc is present
2020-06-23 14:39:40 +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
Lzu Tao
51c3b42ef3 Add more specific GitHub issue templates
Apply suggestions from code review

Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-06-23 14:34:32 +07: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
Dylan DPC
1d077f6109 Rollup merge of #73578 - RalfJung:ty-ctxt-at, r=jonas-schievink
Make is_freeze and is_copy_modulo_regions take TyCtxtAt

Make is_freeze and is_copy_modulo_regions take TyCtxtAt instead of separately taking TyCtxt and Span. This is consistent with is_sized.
2020-06-23 03:16:22 +02:00
bors
fa0f6a8dbf Auto merge of #5711 - flip1995:rustup, r=flip1995
Rustup

changelog: none
2020-06-23 00:27:02 +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
Aaron Hill
e11b873c70 Stop using old version of syn in rustc-workspace-hack
None of the tools seem to need syn 0.15.35, so we can just build syn
1.0.

This was causing an issue with clippy's `compile-test` program: since
multiple versions of `syn` would exist in the build directory, we would
non-deterministically pick one based on filesystem iteration order. If
the pre-1.0 version of `syn` was picked, a strange build error would
occur (see
https://github.com/rust-lang/rust/pull/73594#issuecomment-647671463)

To prevent this kind of issue from happening again, we now panic if we
find multiple versions of a crate in the build directly, instead of
silently picking the first version we find.
2020-06-22 13:29:39 -04: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
Iain Brandram-Adams
c020e45cd3 Update stderr to match, and reinforce comments 2020-06-14 12:40:36 +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
Matthias Krüger
7a62380fc8 clippy-driver: fix test and add --rustc to --help output 2020-06-11 12:36:56 +02:00
Matthias Krüger
f1d5cd5d13 add test for compiler output when compiling with rustc/clippy-driver 2020-06-11 12:34:19 +02:00
Matthias Krüger
88ab10400b add test and remove debug print 2020-06-11 12:34:19 +02:00
Matthias Krüger
840786a939 clippy-driver: pass all args after "--rustc" to rustc. 2020-06-11 12:34:19 +02: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