]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAvoid or_fun_call for const_fn with no args
Eduardo Broto [Mon, 10 Aug 2020 21:38:58 +0000 (23:38 +0200)]
Avoid or_fun_call for const_fn with no args

3 years agoAuto merge of #5887 - robojumper:patch-1, r=flip1995
bors [Mon, 10 Aug 2020 17:51:37 +0000 (17:51 +0000)]
Auto merge of #5887 - robojumper:patch-1, r=flip1995

Fix CHANGELOG's commit range links

Two most recent links linked to the wrong range

changelog: none

3 years agoFix CHANGELOG's commit range links
robojumper [Mon, 10 Aug 2020 15:45:04 +0000 (17:45 +0200)]
Fix CHANGELOG's commit range links

Two most recent links linked to the wrong range

changelog: none

3 years agoAuto merge of #5883 - flip1995:rollup-x9mftxe, r=flip1995
bors [Mon, 10 Aug 2020 13:02:53 +0000 (13:02 +0000)]
Auto merge of #5883 - flip1995:rollup-x9mftxe, r=flip1995

Rollup of 5 pull requests

Successful merges:

 - #5825 (Add the new lint `same_item_push`)
 - #5869 (New lint against `Self` as an arbitrary self type)
 - #5870 (enable #[allow(clippy::unsafe_derive_deserialize)])
 - #5871 (Lint .min(x).max(y) with x < y)
 - #5874 (Make the docs clearer for new contributors)

Failed merges:

r? @ghost

changelog: rollup

3 years agoRollup merge of #5874 - camelid:patch-1, r=flip1995
Philipp Krones [Mon, 10 Aug 2020 12:56:30 +0000 (14:56 +0200)]
Rollup merge of #5874 - camelid:patch-1, r=flip1995

Make the docs clearer for new contributors

It confused me before, so I made it extra obvious that you need to run
a script to set up your toolchain before you can build Clippy.

I also added a note so that new contributors aren't confused when
Clippy doesn't build as a result of a change in rustc's internals.

changelog: make `CONTRIBUTING.md` clearer for new contributors

3 years agoRollup merge of #5871 - wiomoc:feature/methodcall-minmax, r=flip1995
Philipp Krones [Mon, 10 Aug 2020 12:56:29 +0000 (14:56 +0200)]
Rollup merge of #5871 - wiomoc:feature/methodcall-minmax, r=flip1995

Lint .min(x).max(y) with x < y

Fixes  #5854

changelog: Also lint `ord.min(a).max(b)`, where `a < b` in [`min_max`] lint

3 years agoRollup merge of #5870 - ebroto:5789_allow_unsafe_derive_deserialize, r=flip1995
Philipp Krones [Mon, 10 Aug 2020 12:56:27 +0000 (14:56 +0200)]
Rollup merge of #5870 - ebroto:5789_allow_unsafe_derive_deserialize, r=flip1995

enable #[allow(clippy::unsafe_derive_deserialize)]

Before this change this lint could not be allowed as the code we are checking is automatically generated.

changelog: Enable using the `allow` attribute on top of an ADT linted by [`unsafe_derive_deserialize`].

Fixes: #5789
3 years agoRollup merge of #5869 - wiomoc:feature/implicit-self, r=ebroto,flip1995
Philipp Krones [Mon, 10 Aug 2020 12:56:26 +0000 (14:56 +0200)]
Rollup merge of #5869 - wiomoc:feature/implicit-self, r=ebroto,flip1995

New lint against `Self` as an arbitrary self type

Fixes #5861

