]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agodeps: remove unused regex dependency from root crate
Matthias Krüger [Fri, 8 May 2020 23:27:30 +0000 (01:27 +0200)]
deps: remove unused regex dependency from root crate

4 years agoAuto merge of #5541 - DarkEld3r:patch-1, r=flip1995
bors [Fri, 8 May 2020 10:34:50 +0000 (10:34 +0000)]
Auto merge of #5541 - DarkEld3r:patch-1, r=flip1995

Extend example for the `unneeded_field_pattern` lint

Current example is incorrect (or pseudo-code) because a struct name is omitted. I have used the code from the tests instead. Perhaps this example can be made less verbose, but I think it is more convenient to see a "real" code as an example.

---

changelog: extend example for the `unneeded_field_pattern` lint

4 years agoAuto merge of #5576 - ebroto:manual_async_fn, r=flip1995
bors [Fri, 8 May 2020 01:50:28 +0000 (01:50 +0000)]
Auto merge of #5576 - ebroto:manual_async_fn, r=flip1995

Add the manual_async_fn lint

changelog: Added the `manual_async_fn` lint to warn on functions that can be simplified using async syntax

Closes #5503

4 years agoApply suggestions from PR review
Eduardo Broto [Thu, 7 May 2020 20:40:28 +0000 (22:40 +0200)]
Apply suggestions from PR review

4 years agoFix doc comment in lint declaration
Eduardo Broto [Thu, 7 May 2020 20:03:38 +0000 (22:03 +0200)]
Fix doc comment in lint declaration

4 years agoAdd the manual_async_fn lint
Eduardo Broto [Thu, 7 May 2020 19:41:23 +0000 (21:41 +0200)]
Add the manual_async_fn lint

4 years agoAuto merge of #5566 - oli-obk:sync-from-rustc, r=flip1995
bors [Wed, 6 May 2020 09:49:00 +0000 (09:49 +0000)]
Auto merge of #5566 - oli-obk:sync-from-rustc, r=flip1995

Update to rustc changes

changelog: none

So, turns out `git subtree push` dies in various interesting ways, but the source cause is that the rustc repo looks like

```
--- A --- B --- C ---
     \--- D ---/
```

where `B` is the commit where I added clippy to rustc and `D` is an arbitrary other PR and `C` is the master branch (or an earlier commit in it). When we now do `git subtree push`, it doesn't stop looking for things to merge at `B` as it needs to look at `D`, too, but then the bad thing happens, and it doesn't stop at `A` either, and just goes on looking at the entire history of rustc in a recursive bash script. That recursion then quickly runs into a stack overflow. While we can increase the stack size via `ulimit -s 60000`, that just means I was waiting for 30 minutes looking at `git subtree push` counting up the number of commits it has looked at. I aborted that, as a process that needs 30 mins for a push is not reasonable.

This PR cheats by just doing a `cp -r ../rustc/src/tools/clippy/* .` inside my clippy checkout and committing all changes. I'm working on getting us a better workflow, but until then, this workaround will work nicely. Note that this requires a `git subrepo pull` to have occurred in the `rustc` checkout. It's not necessary to merge that pull in order to update clippy, it's just necessary in order to not revert code in the clippy repo that hasn't been synced yet to the rustc repo.

4 years agoUpdate ui tests
Oliver Scherer [Tue, 5 May 2020 13:11:59 +0000 (15:11 +0200)]
Update ui tests

4 years agoUpdate to rustc changes
Oliver Scherer [Mon, 4 May 2020 13:13:07 +0000 (15:13 +0200)]
Update to rustc changes

4 years agoAuto merge of #5560 - CrazyRoka:fix-match-on-vector-full-range, r=phansch,flip1995
bors [Sat, 2 May 2020 16:13:02 +0000 (16:13 +0000)]
Auto merge of #5560 - CrazyRoka:fix-match-on-vector-full-range, r=phansch,flip1995

Fix match on vec items: match on vec[..]

- Added new tests
- Fixed false positive when matching on full range, which will never panic

Closes #5551
changelog: fix match_on_vec_items when matching full range

4 years agoAuto merge of #5558 - ThibsG:FixUnwrapInArgs, r=flip1995
bors [Sat, 2 May 2020 15:59:18 +0000 (15:59 +0000)]
Auto merge of #5558 - ThibsG:FixUnwrapInArgs, r=flip1995

Fix `unnecessary_unwrap` lint when checks are done in parameters

