]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #5750 - ebroto:blanket_clippy_restriction_lints, r=Manishearth,flip1995...
bors [Tue, 30 Jun 2020 21:55:46 +0000 (21:55 +0000)]
Auto merge of #5750 - ebroto:blanket_clippy_restriction_lints, r=Manishearth,flip1995,phansch,oli-obk

Lint enabling the whole restriction group

I've added it to the `correctness` category, but I may be missing some valid use cases. In that case it could be changed to `pedantic`.

changelog: Add [`blanket_clippy_restriction_lints`] to check against enabling the whole restriction group.

4 years agoMove blanket_clippy_restriction_lints to "style"
Eduardo Broto [Sat, 27 Jun 2020 19:49:34 +0000 (21:49 +0200)]
Move blanket_clippy_restriction_lints to "style"

4 years agoLint enabling the whole restriction group
Eduardo Broto [Fri, 26 Jun 2020 08:52:14 +0000 (10:52 +0200)]
Lint enabling the whole restriction group

4 years agoAuto merge of #5751 - flip1995:rustup, r=Manishearth,flip1995
bors [Tue, 30 Jun 2020 14:20:09 +0000 (14:20 +0000)]
Auto merge of #5751 - flip1995:rustup, r=Manishearth,flip1995

Rustup

cc https://github.com/rust-lang/rust/pull/73743

r? @Manishearth

changelog: none

4 years agoDisable chrono integration test
flip1995 [Tue, 30 Jun 2020 14:19:42 +0000 (16:19 +0200)]
Disable chrono integration test