changelog: * [`needless_arbitrary_self_type`] [#5869](https://github.com/rust-lang/rust-clippy/pull/5869)

3 years agoRollup merge of #5825 - giraffate:same_item_push, r=Manishearth
Philipp Krones [Mon, 10 Aug 2020 12:56:25 +0000 (14:56 +0200)]
Rollup merge of #5825 - giraffate:same_item_push, r=Manishearth

Add the new lint `same_item_push`

changelog: Add the new lint `same_item_push`

Fixed #4078. As I said in https://github.com/rust-lang/rust-clippy/issues/4078#issuecomment-658184195, I referrerd to https://github.com/rust-lang/rust-clippy/pull/4647.

3 years agoAuto merge of #5882 - dima74:ra_setup-prevent-compile-rustc, r=Manishearth
bors [Sun, 9 Aug 2020 19:18:01 +0000 (19:18 +0000)]
Auto merge of #5882 - dima74:ra_setup-prevent-compile-rustc, r=Manishearth

Prevent compile parts of rustc when using `cargo dev ra-setup`

Currently after running `cargo dev ra-setup` the following lines are added to `Cargo.toml`:

```toml
[target]
rustc_data_structures = { path = ".../rust/src/librustc_data_structures" }
rustc_driver = { path = ".../rust/src/librustc_driver" }
rustc_errors = { path = ".../rust/src/librustc_errors" }
rustc_interface = { path = ".../rust/src/librustc_interface" }
rustc_middle = { path = ".../rust/src/librustc_middle" }
```

This pull request adds dependencies for `rustc` crates under `cfg(NOT_A_PLATFORM)`, thus preventing them from compiling together with clippy:

```toml
[target.'cfg(NOT_A_PLATFORM)'.dependencies]
rustc_data_structures = { path = ".../rust/src/librustc_data_structures" }
rustc_driver = { path = ".../rust/src/librustc_driver" }
rustc_errors = { path = ".../rust/src/librustc_errors" }
rustc_interface = { path = ".../rust/src/librustc_interface" }
rustc_middle = { path = ".../rust/src/librustc_middle" }
```

---

This approach was [originally proposed for IntelliJ Rust](https://github.com/intellij-rust/intellij-rust/issues/1618#issuecomment-459098749), and looks like it works for rust-analyzer too.

changelog: none

3 years agoPrevent compile parts of rustc when using `cargo dev ra-setup`
Dmitry Murzin [Sun, 9 Aug 2020 17:21:09 +0000 (22:21 +0500)]
Prevent compile parts of rustc when using `cargo dev ra-setup`

3 years agoAuto merge of #5877 - ebroto:5872_loops_ice, r=Manishearth
bors [Sat, 8 Aug 2020 18:44:48 +0000 (18:44 +0000)]
Auto merge of #5877 - ebroto:5872_loops_ice, r=Manishearth

Fix ICE in `loops` module

changelog: Fix ICE related to `needless_collect` when a call to `iter()` was not present.

I went for restoring the old suggestion of `next().is_some()` over `get(0).is_some()` given that `iter()` is not necessarily present (could be e.g. `into_iter()` or `iter_mut()`)  and that the old suggestion could change semantics, e.g. a call to `filter()` could be present between `iter()` and the collect part.

Fixes #5872

3 years agoAuto merge of #5878 - flip1995:rustup, r=flip1995
bors [Sat, 8 Aug 2020 17:28:34 +0000 (17:28 +0000)]
Auto merge of #5878 - flip1995:rustup, r=flip1995

Rustup

r? @ghost

changelog: none

3 years agoRun fmt
flip1995 [Sat, 8 Aug 2020 17:20:34 +0000 (19:20 +0200)]
Run fmt

3 years agoFix ICE in `loops` module
Eduardo Broto [Sat, 8 Aug 2020 16:13:43 +0000 (18:13 +0200)]
Fix ICE in `loops` module

3 years agoEliminate the `SessionGlobals` from `librustc_ast`.
Nicholas Nethercote [Thu, 30 Jul 2020 01:27:50 +0000 (11:27 +1000)]
Eliminate the `SessionGlobals` from `librustc_ast`.

By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This
means they are accessed via the `Session`, rather than via TLS. A few
`Attr` methods and `librustc_ast` functions are now methods of
`Session`.

All of this required passing a `Session` to lots of functions that didn't
already have one. Some of these functions also had arguments removed, because
those arguments could be accessed directly via the `Session` argument.

`contains_feature_attr()` was dead, and is removed.

Some functions were moved from `librustc_ast` elsewhere because they now need
to access `Session`, which isn't available in that crate.
- `entry_point_type()` --> `librustc_builtin_macros`
- `global_allocator_spans()` --> `librustc_metadata`
- `is_proc_macro_attr()` --> `Session`

3 years agoMake the docs clearer for new contributors
Camelid [Fri, 7 Aug 2020 21:21:14 +0000 (14:21 -0700)]
Make the docs clearer for new contributors

* Add an easy-to-see note at the top of `CONTRIBUTING.md` that points
  new contributors to the Basics docs
* Add a note about compiler errors as a result of internals changes
  that break Clippy

3 years agocheck impl Ord / is_float
Christoph Walcher [Fri, 7 Aug 2020 15:55:25 +0000 (17:55 +0200)]
check impl Ord / is_float

3 years agoignore mutable self reference parameters
Christoph Walcher [Fri, 7 Aug 2020 16:03:12 +0000 (18:03 +0200)]
ignore mutable self reference parameters

3 years agofix nits
Christoph Walcher [Wed, 5 Aug 2020 21:38:55 +0000 (23:38 +0200)]
fix nits

3 years agofix ui tests
Christoph Walcher [Wed, 5 Aug 2020 01:37:29 +0000 (03:37 +0200)]
fix ui tests

3 years agoadopt comments from review
Christoph Walcher [Wed, 5 Aug 2020 00:59:30 +0000 (02:59 +0200)]
adopt comments from review

3 years agofix doc
Christoph Walcher [Tue, 4 Aug 2020 19:07:35 +0000 (21:07 +0200)]
fix doc

3 years agoLint against `Self` as an arbitrary self type
Christoph Walcher [Tue, 4 Aug 2020 18:23:14 +0000 (20:23 +0200)]
Lint against `Self` as an arbitrary self type

Fixes #5861

3 years agoAuto merge of #74821 - oli-obk:const_eval_read_uninit_fast_path, r=wesleywiser
bors [Fri, 7 Aug 2020 15:28:07 +0000 (15:28 +0000)]
Auto merge of #74821 - oli-obk:const_eval_read_uninit_fast_path, r=wesleywiser

Check whether locals are too large instead of whether accesses into them are too large

Essentially this stops const prop from attempting to optimize

```rust
let mut x = [0_u8; 5000];
x[42] = 3;
```

I don't expect this to be a perf improvement without #73656 (which is also where the lack of this PR will be a perf regression).

r? @wesleywiser

3 years agoAdd some comments for magic numbers + Add tests
Vadim Petrochenkov [Tue, 4 Aug 2020 21:26:23 +0000 (00:26 +0300)]
Add some comments for magic numbers + Add tests

3 years agoFix clippy
Vadim Petrochenkov [Wed, 22 Jul 2020 14:59:17 +0000 (17:59 +0300)]
Fix clippy

3 years agoLint .min(x).max(y) with x < y
Christoph Walcher [Thu, 6 Aug 2020 00:42:40 +0000 (02:42 +0200)]
Lint .min(x).max(y) with x < y

Fixes #5854

3 years agoenable #[allow(clippy::unsafe_derive_deserialize)]
Eduardo Broto [Wed, 5 Aug 2020 22:40:11 +0000 (00:40 +0200)]
enable #[allow(clippy::unsafe_derive_deserialize)]

3 years agoAuto merge of #5809 - JarredAllen:stable_sort_primitive, r=Manishearth
bors [Wed, 5 Aug 2020 20:41:21 +0000 (20:41 +0000)]
Auto merge of #5809 - JarredAllen:stable_sort_primitive, r=Manishearth

Stable sort primitive

changelog: Implements #5762

3 years agoAuto merge of #5859 - ebroto:5765_manual_async_fn_fp, r=yaahc
bors [Wed, 5 Aug 2020 17:52:28 +0000 (17:52 +0000)]
Auto merge of #5859 - ebroto:5765_manual_async_fn_fp, r=yaahc

manual_async_fn: take input lifetimes into account

The anonymous future returned from an `async fn` captures all input
lifetimes. This was not being taken into account.

See https://github.com/rust-lang/rfcs/blob/master/text/2394-async_await.md#lifetime-capture-in-the-anonymous-future

changelog: Take input lifetimes into account in [`manual_async_fn`].

Fixes #5765

3 years agorustfmt
Takayuki Nakata [Wed, 5 Aug 2020 14:10:30 +0000 (23:10 +0900)]
rustfmt

3 years agoJust check if it contains `_` in `for pat`
Takayuki Nakata [Wed, 22 Jul 2020 14:22:17 +0000 (23:22 +0900)]
Just check if it contains `_` in `for pat`

3 years agoUse `mutated_variables`
Takayuki Nakata [Wed, 22 Jul 2020 13:11:31 +0000 (22:11 +0900)]
Use `mutated_variables`

3 years agorustfmt
Takayuki Nakata [Mon, 20 Jul 2020 23:25:11 +0000 (08:25 +0900)]
rustfmt

3 years agoFix a lint message
Takayuki Nakata [Mon, 20 Jul 2020 23:15:13 +0000 (08:15 +0900)]
Fix a lint message

3 years agocargo dev update_lints
Takayuki Nakata [Mon, 20 Jul 2020 13:52:30 +0000 (22:52 +0900)]
cargo dev update_lints

3 years agoRename TypeckTables to TypeckResults
Takayuki Nakata [Mon, 20 Jul 2020 13:40:31 +0000 (22:40 +0900)]
Rename TypeckTables to TypeckResults

3 years agoAdd test case for `same_item_push`
Takayuki Nakata [Sun, 19 Jul 2020 14:43:35 +0000 (23:43 +0900)]
Add test case for `same_item_push`

3 years agoAdd lint `same_item_push`
Takayuki Nakata [Sat, 18 Jul 2020 14:28:31 +0000 (23:28 +0900)]
Add lint `same_item_push`

3 years agoAuto merge of #5857 - tmiasko:try-err-poll, r=matthiaskrgr
bors [Wed, 5 Aug 2020 08:43:37 +0000 (08:43 +0000)]
Auto merge of #5857 - tmiasko:try-err-poll, r=matthiaskrgr

try_err: Consider Try impl for Poll when generating suggestions

There are two different implementation of `Try` trait for `Poll` type:
`Poll<Result<T, E>>` and `Poll<Option<Result<T, E>>>`. Take them into
account when generating suggestions.

For example, for `Err(e)?` suggest either `return Poll::Ready(Err(e))` or
`return Poll::Ready(Some(Err(e)))` as appropriate.

Fixes #5855

changelog: try_err: Consider Try impl for Poll when generating suggestions

3 years agoRun cargo dev fmt
JarredAllen [Wed, 5 Aug 2020 00:53:29 +0000 (17:53 -0700)]
Run cargo dev fmt

3 years agoAuto merge of #5865 - camsteffen:unnecessary-fold-known-probs, r=Manishearth
bors [Tue, 4 Aug 2020 23:09:35 +0000 (23:09 +0000)]
Auto merge of #5865 - camsteffen:unnecessary-fold-known-probs, r=Manishearth

Remove obsolete known problems unnecessary_fold

The known problems looks to be obsolete since NLL is stable.

changelog: none

3 years agoAuto merge of #5868 - flip1995:rollup-5g8vft5, r=flip1995
bors [Tue, 4 Aug 2020 10:07:47 +0000 (10:07 +0000)]
Auto merge of #5868 - flip1995:rollup-5g8vft5, r=flip1995

Rollup of 5 pull requests

Successful merges:

 - #5837 (needless_collect: catch x: Vec<_> = iter.collect(); x.into_iter() ...)
 - #5846 (Handle mapping to Option in `map_flatten` lint)
 - #5848 (Add derive_ord_xor_partial_ord lint)
 - #5852 (Add lint for duplicate methods of trait bounds)
 - #5856 (Remove old Symbol reexport)

Failed merges:

r? @ghost

changelog: rollup

3 years agoRollup merge of #5856 - phansch:remove-symbol-reexport, r=flip1995
Philipp Krones [Tue, 4 Aug 2020 10:06:43 +0000 (12:06 +0200)]
Rollup merge of #5856 - phansch:remove-symbol-reexport, r=flip1995

Remove old Symbol reexport

I couldn't really tell what it was meant to improve. It seems more clear
without the renaming to `Name`?

changelog: none

3 years agoRollup merge of #5852 - wiomoc:feature/lint-duplicate-trait, r=Manishearth
Philipp Krones [Tue, 4 Aug 2020 10:06:41 +0000 (12:06 +0200)]
Rollup merge of #5852 - wiomoc:feature/lint-duplicate-trait, r=Manishearth

Add lint for duplicate methods of trait bounds

rel: #5777

changelog: Add [`trait_duplication_in_bounds`] lint

3 years agoRollup merge of #5848 - Ryan1729:add-derive_ord_xor_partial_ord-lint, r=matthiaskrgr
Philipp Krones [Tue, 4 Aug 2020 10:06:40 +0000 (12:06 +0200)]
Rollup merge of #5848 - Ryan1729:add-derive_ord_xor_partial_ord-lint, r=matthiaskrgr

Add derive_ord_xor_partial_ord lint

Fix #1621

Some remarks:
This PR follows the example of the analogous derive_hash_xor_partial_eq lint where possible.
I initially tried using the `match_path` function to identify `Ord` implementation like the derive_hash_xor_partial_eq lint currently does, for `Hash` implementations but that didn't work.

Specifically, the structs at the top level were getting paths that matched `&["$crate", "cmp", "Ord"]` instead of `&["std", "cmp", "Ord"]`. While trying to figure out what to do instead I saw the comment at the top of [clippy_lints/src/utils/paths.rs](https://github.com/rust-lang/rust-clippy/blob/f5d429cd762423901f946abd800dc2cd91366ccf/clippy_lints/src/utils/paths.rs#L5) that mentioned [this issue](https://github.com/rust-lang/rust-clippy/issues/5393) and suggested to use diagnostic items instead of hardcoded paths whenever possible. I looked for a way to identify `Ord` implementations with diagnostic items, but (possibly because this was the first time I had heard of diagnostic items,) I was unable to find one.

Eventually I tried using `get_trait_def_id` and comparing `DefId` values directly and that seems to work as expected. Maybe there's a better approach however?

changelog: new lint: derive_ord_xor_partial_ord

3 years agoRollup merge of #5846 - dima74:map_flatten.map_to_option, r=flip1995
Philipp Krones [Tue, 4 Aug 2020 10:06:39 +0000 (12:06 +0200)]
Rollup merge of #5846 - dima74:map_flatten.map_to_option, r=flip1995

Handle mapping to Option in `map_flatten` lint

Fixes #4496

The existing [`map_flatten`](https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten) lint suggests changing `expr.map(...).flatten()` to `expr.flat_map(...)` when `expr` is `Iterator`. This PR changes suggestion to `filter_map` instead of `flat_map` when mapping to `Option`, because it is more natural

Also here are some questions:
* If expression has type which implements `Iterator` trait (`match_trait_method(cx, expr, &paths::ITERATOR) == true`), how can I get type of iterator elements? Currently I use return type of closure inside `map`, but probably it is not good way
* I would like to change suggestion range to cover only `.map(...).flatten()`, that is from:
```
    let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `flat_map` instead: `vec![5_i8; 6].into_iter().flat_map
```
to
```
    let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
                                             ^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `flat_map` instead: `.flat_map(|x| 0..x)`
```
Is it ok?
* Is `map_flatten` lint intentionally in `pedantic` category, or could it be moved to `complexity`?

changelog: Handle mapping to Option in [`map_flatten`](https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten) lint

3 years agoRollup merge of #5837 - JarredAllen:needless_collect, r=phansch
Philipp Krones [Tue, 4 Aug 2020 10:06:38 +0000 (12:06 +0200)]
Rollup merge of #5837 - JarredAllen:needless_collect, r=phansch

needless_collect: catch x: Vec<_> = iter.collect(); x.into_iter() ...

changelog: Expand the needless_collect lint as suggested in #5627 (WIP).

This PR is WIP because I can't figure out how to make the multi-part suggestion include its changes in the source code (the fixed is identical to the source, despite the lint making suggestions). Aside from that one issue, I think this should be good.

3 years agoAuto merge of #5867 - flip1995:rustup, r=flip1995
bors [Tue, 4 Aug 2020 09:25:05 +0000 (09:25 +0000)]
Auto merge of #5867 - flip1995:rustup, r=flip1995

Rustup

r? @ghost

changelog: none

3 years agorustc_ast: `(Nested)MetaItem::check_name` -> `has_name`
Vadim Petrochenkov [Sun, 2 Aug 2020 10:17:20 +0000 (13:17 +0300)]
rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`

For consistency with `Attribute::has_name` which doesn't mark the attribute as used either.

Replace all uses of `check_name` with `has_name` outside of rustc

3 years agoRemove obsolete known problems unnecessary_fold
Cameron Steffen [Mon, 3 Aug 2020 21:23:20 +0000 (16:23 -0500)]
Remove obsolete known problems unnecessary_fold

3 years agotry_err: Consider Try impl for Poll when generating suggestions
Tomasz Miąsko [Sun, 2 Aug 2020 00:00:00 +0000 (00:00 +0000)]
try_err: Consider Try impl for Poll when generating suggestions

There are two different implementation of Try trait for Poll type;
Poll<Result<T, E>> and Poll<Option<Result<T, E>>>. Take them into
account when generating suggestions.

For example, for Err(e)? suggest either return Poll::Ready(Err(e)) or
return Poll::Ready(Some(Err(e))) as appropriate.

3 years agoCreate stable_sort_primitive lint
JarredAllen [Thu, 9 Jul 2020 03:29:56 +0000 (20:29 -0700)]
Create stable_sort_primitive lint

3 years agoAuto merge of #5864 - rust-lang:ci_debug, r=Manishearth
bors [Mon, 3 Aug 2020 17:53:35 +0000 (17:53 +0000)]
Auto merge of #5864 - rust-lang:ci_debug, r=Manishearth

Fix ui-cargo tests in CI

r? @ebroto

The `ui-toml` tests set the `CARGO_MANIFEST_DIR` var, but never reset it, so the `ui-cargo` tests used it also and then found a faulty `clippy.toml` file

changelog: none

3 years agoFix ui-cargo tests in CI
flip1995 [Mon, 3 Aug 2020 15:22:47 +0000 (17:22 +0200)]
Fix ui-cargo tests in CI

3 years agoearly return on empty parameters/where clause
Christoph Walcher [Mon, 3 Aug 2020 10:32:23 +0000 (12:32 +0200)]
early return on empty parameters/where clause

3 years agoImplement review suggestions
JarredAllen [Mon, 3 Aug 2020 04:46:18 +0000 (21:46 -0700)]
Implement review suggestions

3 years agoFix a bug causing it to be too trigger-happy
JarredAllen [Thu, 23 Jul 2020 17:07:51 +0000 (10:07 -0700)]
Fix a bug causing it to be too trigger-happy

3 years agoFix formatting and dogfood fallout
JarredAllen [Thu, 23 Jul 2020 16:44:44 +0000 (09:44 -0700)]
Fix formatting and dogfood fallout

3 years agoSplit indirect collects into their own test case
JarredAllen [Thu, 23 Jul 2020 16:15:16 +0000 (09:15 -0700)]
Split indirect collects into their own test case

3 years agoCheck for other things which can be used indirectly
JarredAllen [Thu, 23 Jul 2020 16:14:10 +0000 (09:14 -0700)]
Check for other things which can be used indirectly

3 years agoWrite the lint and write tests
JarredAllen [Thu, 23 Jul 2020 05:46:23 +0000 (22:46 -0700)]
Write the lint and write tests

3 years agoCreate test for wanted behavior
JarredAllen [Mon, 20 Jul 2020 15:58:55 +0000 (08:58 -0700)]
Create test for wanted behavior

3 years agomanual_async_fn: take input lifetimes into account
Eduardo Broto [Sun, 2 Aug 2020 22:36:28 +0000 (00:36 +0200)]
manual_async_fn: take input lifetimes into account

The anonymous future returned from an `async fn` captures all input
lifetimes. This was not being taken into account.

See https://github.com/rust-lang/rfcs/blob/master/text/2394-async_await.md#lifetime-capture-in-the-anonymous-future

3 years agofix typos
liuzhenyu [Sun, 2 Aug 2020 15:20:00 +0000 (23:20 +0800)]
fix typos

3 years agofmt
Philipp Hansch [Sun, 2 Aug 2020 12:22:54 +0000 (14:22 +0200)]
fmt

3 years agoRemove old Symbol reexport
Philipp Hansch [Sun, 2 Aug 2020 09:25:03 +0000 (11:25 +0200)]
Remove old Symbol reexport

I couldn't really tell what it was meant to improve. It seems more clear
without the renaming to `Name`?

3 years agoRename HAIR to THIR (Typed HIR).
Valentin Lazureanu [Tue, 21 Jul 2020 09:09:27 +0000 (09:09 +0000)]
Rename HAIR to THIR (Typed HIR).

3 years agoReview fixes
Dmitry Murzin [Thu, 30 Jul 2020 19:20:31 +0000 (22:20 +0300)]
Review fixes

3 years agoHandle mapping to Option in `map_flatten` lint
Dmitry Murzin [Sat, 25 Jul 2020 17:04:59 +0000 (20:04 +0300)]
Handle mapping to Option in `map_flatten` lint

4 years agoUpdate clippy ui test.
Oliver Scherer [Wed, 29 Jul 2020 11:45:20 +0000 (13:45 +0200)]
Update clippy ui test.

The reason we do not trigger these lints anymore is that clippy sets the mir-opt-level to 0, and the recent changes subtly changed how the const propagator works.

4 years agotypo fix
Christoph Walcher [Wed, 29 Jul 2020 14:10:15 +0000 (16:10 +0200)]
typo fix

4 years agoAuto merge of #5843 - dima74:iter_skip_next.add-suggestion, r=phansch
bors [Wed, 29 Jul 2020 06:10:55 +0000 (06:10 +0000)]
Auto merge of #5843 - dima74:iter_skip_next.add-suggestion, r=phansch

Add suggestion for `iter_skip_next` lint

changelog: Add suggestion for [`iter_skip_next`](https://rust-lang.github.io/rust-clippy/master/index.html#iter_skip_next) lint

4 years agoAuto merge of #5840 - flip1995:basics, r=phansch
bors [Wed, 29 Jul 2020 05:43:02 +0000 (05:43 +0000)]
Auto merge of #5840 - flip1995:basics, r=phansch

Basic instruction for new contributors

While answering a few questions to @AB1908, I realized, that our documentation could use some love. Especially the "Getting Started" part for new contributors. So I wrote together some instruction on how to get the toolchain and how to build and test Clippy.

[Rendered](https://github.com/flip1995/rust-clippy/blob/basics/doc/basics.md)

r? @phansch

changelog: none

4 years agoAuto merge of #5853 - flip1995:rustup, r=flip1995
bors [Wed, 29 Jul 2020 01:18:35 +0000 (01:18 +0000)]
Auto merge of #5853 - flip1995:rustup, r=flip1995

Rustup

r? @ghost

changelog: none

4 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Wed, 29 Jul 2020 01:17:23 +0000 (03:17 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

4 years agoLint duplicate methods of trait bounds
Christoph Walcher [Tue, 28 Jul 2020 14:23:47 +0000 (16:23 +0200)]
Lint duplicate methods of trait bounds

Fixes #5777

4 years agoclippy
Bastian Kauschke [Mon, 27 Jul 2020 19:17:28 +0000 (21:17 +0200)]
clippy

4 years agointroduce PredicateAtom
Bastian Kauschke [Wed, 8 Jul 2020 22:35:55 +0000 (00:35 +0200)]
introduce PredicateAtom

4 years agothis might be unqualified, but at least it's now quantified
Bastian Kauschke [Wed, 24 Jun 2020 15:40:28 +0000 (17:40 +0200)]
this might be unqualified, but at least it's now quantified

4 years agoclippy
Bastian Kauschke [Fri, 19 Jun 2020 08:22:25 +0000 (10:22 +0200)]
clippy

4 years agoAuto merge of #5850 - giraffate:chmod_utils_ats_utils, r=flip1995
bors [Mon, 27 Jul 2020 15:27:01 +0000 (15:27 +0000)]
Auto merge of #5850 - giraffate:chmod_utils_ats_utils, r=flip1995

Small fix: `chmod` 644 `clippy_lints/src/utils/ast_utils.rs`

changelog: none

It looks like `clippy_lints/src/utils/ast_utils.rs` doesn't have to be an executable file.

4 years ago`chmod` 644 `clippy_lints/src/utils/ast_utils.rs`
Takayuki Nakata [Mon, 27 Jul 2020 13:27:54 +0000 (22:27 +0900)]
`chmod` 644 `clippy_lints/src/utils/ast_utils.rs`

4 years agorun cargo dev update_lints
Ryan1729 [Mon, 27 Jul 2020 06:31:09 +0000 (00:31 -0600)]
run cargo dev update_lints

4 years agofill in lint description for DERIVE_ORD_XOR_PARTIAL_ORD
Ryan1729 [Mon, 27 Jul 2020 06:22:39 +0000 (00:22 -0600)]
fill in lint description for DERIVE_ORD_XOR_PARTIAL_ORD

4 years agos/pord/partial_ord/ to fix dogfood failure
Ryan1729 [Mon, 27 Jul 2020 06:21:11 +0000 (00:21 -0600)]
s/pord/partial_ord/ to fix dogfood failure

4 years agorun cargo dev fmt and fix overly long line
Ryan1729 [Mon, 27 Jul 2020 05:30:00 +0000 (23:30 -0600)]
run cargo dev fmt and fix overly long line

4 years agoadd description for derive_ord_xor_partial_ord
Ryan1729 [Mon, 27 Jul 2020 05:15:36 +0000 (23:15 -0600)]
add description for derive_ord_xor_partial_ord

4 years agoremove is_local check since getting the def_id directly makes it unnecessary
Ryan1729 [Mon, 27 Jul 2020 05:06:36 +0000 (23:06 -0600)]
remove is_local check since getting the def_id directly makes it unnecessary

4 years agoupdate reference since we see the expected four errors
Ryan1729 [Mon, 27 Jul 2020 05:04:25 +0000 (23:04 -0600)]
update reference since we see the expected four errors

4 years agouse get_trait_def_id to check for Ord trait
Ryan1729 [Mon, 27 Jul 2020 05:04:04 +0000 (23:04 -0600)]
use get_trait_def_id to check for Ord trait

4 years agoinitial implementation based on code for `derive_hash_xor_partial_eq` which is showin...
Ryan1729 [Mon, 27 Jul 2020 04:04:46 +0000 (22:04 -0600)]
initial implementation based on code for `derive_hash_xor_partial_eq` which is showing one error when there should be four

4 years agoadd test for derive_ord_xor_partial_ord based on test for derive_hash_xor_partial_eq
Ryan1729 [Mon, 27 Jul 2020 03:36:50 +0000 (21:36 -0600)]
add test for derive_ord_xor_partial_ord based on test for derive_hash_xor_partial_eq

4 years agomove derive_ord_xor_partial_ord into derive mod so we can reuse derive_hash_xor_parti...
Ryan1729 [Mon, 27 Jul 2020 02:54:04 +0000 (20:54 -0600)]
move derive_ord_xor_partial_ord into derive mod so we can reuse derive_hash_xor_partial_eq code later

4 years agorun cargo dev new_lint
Ryan1729 [Mon, 27 Jul 2020 02:40:57 +0000 (20:40 -0600)]
run cargo dev new_lint

specifically:
cargo dev new_lint --name derive_ord_xor_partial_ord --category correctness --pass late

4 years agoAuto merge of #5820 - ThibsG:FixSuspiciousArithmeticImpl, r=flip1995
bors [Sun, 26 Jul 2020 19:48:17 +0000 (19:48 +0000)]
Auto merge of #5820 - ThibsG:FixSuspiciousArithmeticImpl, r=flip1995

Fix FP for `suspicious_arithmetic_impl` from `suspicious_trait_impl` …

As discussed in #3215, the `suspicious_trait_impl` lint causes too many false positives, as it is complex to find out if binary operations are suspicious or not.

This PR restricts the number of binary operations to at most one, otherwise we don't lint.
This can be seen as very conservative, but at least FP can be reduced to bare minimum.

Fixes: #3215
changelog: limit the `suspicious_arithmetic_impl` lint to one binop, to avoid many FPs

4 years agoMerge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup
flip1995 [Sun, 26 Jul 2020 19:07:07 +0000 (21:07 +0200)]
Merge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup

4 years agoAuto merge of #5845 - giraffate:fix_fp_useless_conversion, r=yaahc
bors [Sun, 26 Jul 2020 17:50:54 +0000 (17:50 +0000)]
Auto merge of #5845 - giraffate:fix_fp_useless_conversion, r=yaahc

Fix FP `useless_conversion`

Fix #5833.

changelog: none

4 years agoFix FP `useless_conversion`
Takayuki Nakata [Sat, 25 Jul 2020 14:58:22 +0000 (23:58 +0900)]
Fix FP `useless_conversion`

Fix #5833.