Fixes a false positive in `unnecessary_unwrap` lint when checks are done in macro parameters.

FIxes #5174

changelog: Fixes a false positive in `unnecessary_unwrap` lint when checks are done in macro parameters.

4 years agoAuto merge of #5559 - alex-700:fix-while-let-on-iterator-fp, r=flip1995
bors [Sat, 2 May 2020 15:30:58 +0000 (15:30 +0000)]
Auto merge of #5559 - alex-700:fix-while-let-on-iterator-fp, r=flip1995

Fix FP on while-let-on-iterator

- fix `is_refutable` for slice patterns
- fix `is_refutable` for bindings
- add some TODO-s for cases, which can not be fixed easily

fixes #3780

changelog: fix FP on while-let-on-iterator for arrays and bindings

4 years agoChanged RANGE_FULL constant in utils
CrazyRoka [Sat, 2 May 2020 14:36:26 +0000 (17:36 +0300)]
Changed RANGE_FULL constant in utils

4 years agoAuto merge of #5550 - ebroto:manual_non_exhaustive, r=flip1995
bors [Sat, 2 May 2020 13:53:39 +0000 (13:53 +0000)]
Auto merge of #5550 - ebroto:manual_non_exhaustive, r=flip1995

Implement the manual_non_exhaustive lint

Some implementation notes:
* Not providing automatic fixups because additional changes may be needed in other parts of the code, e.g. when constructing a struct.
* Even though the attribute is valid on enum variants, it's not possible to use the manual implementation of the pattern because the visibility is always public, so the lint ignores enum variants.
* Unit structs are also ignored, it's not possible to implement the pattern manually without fields.
* The attribute is not accepted in unions, so those are ignored too.
* Even though the original issue did not mention it, tuple structs are also linted because it's possible to apply the pattern manually.

changelog: Added the manual non-exhaustive implementation lint

Closes #2017

4 years agoFix match on vec items: match on vec[..]
CrazyRoka [Sat, 2 May 2020 11:25:45 +0000 (14:25 +0300)]
Fix match on vec items: match on vec[..]

- Added new tests
- Fixed false positive when matching on full range, which will never panic

4 years agofix fp on while-let-on-iterator
Aleksei Latyshev [Sat, 2 May 2020 11:18:27 +0000 (14:18 +0300)]
fix fp on while-let-on-iterator

- fix `is_refutable` for slice patterns
- fix `is_refutable` for bindings
- add some TODO-s for cases, which can not be fixed easily

4 years agoFix unwrap lint when checks are done in parameters
ThibsG [Fri, 24 Apr 2020 14:46:56 +0000 (16:46 +0200)]
Fix unwrap lint when checks are done in parameters

4 years agoAuto merge of #5555 - flip1995:pedantic_match_on_vec_items, r=phansch
bors [Sat, 2 May 2020 08:45:59 +0000 (08:45 +0000)]
Auto merge of #5555 - flip1995:pedantic_match_on_vec_items, r=phansch

Move match_on_vec_items to pedantic

Addresses https://github.com/rust-lang/rust-clippy/issues/5551#issuecomment-622515580

Fixes #5553

changelog: Move [`match_on_vec_items`] to pedantic

r? @phansch

4 years agoAuto merge of #5536 - rail-rain:fix_manual_memcpy, r=phansch
bors [Sat, 2 May 2020 08:11:48 +0000 (08:11 +0000)]
Auto merge of #5536 - rail-rain:fix_manual_memcpy, r=phansch

Fix the bugs of `manual_memcpy`, simplify the suggestion and refactor it