4 years agoMerge remote-tracking branch 'upstream/master' into rustup2
flip1995 [Tue, 30 Jun 2020 13:40:22 +0000 (15:40 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup2

4 years agotypeck: adding type information to projection
Azhng [Wed, 24 Jun 2020 20:33:31 +0000 (16:33 -0400)]
typeck: adding type information to projection

This commit modifies the Place as follow:
* remove 'ty' from ProjectionKind
* add type information into to Projection
* replace 'ty' in Place with 'base_ty'
* introduce 'ty()' in `Place` to return the final type of the `Place`
* introduce `ty_before_projection()` in `Place` to return the type of
  a `Place` before i'th projection is applied

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

4 years agoUpdate tests
Dylan MacKenzie [Fri, 26 Jun 2020 00:43:48 +0000 (17:43 -0700)]
Update tests

4 years agoAuto merge of #73756 - Manishearth:rollup-aehswb2, r=Manishearth
bors [Fri, 26 Jun 2020 10:11:43 +0000 (10:11 +0000)]
Auto merge of #73756 - Manishearth:rollup-aehswb2, r=Manishearth

Rollup of 13 pull requests

Successful merges:

 - #72620 (Omit DW_AT_linkage_name when it is the same as DW_AT_name)
 - #72967 (Don't move cursor in search box when using arrows to navigate results)
 - #73102 (proc_macro: Stop flattening groups with dummy spans)
 - #73297 (Support configurable deny-warnings for all in-tree crates.)
 - #73507 (Cleanup MinGW LLVM linkage workaround)
 - #73588 (Fix handling of reserved registers for ARM inline asm)
 - #73597 (Record span of `const` kw in GenericParamKind)
 - #73629 (Make AssocOp Copy)
 - #73681 (Update Chalk to 0.14)
 - #73707 (Fix links in `SliceIndex` documentation)
 - #73719 (emitter: column width defaults to 140)
 - #73729 (disable collectionbenches for android)
 - #73748 (Add code block to code in documentation of `List::rebase_onto`)

Failed merges:

r? @ghost

4 years agoRollup merge of #73597 - ayazhafiz:i/const-span, r=ecstatic-morse
Manish Goregaokar [Fri, 26 Jun 2020 07:39:08 +0000 (00:39 -0700)]
Rollup merge of #73597 - ayazhafiz:i/const-span, r=ecstatic-morse

Record span of `const` kw in GenericParamKind

Context: this is needed for a fix of https://github.com/rust-lang/rustfmt/issues/4263,
which currently records the span of a const generic param incorrectly
because the location of the `const` kw is not known.

I am not sure how to add tests for this; any guidance in how to do so
would be appreciated :slightly_smiling_face:

4 years agorustc_lint: only query `typeck_tables_of` when a lint needs it.
Eduard-Mihai Burtescu [Thu, 25 Jun 2020 23:56:23 +0000 (02:56 +0300)]
rustc_lint: only query `typeck_tables_of` when a lint needs it.

4 years agoAuto merge of #5748 - carols10cents:tiny-docs-fix, r=flip1995
bors [Thu, 25 Jun 2020 15:28:50 +0000 (15:28 +0000)]
Auto merge of #5748 - carols10cents:tiny-docs-fix, r=flip1995

Change a noun to a verb to make the sentence complete

changelog: Fixed some grammar in the documentation for `await_holding_lock`.

Just a tiny little thing I found while using clippy <3

4 years agoChange a noun to a verb to make the sentence complete
Carol (Nichols || Goulding) [Thu, 25 Jun 2020 15:25:21 +0000 (11:25 -0400)]
Change a noun to a verb to make the sentence complete

4 years agoAuto merge of #5701 - ebroto:4874_cmp_owned_fp, r=flip1995
bors [Wed, 24 Jun 2020 12:48:24 +0000 (12:48 +0000)]
Auto merge of #5701 - ebroto:4874_cmp_owned_fp, r=flip1995

cmp_owned: handle when PartialEq is not implemented symmetrically

changelog: Handle asymmetrical implementations of PartialEq in [`cmp_owned`].

Fixes #4874

4 years agoAuto merge of #5745 - montrivo:copy_on_clone, r=phansch
bors [Wed, 24 Jun 2020 07:11:07 +0000 (07:11 +0000)]
Auto merge of #5745 - montrivo:copy_on_clone, r=phansch

clone_on_copy - add machine applicability

Fix #4826.
Change the applicability of the lint clone_on_copy. Split a test file and run rustfix on the clone_on_copy part.

changelog: clone_on_copy - add machine applicability

4 years agocopy_on_clone - add machine applicability
Tim Nielens [Tue, 23 Jun 2020 23:01:23 +0000 (01:01 +0200)]
copy_on_clone - add machine applicability

4 years agocmp_owned: reverse operands if necessary
Eduardo Broto [Fri, 12 Jun 2020 22:03:19 +0000 (00:03 +0200)]
cmp_owned: reverse operands if necessary

4 years agocmp_owned: avoid FP when PartialEq is not implemented symmetrically
Eduardo Broto [Tue, 9 Jun 2020 20:40:43 +0000 (22:40 +0200)]
cmp_owned: avoid FP when PartialEq is not implemented symmetrically

4 years agoRecord span of `const` kw in GenericParamKind
Ayaz Hafiz [Sun, 21 Jun 2020 22:49:56 +0000 (15:49 -0700)]
Record span of `const` kw in GenericParamKind

Context: this is needed to fix https://github.com/rust-lang/rustfmt/issues/4263,
which currently records the span of a const generic param incorrectly
because the location of the `const` kw is not known.

I am not sure how to add tests for this; any guidance in how to do so
would be appreciated :slightly_smiling_face:

4 years agoAuto merge of #5694 - wangtheo:issue-5626, r=matthiaskrgr
bors [Tue, 23 Jun 2020 15:59:27 +0000 (15:59 +0000)]
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.

4 years agoFix pattern match of ExprKind::MethodCall
Teddy_Wang [Tue, 23 Jun 2020 15:40:38 +0000 (11:40 -0400)]
Fix pattern match of ExprKind::MethodCall

4 years agoMerge commit 'c2c07fa9d095931eb5684a42942a7b573a0c5238' into clippyup
flip1995 [Tue, 23 Jun 2020 15:05:22 +0000 (17:05 +0200)]
Merge commit 'c2c07fa9d095931eb5684a42942a7b573a0c5238' into clippyup

4 years agoAuto merge of #5740 - lzutao:unused-unused, r=flip1995
bors [Tue, 23 Jun 2020 14:34:18 +0000 (14:34 +0000)]
Auto merge of #5740 - lzutao:unused-unused, r=flip1995

Remove unused allowed unused attributes

changelog: none

4 years agoAuto merge of #5738 - mikerite:loops-20200623-2, r=matthiaskrgr
bors [Tue, 23 Jun 2020 14:05:45 +0000 (14:05 +0000)]
Auto merge of #5738 - mikerite:loops-20200623-2, r=matthiaskrgr

Improve end of expression check in for loop lints

changelog: none

4 years agoRemove unused allowed unused attributes
Lzu Tao [Tue, 23 Jun 2020 13:59:35 +0000 (20:59 +0700)]
Remove unused allowed unused attributes

4 years agoAuto merge of #5735 - lzutao:issue-temp, r=flip1995
bors [Tue, 23 Jun 2020 13:40:02 +0000 (13:40 +0000)]
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.

4 years agoAuto merge of #5741 - flip1995:rollup-8chbwhy, r=flip1995
bors [Tue, 23 Jun 2020 12:52:46 +0000 (12:52 +0000)]
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

4 years agoRollup merge of #5726 - sozysozbot:patch-1, r=flip1995
Philipp Krones [Tue, 23 Jun 2020 12:39:50 +0000 (14:39 +0200)]
Rollup merge of #5726 - sozysozbot:patch-1, r=flip1995

Fix typo

changelog: extending it's lifetime -> extending its lifetime

4 years agoRollup merge of #5724 - ebroto:5697_const_result_option, r=Manishearth
Philipp Krones [Tue, 23 Jun 2020 12:39:49 +0000 (14:39 +0200)]
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

4 years agoRollup merge of #5716 - bugadani:patch-1, r=matthiaskrgr
Philipp Krones [Tue, 23 Jun 2020 12:39:48 +0000 (14:39 +0200)]
Rollup merge of #5716 - bugadani:patch-1, r=matthiaskrgr

Fix typo in wildcard_imports

changelog: none

4 years agoRollup merge of #5713 - flip1995:more_lints, r=Manishearth
Philipp Krones [Tue, 23 Jun 2020 12:39:47 +0000 (14:39 +0200)]
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

4 years agoRollup merge of #5712 - ijijn:master, r=flip1995
Philipp Krones [Tue, 23 Jun 2020 12:39:45 +0000 (14:39 +0200)]
Rollup merge of #5712 - ijijn:master, r=flip1995

Remove `bar` from blacklisted names

changelog: Remove `bar` from blacklisted names
fixes #5225

4 years agoRollup merge of #5710 - lcnr:patch-1, r=flip1995
Philipp Krones [Tue, 23 Jun 2020 12:39:44 +0000 (14:39 +0200)]
Rollup merge of #5710 - lcnr:patch-1, r=flip1995

typo

changelog: none

4 years agoRollup merge of #5709 - ebroto:5389_ice, r=Manishearth
Philipp Krones [Tue, 23 Jun 2020 12:39:43 +0000 (14:39 +0200)]
Rollup merge of #5709 - ebroto:5389_ice, r=Manishearth

Fix ICE in consts::binop

changelog: Fix ICE in `consts::binop`

Fixes #5389

4 years agoRollup merge of #5705 - dtolnay:orpat, r=flip1995
Philipp Krones [Tue, 23 Jun 2020 12:39:42 +0000 (14:39 +0200)]
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

4 years agoRollup merge of #5178 - matthiaskrgr:rustc_arg_pass, r=flip1995
Philipp Krones [Tue, 23 Jun 2020 12:39:40 +0000 (14:39 +0200)]
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

4 years agoFix fallout
flip1995 [Sat, 13 Jun 2020 16:22:49 +0000 (18:22 +0200)]
Fix fallout

4 years agoUse lints in Clippy that are enabled in rustc bootstrap
flip1995 [Sat, 13 Jun 2020 16:22:38 +0000 (18:22 +0200)]
Use lints in Clippy that are enabled in rustc bootstrap

4 years agoAuto merge of #5739 - flip1995:rustup, r=flip1995
bors [Tue, 23 Jun 2020 12:04:08 +0000 (12:04 +0000)]
Auto merge of #5739 - flip1995:rustup, r=flip1995

Rustup

changelog: none

r? @ghost

4 years agoAdd more specific GitHub issue templates
Lzu Tao [Tue, 23 Jun 2020 07:27:11 +0000 (14:27 +0700)]
Add more specific GitHub issue templates

Apply suggestions from code review

Co-authored-by: Philipp Krones <hello@philkrones.com>
4 years agoImprove end of expression check in for loop lints
Michael Wright [Thu, 11 Jun 2020 18:25:14 +0000 (20:25 +0200)]
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.

4 years agoAuto merge of #5695 - esamudera:lint_mem_uninitialized, r=phansch,oli-obk
bors [Tue, 23 Jun 2020 05:14:21 +0000 (05:14 +0000)]
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()`

4 years agoRollup merge of #73578 - RalfJung:ty-ctxt-at, r=jonas-schievink
Dylan DPC [Tue, 23 Jun 2020 01:16:22 +0000 (03:16 +0200)]
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.

4 years agoAuto merge of #5711 - flip1995:rustup, r=flip1995
bors [Tue, 23 Jun 2020 00:27:02 +0000 (00:27 +0000)]
Auto merge of #5711 - flip1995:rustup, r=flip1995

Rustup

changelog: none

4 years agoFix sync fallout
flip1995 [Tue, 23 Jun 2020 00:18:38 +0000 (02:18 +0200)]
Fix sync fallout

4 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Tue, 23 Jun 2020 00:18:17 +0000 (02:18 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

4 years agoStop using old version of `syn` in `rustc-workspace-hack`
Aaron Hill [Mon, 22 Jun 2020 17:29:04 +0000 (13:29 -0400)]
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.

4 years agoMake is_freeze and is_copy_modulo_regions take TyCtxtAt
Ralf Jung [Sun, 21 Jun 2020 09:20:48 +0000 (11:20 +0200)]
Make is_freeze and is_copy_modulo_regions take TyCtxtAt

4 years agoRefactor hir::Place
Aman Arora [Wed, 17 Jun 2020 22:13:05 +0000 (18:13 -0400)]
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>
4 years agoFix typo
sozysozbot [Wed, 17 Jun 2020 21:50:04 +0000 (06:50 +0900)]
Fix typo

extending it's lifetime -> extending its lifetime

4 years agoredundant_pattern_matching: avoid non-const fn in const context
Eduardo Broto [Tue, 16 Jun 2020 22:32:47 +0000 (00:32 +0200)]
redundant_pattern_matching: avoid non-const fn in const context

4 years agomem_replace_with_uninit: suggest std::ptr::read
Ericko Samudera [Sun, 7 Jun 2020 17:44:14 +0000 (00:44 +0700)]
mem_replace_with_uninit: suggest std::ptr::read

4 years agoRollup merge of #72938 - lzutao:stabilize_option_zip, r=dtolnay
Ralf Jung [Mon, 15 Jun 2020 10:01:03 +0000 (12:01 +0200)]
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

4 years agoAuto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakis
bors [Mon, 15 Jun 2020 04:10:24 +0000 (04:10 +0000)]
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

4 years agoFix typo in wildcard_imports
Dániel Buga [Sun, 14 Jun 2020 09:07:44 +0000 (11:07 +0200)]
Fix typo in wildcard_imports

4 years agoUpdate comment in conf.rs
Iain Brandram-Adams [Sun, 14 Jun 2020 00:46:56 +0000 (12:46 +1200)]
Update comment in conf.rs

4 years agoUpdate stderr to match, and reinforce comments
Iain Brandram-Adams [Sun, 14 Jun 2020 00:40:36 +0000 (12:40 +1200)]
Update stderr to match, and reinforce comments

4 years agoAdded a lint for .map(|x| x)
Teddy_Wang [Mon, 8 Jun 2020 04:35:10 +0000 (00:35 -0400)]
Added a lint for .map(|x| x)

4 years agoRemove `bar` from blacklisted names
Iain Brandram-Adams [Sat, 13 Jun 2020 13:24:36 +0000 (01:24 +1200)]
Remove `bar` from blacklisted names

4 years agotypo
Bastian Kauschke [Sat, 13 Jun 2020 10:42:58 +0000 (12:42 +0200)]
typo

4 years agoStabilize Option::zip
Lzu Tao [Sat, 13 Jun 2020 01:27:14 +0000 (01:27 +0000)]
Stabilize Option::zip

4 years agoFix ICE in consts::binop
Eduardo Broto [Fri, 12 Jun 2020 22:52:32 +0000 (00:52 +0200)]
Fix ICE in consts::binop

4 years agoRollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnay
Dylan DPC [Fri, 12 Jun 2020 10:28:23 +0000 (12:28 +0200)]
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

4 years agoRemove ImplItemKind::OpaqueTy from clippy
Matthew Jasper [Sun, 10 May 2020 14:05:06 +0000 (15:05 +0100)]
Remove ImplItemKind::OpaqueTy from clippy

4 years agoRemove associated opaque types
Matthew Jasper [Sun, 10 May 2020 11:15:51 +0000 (12:15 +0100)]
Remove associated opaque types

They're unused now.

4 years agoclippy-driver: fix test and add --rustc to --help output
Matthias Krüger [Tue, 9 Jun 2020 11:18:00 +0000 (13:18 +0200)]
clippy-driver: fix test and add --rustc to --help output

4 years agoadd test for compiler output when compiling with rustc/clippy-driver
Matthias Krüger [Sun, 7 Jun 2020 14:27:41 +0000 (16:27 +0200)]
add test for compiler output when compiling with rustc/clippy-driver

4 years agoadd test and remove debug print
Matthias Krüger [Tue, 2 Jun 2020 12:50:44 +0000 (14:50 +0200)]
add test and remove debug print

4 years agoclippy-driver: pass all args after "--rustc" to rustc.
Matthias Krüger [Sun, 31 May 2020 22:22:29 +0000 (00:22 +0200)]
clippy-driver: pass all args after "--rustc" to rustc.

4 years agoDowngrade unnested_or_patterns to pedantic
David Tolnay [Thu, 11 Jun 2020 02:29:11 +0000 (19:29 -0700)]
Downgrade unnested_or_patterns to pedantic

4 years agoClippy fixes
Aaron Hill [Wed, 10 Jun 2020 03:45:32 +0000 (23:45 -0400)]
Clippy fixes

4 years agoUpdate Clippy for MethodCall changes
Aaron Hill [Tue, 9 Jun 2020 21:44:04 +0000 (17:44 -0400)]
Update Clippy for MethodCall changes

4 years agoMigrate to numeric associated consts
Lzu Tao [Tue, 2 Jun 2020 07:59:11 +0000 (07:59 +0000)]
Migrate to numeric associated consts

4 years agoAuto merge of #5702 - ebroto:5698_mul_not_comm, r=matthiaskrgr
bors [Tue, 9 Jun 2020 22:19:24 +0000 (22:19 +0000)]
Auto merge of #5702 - ebroto:5698_mul_not_comm, r=matthiaskrgr

if_same_then_else: don't assume multiplication is always commutative

changelog: Don't assume multiplication is always commutative in [`if_same_then_else`]

Fixes #5698

4 years agoAdd a comment linking to the issue
Eduardo Broto [Tue, 9 Jun 2020 22:14:02 +0000 (00:14 +0200)]
Add a comment linking to the issue

4 years agoif_same_then_else: don't assume multiplication is always commutative
Eduardo Broto [Tue, 9 Jun 2020 21:49:21 +0000 (23:49 +0200)]
if_same_then_else: don't assume multiplication is always commutative

4 years agoAuto merge of #5279 - DevinR528:macro-use-sugg, r=flip1995
bors [Tue, 9 Jun 2020 20:49:27 +0000 (20:49 +0000)]
Auto merge of #5279 - DevinR528:macro-use-sugg, r=flip1995

Macro use sugg

changelog: Add auto applicable suggstion to macro_use_imports

fixes #5275

<s>Where exactly is the `wildcard_imports_helper` I haven't been able to import anything ex.
`use lazy_static;` or something like for that I get version/compiler conflicts?</s>
Found it.

Should we also check for `#[macro_use] extern crate`, although this is still depended on for stuff like `rustc_private`?

4 years agoAdd enough attrs to the test file so the fix compiles with no errors, fmt/`clippy`
Devin R [Sun, 7 Jun 2020 20:25:21 +0000 (16:25 -0400)]
Add enough attrs to the test file so the fix compiles with no errors, fmt/`clippy`

4 years agoMerge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy
Lzu Tao [Tue, 9 Jun 2020 14:36:01 +0000 (14:36 +0000)]
Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy

4 years agoFix suggestion output, add run-rustfix to test file, stop sorting import segments duh
Devin R [Sun, 7 Jun 2020 20:12:35 +0000 (16:12 -0400)]
Fix suggestion output, add run-rustfix to test file, stop sorting import segments duh

4 years agocleaned up import suggestion formatter, look into code reuse with wildcard impotrs
Devin R [Tue, 26 May 2020 23:57:36 +0000 (19:57 -0400)]
cleaned up import suggestion formatter, look into code reuse with wildcard impotrs

4 years agowip: of handling nested import paths for multi-macro paths
Devin R [Fri, 15 May 2020 12:36:56 +0000 (08:36 -0400)]
wip: of handling nested import paths for multi-macro paths

4 years agostill working on displaying nested imports
Devin R [Thu, 14 May 2020 22:20:07 +0000 (18:20 -0400)]
still working on displaying nested imports

4 years agofix some of the review, rename, fmt, refactor
Devin R [Sun, 10 May 2020 13:06:33 +0000 (09:06 -0400)]
fix some of the review, rename, fmt, refactor

4 years agoremove session
Devin R [Tue, 24 Mar 2020 02:13:35 +0000 (22:13 -0400)]
remove session

4 years agouse hashset not map for keeping track of seen macro refs
Devin R [Fri, 13 Mar 2020 22:54:32 +0000 (18:54 -0400)]
use hashset not map for keeping track of seen macro refs

remove stdout, fix clippy warnings, fmtcar

4 years agocollected all the imports and names
Devin R [Wed, 4 Mar 2020 12:59:10 +0000 (07:59 -0500)]
collected all the imports and names

how to compare macro to import path

add more imports to test

4 years agowarn on macro_use attr
Devin R [Wed, 26 Feb 2020 12:40:31 +0000 (07:40 -0500)]
warn on macro_use attr

cargo dev update lints

use if_chain

clean up alot, span_lint_and_sugg

find imported macros for sugg

4 years agoAuto merge of #5692 - ebroto:5689_N_dotdot_N, r=yaahc
bors [Mon, 8 Jun 2020 17:15:45 +0000 (17:15 +0000)]
Auto merge of #5692 - ebroto:5689_N_dotdot_N, r=yaahc

reversed_empty_ranges: avoid linting N..N except in for loop arguments

changelog: [`reversed_empty_ranges`]: avoid linting N..N except in for loop arguments

r? @yaahc
Fixes #5689

4 years agoAuto merge of #5680 - ebroto:3792_let_return, r=Manishearth
bors [Mon, 8 Jun 2020 16:47:22 +0000 (16:47 +0000)]
Auto merge of #5680 - ebroto:3792_let_return, r=Manishearth

let_and_return: avoid "does not live long enough" errors

EDIT: Add #3324 to the list of fixes

<details>
<summary>Description of old impl</summary>
<br>
Avoid suggesting turning the RHS expression of the last statement into the block tail expression if a temporary borrows from a local that would be destroyed before.

This is my first incursion into MIR so there's probably room for improvement!
</details>

Avoid linting if the return type of some method or function called in the last statement has a lifetime parameter.

changelog: Fix false positive in [`let_and_return`]

Fixes #3792
Fixes #3324

4 years agoAuto merge of #5378 - Centril:unnested-or-pats, r=flip1995,phansch
bors [Mon, 8 Jun 2020 13:49:29 +0000 (13:49 +0000)]
Auto merge of #5378 - Centril:unnested-or-pats, r=flip1995,phansch

New lint: `unnested_or_patterns`

changelog: Adds a lint `unnested_or_patterns`, suggesting `Some(0 | 2)` as opposed to `Some(0) | Some(2)`. The lint only fires on compilers capable of using `#![feature(or_patterns)]`.

- The lint is primarily encoded as a pure algorithm which to unnest or-patterns in an `ast::Pat` (`fn unnest_or_patterns`) through a `MutVisitor`. After that is done, and assuming that any change was detected, then `pprust::pat_to_string` is used to simply convert the transformed pattern into a suggestion.

- The PR introduces a module `utils::ast_utils` with a bunch of functions for spanless & nodeless equality comparisons of ASTs.

cc https://github.com/rust-lang/rust/issues/54883

4 years agoFix rebase fallout
flip1995 [Sun, 7 Jun 2020 19:33:03 +0000 (21:33 +0200)]
Fix rebase fallout

4 years agoApply self-review by Centril
flip1995 [Sun, 7 Jun 2020 14:43:17 +0000 (16:43 +0200)]
Apply self-review by Centril

4 years agosplit unnested_or_patterns test
Mazdak Farrokhzad [Sat, 28 Mar 2020 12:08:57 +0000 (13:08 +0100)]
split unnested_or_patterns test

4 years agodogfood unnested_or_patterns
Mazdak Farrokhzad [Sat, 28 Mar 2020 10:45:13 +0000 (11:45 +0100)]
dogfood unnested_or_patterns

4 years agoRemove unnecessary lifetime parameter
Eduardo Broto [Sun, 7 Jun 2020 19:13:13 +0000 (21:13 +0200)]
Remove unnecessary lifetime parameter

4 years agoadd `unnested_or_patterns` lint
Mazdak Farrokhzad [Thu, 19 Mar 2020 13:14:52 +0000 (14:14 +0100)]
add `unnested_or_patterns` lint

4 years agoreversed_empty_ranges: don't lint N..N except in for loop arg
Eduardo Broto [Sun, 7 Jun 2020 18:38:28 +0000 (20:38 +0200)]
reversed_empty_ranges: don't lint N..N except in for loop arg

4 years agolet_and_return: do not lint if last statement borrows
Eduardo Broto [Sat, 6 Jun 2020 22:30:39 +0000 (00:30 +0200)]
let_and_return: do not lint if last statement borrows

4 years agoRename let_and_return test for consistency with the lint name
Eduardo Broto [Sat, 6 Jun 2020 19:51:41 +0000 (21:51 +0200)]
Rename let_and_return test for consistency with the lint name