While I’m working on the long procrastinated work to expand `manual_memcpy`(#1670), I found a few minor bugs and probably unidiomatic or old coding style. There is a brief explanation of changes to the behaviour this PR will make below. And, I have a questoin: do I need to add tests for the first and second fixed bugs? I thought it might be too rare cases to include the tests for those. I added for the last one though.

* Bug fix
  * It negates resulted offsets (`src/dst_offset`) when `offset` is subtraction by 0. This PR will remove any subtraction by 0 as a part of minification.

    ```rust
    for i in 0..5 {
        dst[i - 0] = src[i];
    }
    ```

    ```diff
     warning: it looks like you're manually copying between slices
       --> src/main.rs:2:14
        |
    LL  |     for i in 0..5 {
    -   |              ^^^^ help: try replacing the loop by: `dst[..-5].clone_from_slice(&src[..5])`
    +   |              ^^^^ help: try replacing the loop by: `dst[..5].clone_from_slice(&src[..5])`
        |
    ```
  * It prints `RangeTo` or `RangeFull` when both of `end` and `offset` are 0, which have different meaning. This PR will print 0. I could reject the cases `end` is 0, but I thought I won’t catch other cases `reverse_range_loop` will trigger, and it’s over to catch every such cases.

    ```rust
    for i in 0..0 {
        dst[i] = src[i];
    }
    ```

    ```diff
     warning: it looks like you're manually copying between slices
       --> src/main.rs:2:14
        |
     LL |     for i in 0..0 {
    -   |              ^^^^ help: try replacing the loop by: `dst.clone_from_slice(&src[..])`
    +   |              ^^^^ help: try replacing the loop by: `dst[..0].clone_from_slice(&src[..0])`
        |
    ```
  * it prints four dots when `end` is `None`. This PR will ignore any `for` loops without `end` because a `for` loop that takes `RangeFrom` as its argument and contains indexing without the statements or the expressions that end loops such as `break` will definitely panic, and `manual_memcpy` should ignore the loops with such control flow.

    ```rust
    fn manual_copy(src: &[u32], dst: &mut [u32]) {
        for i in 0.. {
            dst[i] = src[i];
        }
    }
    ```

    ```diff
    -warning: it looks like you're manually copying between slices
    -  --> src/main.rs:2:14
    -   |
    -LL |     for i in 0.. {
    -   |              ^^^ help: try replacing the loop by: `dst[....].clone_from_slice(&src[....])`
    -   |
    ```
* Simplification of the suggestion

  * It prints 0 when `start` or `end` and `offset` are same (from #3323). This PR will use `RangeTo`

changelog: fixed the bugs of `manual_memcpy` and also simplify the suggestion.

4 years agoUse the only variant left instead of a wildcard
ebroto [Fri, 1 May 2020 21:00:16 +0000 (23:00 +0200)]
Use the only variant left instead of a wildcard

Co-authored-by: Philipp Krones <hello@philkrones.com>
4 years agoMove match_on_vec_items to pedantic
flip1995 [Fri, 1 May 2020 21:02:31 +0000 (23:02 +0200)]
Move match_on_vec_items to pedantic

4 years agoApply suggestions from PR review
Eduardo Broto [Fri, 1 May 2020 20:37:14 +0000 (22:37 +0200)]
Apply suggestions from PR review

4 years agoAuto merge of #5548 - matthiaskrgr:traget_os, r=flip1995
bors [Fri, 1 May 2020 16:33:14 +0000 (16:33 +0000)]
Auto merge of #5548 - matthiaskrgr:traget_os, r=flip1995

mismatched_target_os: link to respective section in rust reference

changelog: none

4 years agoImplement the manual_non_exhaustive lint
Eduardo Broto [Thu, 30 Apr 2020 23:44:17 +0000 (01:44 +0200)]
Implement the manual_non_exhaustive lint

4 years agomismatched_target_os: link to respective section in rust reference
Matthias Krüger [Thu, 30 Apr 2020 23:21:24 +0000 (01:21 +0200)]
mismatched_target_os: link to respective section in rust reference

4 years agoAdd missing tests
rail [Thu, 30 Apr 2020 05:32:37 +0000 (17:32 +1200)]
Add missing tests

4 years agoAuto merge of #5547 - CrazyRoka:fix-clone-double-ref-suggestion, r=flip1995
bors [Wed, 29 Apr 2020 20:05:18 +0000 (20:05 +0000)]
Auto merge of #5547 - CrazyRoka:fix-clone-double-ref-suggestion, r=flip1995

Fixed incorrect suggestion of `clone_double_ref` lint

- Added `<_>` to suggestion
- Changed help message
- Added new tests
Closes #5494

changelog: Improve suggestion of [`clone_double_ref`]

4 years agoFixed incorrect suggestion of `clone_double_ref` lint
CrazyRoka [Wed, 29 Apr 2020 19:40:57 +0000 (22:40 +0300)]
Fixed incorrect suggestion of `clone_double_ref` lint

- Added `<_>` to suggestion
- Changed help message

4 years agoAuto merge of #5545 - flip1995:rustup, r=flip1995
bors [Wed, 29 Apr 2020 13:59:30 +0000 (13:59 +0000)]
Auto merge of #5545 - flip1995:rustup, r=flip1995

Rustup to rust-lang/rust#71518

changelog: none

4 years agoRustup to rust-lang/rust#71518
flip1995 [Wed, 29 Apr 2020 13:48:43 +0000 (15:48 +0200)]
Rustup to rust-lang/rust#71518

4 years agoAuto merge of #5543 - matthiaskrgr:rustup_45, r=flip1995
bors [Tue, 28 Apr 2020 18:30:01 +0000 (18:30 +0000)]
Auto merge of #5543 - matthiaskrgr:rustup_45, r=flip1995

rustup https://github.com/rust-lang/rust/pull/71292/

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

---

changelog: none

4 years agorustup https://github.com/rust-lang/rust/pull/71292/
Matthias Krüger [Tue, 28 Apr 2020 13:05:56 +0000 (15:05 +0200)]
rustup https://github.com/rust-lang/rust/pull/71292/

4 years agoExtend example for the `unneeded_field_pattern` lint
Stanislav Tkach [Tue, 28 Apr 2020 09:08:38 +0000 (12:08 +0300)]
Extend example for the `unneeded_field_pattern` lint

Current example is incorrect (or pseudo-code) because a struct name is omitted. I have used the code from the tests instead. Perhaps this example can be made less verbose, but I think it is more convenient to see a "real" code as an example.

4 years agoAuto merge of #5535 - ebroto:issue_5360, r=phansch
bors [Tue, 28 Apr 2020 05:36:30 +0000 (05:36 +0000)]
Auto merge of #5535 - ebroto:issue_5360, r=phansch

used_underscore_binding: do not lint on `await` desugaring

changelog: used_underscore_binding: do not lint on `await` desugaring

Fixes #5360

4 years agoTest that we lint the awaited expression
Eduardo Broto [Mon, 27 Apr 2020 19:12:39 +0000 (21:12 +0200)]
Test that we lint the awaited expression

4 years agoused_underscore_binding: do not lint on `await` desugaring
Eduardo Broto [Sun, 26 Apr 2020 22:12:51 +0000 (00:12 +0200)]
used_underscore_binding: do not lint on `await` desugaring

4 years agoAuto merge of #5538 - csmoe:rustup, r=phansch
bors [Mon, 27 Apr 2020 16:58:24 +0000 (16:58 +0000)]
Auto merge of #5538 - csmoe:rustup, r=phansch

rustup: rust-lang/rust#71628

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

changelog: none

4 years agorustup: rust-lang/rust#71628
csmoe [Mon, 27 Apr 2020 13:56:20 +0000 (21:56 +0800)]
rustup: rust-lang/rust#71628

4 years agoRemoved unused lifetimes and a needless bool
rail [Mon, 27 Apr 2020 08:37:21 +0000 (20:37 +1200)]
Removed unused lifetimes and a needless bool

4 years agoMerge branch 'master' into fix_manual_memcpy
rail [Mon, 27 Apr 2020 07:52:49 +0000 (19:52 +1200)]
Merge branch 'master' into fix_manual_memcpy

4 years agoExtract building the suggestion of `manual_memcpy`
rail [Mon, 27 Apr 2020 07:44:44 +0000 (19:44 +1200)]
Extract building the suggestion of `manual_memcpy`

4 years agoDelay getting the snippet from slices
rail [Mon, 27 Apr 2020 07:34:41 +0000 (19:34 +1200)]
Delay getting the snippet from slices

4 years agoSeparate getting offsets and getting index expressions
rail [Mon, 27 Apr 2020 07:26:00 +0000 (19:26 +1200)]
Separate getting offsets and getting index expressions

4 years agoExtract roles getting indexes from `get_indexed_assignments`
rail [Mon, 27 Apr 2020 07:15:51 +0000 (19:15 +1200)]
Extract roles getting indexes from `get_indexed_assignments`

4 years agoExtract `get_fixed_offset_var`` from `fetch_cloned_fixed_offset_var`
rail [Mon, 27 Apr 2020 07:04:56 +0000 (19:04 +1200)]
Extract `get_fixed_offset_var`` from `fetch_cloned_fixed_offset_var`

4 years agoUse `fn` instead of closures where unnecessary
rail [Mon, 27 Apr 2020 07:02:08 +0000 (19:02 +1200)]
Use `fn` instead of closures where unnecessary

4 years agoRename `negate` to `sign` and make it strong types then make `art1` &str
rail [Mon, 27 Apr 2020 06:57:36 +0000 (18:57 +1200)]
Rename `negate` to `sign` and make it strong types then make `art1` &str

4 years agoRefactor `if` to use `else` and iterator combinators
rail [Mon, 27 Apr 2020 06:47:24 +0000 (18:47 +1200)]
Refactor `if` to use `else` and iterator combinators

4 years agoRemove all `ref` keyword
rail [Mon, 27 Apr 2020 06:22:10 +0000 (18:22 +1200)]
Remove all `ref` keyword

4 years agoDo not trigger `manual_memcpy` for `RangeTo`
rail [Mon, 27 Apr 2020 06:04:37 +0000 (18:04 +1200)]
Do not trigger `manual_memcpy` for `RangeTo`

4 years agoAuto merge of #5522 - CrazyRoka:match_vec_item, r=phansch
bors [Mon, 27 Apr 2020 06:02:05 +0000 (06:02 +0000)]
Auto merge of #5522 - CrazyRoka:match_vec_item, r=phansch

New  lint `match_vec_item`

Added new lint to warn a match on index item which can panic. It's always better to use `get(..)` instead.
Closes #5500
changelog: New lint `match_on_vec_items`

4 years agoPrint 0 when `end` and `offset` is 0, and also simplify the suggestion
rail [Mon, 27 Apr 2020 05:51:01 +0000 (17:51 +1200)]
Print 0 when `end` and `offset` is 0, and also simplify the suggestion

4 years agoDon't negate resulted offsets when `offset` is subtraction by 0
rail [Mon, 27 Apr 2020 05:42:57 +0000 (17:42 +1200)]
Don't negate resulted offsets when `offset` is subtraction by 0

4 years agoAuto merge of #5506 - ebroto:mismatched_target_os, r=flip1995
bors [Mon, 27 Apr 2020 02:29:49 +0000 (02:29 +0000)]
Auto merge of #5506 - ebroto:mismatched_target_os, r=flip1995

Implement mismatched_target_os lint

I've extended the check suggested in the issue to all the currently supported operating systems instead of limiting it to `linux` and `macos`, let me know if we want to do this.

Also, I've restored the text `There are over XXX lints ...` in the README as it was matched against by `cargo dev new_lint`.

changelog: Added `mismatched_target_os` lint to warn when an operating system is used in target family position in a #[cfg] attribute

Closes #3949

4 years agoSplit tests in unix/non-unix
Eduardo Broto [Sun, 26 Apr 2020 19:26:19 +0000 (21:26 +0200)]
Split tests in unix/non-unix

4 years agoRemove some OSes from the test to comply with stderr line limit
Eduardo Broto [Sat, 25 Apr 2020 22:00:30 +0000 (00:00 +0200)]
Remove some OSes from the test to comply with stderr line limit

4 years agoUse the span of the attribute for the error message
Eduardo Broto [Sat, 25 Apr 2020 21:52:36 +0000 (23:52 +0200)]
Use the span of the attribute for the error message

4 years agoApply suggestions from PR review
Eduardo Broto [Sat, 25 Apr 2020 18:55:46 +0000 (20:55 +0200)]
Apply suggestions from PR review

- Show just one error message with multiple suggestions in case of
  using multiple times an OS in target family position
- Only suggest #[cfg(unix)] when the OS is in the Unix family
- Test all the operating systems

4 years agoImplement mismatched_target_os lint
Eduardo Broto [Wed, 22 Apr 2020 21:01:25 +0000 (23:01 +0200)]
Implement mismatched_target_os lint

4 years agoUpdated lint info in lib.rs
CrazyRoka [Sun, 26 Apr 2020 15:11:21 +0000 (18:11 +0300)]
Updated lint info in lib.rs

4 years agoSmall lint update
CrazyRoka [Sun, 26 Apr 2020 14:57:19 +0000 (17:57 +0300)]
Small lint update

- Changed lint category to `correctness`
- Moved main function to bottom in test file
- Added `FIXME` comment to `span_lint_and_sugg` to improve later

4 years agoAuto merge of #5534 - phansch:remove-util-dev, r=flip1995
bors [Sun, 26 Apr 2020 14:44:08 +0000 (14:44 +0000)]
Auto merge of #5534 - phansch:remove-util-dev, r=flip1995

Remove util/dev script

`cargo dev` has been the replacement for a while, so I think we can
remove it now.

cc #5394

changelog: none

4 years agoAuto merge of #5509 - phansch:more-diagnostic-items2, r=matthiaskrgr
bors [Sun, 26 Apr 2020 12:30:52 +0000 (12:30 +0000)]
Auto merge of #5509 - phansch:more-diagnostic-items2, r=matthiaskrgr

Use more diagnostic items

In particular for:

* `VecDeque`
* `String`
* `Mutex`
* `HashMap`
* `HashSet`

cc rust-lang/rust#71414 #5393

---

changelog: none

4 years agoFix cargo crash
Philipp Hansch [Sun, 26 Apr 2020 11:45:47 +0000 (13:45 +0200)]
Fix cargo crash

4 years agoRemove util/dev script
Philipp Hansch [Sun, 26 Apr 2020 12:00:03 +0000 (14:00 +0200)]
Remove util/dev script

`cargo dev` has been the replacement for a while, so I think we can
remove it now.

cc #5394

4 years agocargo dev fmt
Philipp Hansch [Thu, 23 Apr 2020 06:12:03 +0000 (08:12 +0200)]
cargo dev fmt

4 years agoMore diagnostic items
Philipp Hansch [Thu, 23 Apr 2020 06:09:42 +0000 (08:09 +0200)]
More diagnostic items

In particular for:

* `VecDeque`
* `String`
* `Mutex`
* `HashMap`
* `HashSet`

cc https://github.com/rust-lang/rust/pull/71414 https://github.com/rust-lang/rust-clippy/issues/5393

4 years agoAuto merge of #5533 - phansch:rustup001, r=matthiaskrgr
bors [Sun, 26 Apr 2020 11:26:15 +0000 (11:26 +0000)]
Auto merge of #5533 - phansch:rustup001, r=matthiaskrgr

rustup to https://github.com/rust-lang/rust/pull/70043

changelog: none

4 years agorustup to https://github.com/rust-lang/rust/pull/70043
Philipp Hansch [Sun, 26 Apr 2020 08:12:14 +0000 (10:12 +0200)]
rustup to https://github.com/rust-lang/rust/pull/70043

4 years agoAuto merge of #5511 - alex-700:fix-redundant-pattern-matching, r=flip1995
bors [Sat, 25 Apr 2020 21:41:56 +0000 (21:41 +0000)]
Auto merge of #5511 - alex-700:fix-redundant-pattern-matching, r=flip1995

Fix redundant_pattern_matching lint

fixes #5504

changelog: Fix suggestion in `redundant_pattern_matching` for macros.

4 years agoAuto merge of #5525 - flip1995:issue_1654, r=phansch
bors [Sat, 25 Apr 2020 21:29:03 +0000 (21:29 +0000)]
Auto merge of #5525 - flip1995:issue_1654, r=phansch

 Don't trigger while_let_on_iterator when the iterator is recreated every iteration

r? @phansch

Fixes #1654

changelog: Fix false positive in [`while_let_on_iterator`]

4 years agoAuto merge of #5530 - ebroto:issue_5524, r=flip1995
bors [Sat, 25 Apr 2020 21:16:06 +0000 (21:16 +0000)]
Auto merge of #5530 - ebroto:issue_5524, r=flip1995

map_clone: avoid suggesting `copied()` for &mut

changelog: map_clone: avoid suggesting `copied()` for &mut

Fixes #5524

4 years agomap_clone: avoid suggesting `copied()` for &mut
Eduardo Broto [Sat, 25 Apr 2020 20:49:06 +0000 (22:49 +0200)]
map_clone: avoid suggesting `copied()` for &mut

4 years agofix redundant_pattern_matching lint
Aleksei Latyshev [Thu, 23 Apr 2020 08:40:16 +0000 (11:40 +0300)]
fix redundant_pattern_matching lint

- now it gives correct suggestion in case of macros
- better tests
- remove a couple of non-relevant tests

4 years agoAuto merge of #5527 - flip1995:rollup-pr2htfd, r=flip1995
bors [Sat, 25 Apr 2020 19:38:04 +0000 (19:38 +0000)]
Auto merge of #5527 - flip1995:rollup-pr2htfd, r=flip1995

Rollup of 5 pull requests

Successful merges:

 - #5408 (Downgrade match_bool to pedantic)
 - #5505 (Avoid running cargo+internal lints when not enabled)
 - #5516 (Add a note to the beta sections of release.md)
 - #5517 (Deploy time travel)
 - #5523 (Add lifetime test case for `new_ret_no_self`)

Failed merges:

r? @ghost

changelog: rollup

4 years agoRollup merge of #5523 - phansch:add-new-ret-no-self-testcase, r=flip1995
Philipp Krones [Sat, 25 Apr 2020 19:06:31 +0000 (21:06 +0200)]
Rollup merge of #5523 - phansch:add-new-ret-no-self-testcase, r=flip1995

Add lifetime test case for `new_ret_no_self`

cc https://github.com/rust-lang/rust-clippy/issues/734#issuecomment-619344352

changelog: none

4 years agoRollup merge of #5517 - flip1995:deploy_time_travel, r=Manishearth
Philipp Krones [Sat, 25 Apr 2020 19:06:30 +0000 (21:06 +0200)]
Rollup merge of #5517 - flip1995:deploy_time_travel, r=Manishearth

Deploy time travel

Since not only commits to the master branch, but also tags and the beta branch are deployed, we have to be cautious which version of the deploy script is used. GHA always runs the workflow that is commited on the `ref`, that gets tested. For tagged commits. this is 6 weeks outdated workflows/scripts. To prevent this, this workflow first checks out the deploy.sh script, the website templates and all python scripts generating files for the website.

changelog: none

4 years agoRollup merge of #5516 - flip1995:doc_release, r=phansch
Philipp Krones [Sat, 25 Apr 2020 19:06:28 +0000 (21:06 +0200)]
Rollup merge of #5516 - flip1995:doc_release, r=phansch

Add a note to the beta sections of release.md

changelog: none

4 years agoRollup merge of #5505 - flip1995:avoid_running_lints, r=matthiaskrgr
Philipp Krones [Sat, 25 Apr 2020 19:06:27 +0000 (21:06 +0200)]
Rollup merge of #5505 - flip1995:avoid_running_lints, r=matthiaskrgr

Avoid running cargo+internal lints when not enabled

r? @matthiaskrgr

changelog: none

4 years agoRollup merge of #5408 - dtolnay:matchbool, r=flip1995
Philipp Krones [Sat, 25 Apr 2020 19:06:26 +0000 (21:06 +0200)]
Rollup merge of #5408 - dtolnay:matchbool, r=flip1995

Downgrade match_bool to pedantic

I don't quite buy the justification in https://rust-lang.github.io/rust-clippy/. The justification is:

> It makes the code less readable.

In the Rust codebases I've worked in, I have found people were comfortable using `match bool` (selectively) to make code more readable. For example, initializing struct fields is a place where the indentation of `match` can work better than the indentation of `if`:

```rust
let _ = Struct {
    v: {
        ...
    },
    w: match doing_w {
        true => ...,
        false => ...,
    },
    x: Nested {
        c: ...,
        b: ...,
        a: ...,
    },
    y: if doing_y {
        ...
    } else { // :(
        ...
    },
    z: ...,
};
```

Or sometimes people prefer something a bit less pithy than `if` when the meaning of the bool doesn't read off clearly from the condition:

```rust
if set.insert(...) {
    ... // ???
} else {
    ...
}

match set.insert(...) {
    // set.insert returns false if already present
    false => ...,
    true => ...,
}
```

Or `match` can be a better fit when the bool is playing the role more of a value than a branch condition:

```rust
impl ErrorCodes {
    pub fn from(b: bool) -> Self {
        match b {
            true => ErrorCodes::Yes,
            false => ErrorCodes::No,
        }
    }
}
```

And then there's plain old it's-1-line-shorter, which means we get 25% more content on a screen when stacking a sequence of conditions:

```rust
let old_noun = match old_binding.is_import() {
    true => "import",
    false => "definition",
};
let new_participle = match new_binding.is_import() {
    true => "imported",
    false => "defined",
};
```

Bottom line is I think this lint fits the bill better as a pedantic lint; I don't think linting on this by default is justified.

changelog: Remove match_bool from default set of enabled lints

4 years agoAdd tests for #1654
flip1995 [Sat, 25 Apr 2020 18:51:23 +0000 (20:51 +0200)]
Add tests for #1654

4 years agoDon't trigger while_let_on_iterator when the iterator is recreated every iteration
flip1995 [Sat, 25 Apr 2020 18:51:02 +0000 (20:51 +0200)]
Don't trigger while_let_on_iterator when the iterator is recreated every iteration

4 years agoAuto merge of #5520 - matthiaskrgr:rustup_44, r=flip1995,phansch
bors [Sat, 25 Apr 2020 18:18:32 +0000 (18:18 +0000)]
Auto merge of #5520 - matthiaskrgr:rustup_44, r=flip1995,phansch

rustup https://github.com/rust-lang/rust/pull/71215/

There's currently an crash in `ui/new_without_default.rs` that I need to figure out how to avoid.

changelog: none

4 years agoUpdate issue_2356.stderr reference file
flip1995 [Sat, 25 Apr 2020 18:07:55 +0000 (20:07 +0200)]
Update issue_2356.stderr reference file

4 years agoUpdate while_let_on_iterator tests
flip1995 [Sat, 25 Apr 2020 18:01:22 +0000 (20:01 +0200)]
Update while_let_on_iterator tests

4 years agoFix while_let_on_iterator suggestion and make it MachineApplicable
flip1995 [Sat, 25 Apr 2020 18:00:00 +0000 (20:00 +0200)]
Fix while_let_on_iterator suggestion and make it MachineApplicable

4 years agoAdd lifetime test case for `new_ret_no_self`
Philipp Hansch [Sat, 25 Apr 2020 08:43:41 +0000 (10:43 +0200)]
Add lifetime test case for `new_ret_no_self`

4 years agoRenamed lint to `match_on_vec_items`
CrazyRoka [Sat, 25 Apr 2020 08:33:40 +0000 (11:33 +0300)]
Renamed lint to `match_on_vec_items`

4 years agoRemoved unnecessary code, added support for vector references
CrazyRoka [Fri, 24 Apr 2020 21:52:02 +0000 (00:52 +0300)]
Removed unnecessary code, added support for vector references

4 years agoAdded lint `match_vec_item`
CrazyRoka [Thu, 23 Apr 2020 21:28:18 +0000 (00:28 +0300)]
Added  lint `match_vec_item`

4 years agorustup https://github.com/rust-lang/rust/pull/71215/
Matthias Krüger [Fri, 24 Apr 2020 09:57:34 +0000 (11:57 +0200)]
rustup https://github.com/rust-lang/rust/pull/71215/

4 years agoDowngrade match_bool to pedantic
David Tolnay [Fri, 3 Apr 2020 00:36:49 +0000 (17:36 -0700)]
Downgrade match_bool to pedantic

4 years agoRun fetch before testing if master contains beta
flip1995 [Thu, 23 Apr 2020 21:24:58 +0000 (23:24 +0200)]
Run fetch before testing if master contains beta

4 years agoThe beta branch update should not require a force push
flip1995 [Thu, 23 Apr 2020 18:34:30 +0000 (20:34 +0200)]
The beta branch update should not require a force push

4 years agoAdd a note to the beta sections of release.md
flip1995 [Thu, 23 Apr 2020 18:14:06 +0000 (20:14 +0200)]
Add a note to the beta sections of release.md

4 years agoAuto merge of #5513 - matthiaskrgr:reg, r=phansch
bors [Thu, 23 Apr 2020 20:56:15 +0000 (20:56 +0000)]
Auto merge of #5513 - matthiaskrgr:reg, r=phansch

fix clippy_dev exit status and make regex match again

changelog: none

Fixes #5510

r? @phansch

4 years agoRemove apt-get upgrade again
flip1995 [Thu, 23 Apr 2020 18:45:39 +0000 (20:45 +0200)]
Remove apt-get upgrade again

4 years agoAlways use the deploy script and templates of the master branch
flip1995 [Thu, 23 Apr 2020 18:44:18 +0000 (20:44 +0200)]
Always use the deploy script and templates of the master branch

4 years agoAuto merge of #5498 - phansch:update_changelog, r=flip1995
bors [Thu, 23 Apr 2020 18:35:22 +0000 (18:35 +0000)]
Auto merge of #5498 - phansch:update_changelog, r=flip1995

Update CHANGELOG.md for Rust 1.43 and 1.44

[Rendered](https://github.com/phansch/rust-clippy/blob/update_changelog/CHANGELOG.md)

changelog: none

4 years agoREADME: fix lit count line
Matthias Krüger [Thu, 23 Apr 2020 14:08:40 +0000 (16:08 +0200)]
README: fix lit count line

It looks like after changing to "there are more than 120 lints", an older PR was merged
and resolving merge conflicts this was changed back to "there are 123 lints" causing the update-script to silently fail.

Changed back the README.md back to the new format fixes the problem.