]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoMerge `option_unwrap_used` and `result_unwrap_used` lints into `unwrap_used` lint
ThibsG [Sun, 3 May 2020 11:11:18 +0000 (13:11 +0200)]
Merge `option_unwrap_used` and `result_unwrap_used` lints into `unwrap_used` lint

4 years agoMerge `option_map_unwrap_or`, `option_map_unwrap_or_else` and `result_map_unwrap_or_e...
ThibsG [Sun, 3 May 2020 10:28:40 +0000 (12:28 +0200)]
Merge `option_map_unwrap_or`, `option_map_unwrap_or_else` and `result_map_unwrap_or_else` lints into `map_unwrap` lint

4 years agoMerge `block_in_if_condition_expr` and `block_in_if_condition_stmt` lints into `block...
ThibsG [Sun, 3 May 2020 09:20:51 +0000 (11:20 +0200)]
Merge `block_in_if_condition_expr` and `block_in_if_condition_stmt` lints into `block_in_if_condition` lint

4 years agoAuto merge of #5583 - ebroto:reversed_empty_ranges, r=yaahc,flip1995
bors [Thu, 14 May 2020 12:59:24 +0000 (12:59 +0000)]
Auto merge of #5583 - ebroto:reversed_empty_ranges, r=yaahc,flip1995

Reversed empty ranges

This lint checks range expressions with inverted limits which result in empty ranges. This includes also the ranges used to index slices.

The lint reverse_range_loop was covering iteration of reversed ranges in a for loop, which is a subset of what this new lint covers, so it has been removed. I'm not sure if that's the best choice. It would be doable to check in the new lint that we are not in the arguments of a for loop; I went for removing it because the logic was too similar to keep them separated.

changelog: Added reversed_empty_ranges lint that checks for ranges where the limits have been inverted, resulting in empty ranges. Removed reverse_range_loop which was covering a subset of the new lint.

Closes #4192
Closes #96

4 years agoAuto merge of #5590 - ebroto:issue_5579, r=phansch
bors [Thu, 14 May 2020 05:34:54 +0000 (05:34 +0000)]
Auto merge of #5590 - ebroto:issue_5579, r=phansch

Fix ICE caused in unwrap module

changelog: Fix ICE in unwrap module with unexpected number of parameters for method of Option/Result

Fixes #5579

4 years agoAvoid running doctest that is expected to panic
Eduardo Broto [Wed, 13 May 2020 19:07:13 +0000 (21:07 +0200)]
Avoid running doctest that is expected to panic

4 years agoMove test for issue 5579 under tests/ui/crashes
Eduardo Broto [Wed, 13 May 2020 18:47:44 +0000 (20:47 +0200)]
Move test for issue 5579 under tests/ui/crashes

4 years agoFix ICE caused in unwrap module
Eduardo Broto [Tue, 12 May 2020 20:05:56 +0000 (22:05 +0200)]
Fix ICE caused in unwrap module

4 years agoRe-add old tests for empty range loops
Eduardo Broto [Mon, 11 May 2020 21:48:48 +0000 (23:48 +0200)]
Re-add old tests for empty range loops

4 years agoRemove reverse_range_loop lint
Eduardo Broto [Sun, 10 May 2020 22:53:31 +0000 (00:53 +0200)]
Remove reverse_range_loop lint

4 years agoNew lint: reversed_empty_ranges
Eduardo Broto [Sun, 10 May 2020 22:52:33 +0000 (00:52 +0200)]
New lint: reversed_empty_ranges

4 years agoAuto merge of #5587 - flip1995:rustup, r=phansch
bors [Wed, 13 May 2020 05:55:10 +0000 (05:55 +0000)]
Auto merge of #5587 - flip1995:rustup, r=phansch

Rustup

Done with

```bash
git subtree push -P src/tools/clippy git@github.com:flip1995/rust-clippy rustup
```

from https://github.com/flip1995/rust/tree/clippyup

A rebase was required to get rid of empty merge commits, that somehow were not empty? :thinking:

changelog: none

4 years agoUpdate failing test
flip1995 [Mon, 11 May 2020 19:40:33 +0000 (21:40 +0200)]
Update failing test

4 years agoRun cargo dev fmt
flip1995 [Mon, 11 May 2020 19:31:01 +0000 (21:31 +0200)]
Run cargo dev fmt

4 years agoFix fallout
flip1995 [Mon, 11 May 2020 19:28:14 +0000 (21:28 +0200)]
Fix fallout

Re-remove util/dev file

4 years agoFix clippy.
Camille GILLOT [Fri, 8 May 2020 11:57:01 +0000 (13:57 +0200)]
Fix clippy.

4 years agoFix nit and cargo.lock
Jack Huey [Thu, 7 May 2020 21:46:31 +0000 (17:46 -0400)]
Fix nit and cargo.lock

4 years agoAuto merge of #5564 - MrAwesome:master, r=flip1995
bors [Sat, 9 May 2020 18:43:28 +0000 (18:43 +0000)]
Auto merge of #5564 - MrAwesome:master, r=flip1995

Allow `use super::*;` glob imports

changelog: Allow super::* glob imports

fixes #5554
fixes #5569

A first pass at #5554 - this allows all `use super::*` to pass, which may or may not be desirable. The original issue was around allowing test modules to import their entire parent modules - I'm happy to modify this to do that instead, may just need some guidance on how to implement that (I played around a bit with #[cfg(test)] but from what I can gather, clippy itself isn't in test mode when running, even if the code in question is being checked for the test target).

4 years agoMove is_test_module check to top of function
Glenn Hope [Sat, 9 May 2020 17:16:47 +0000 (10:16 -0700)]
Move is_test_module check to top of function

4 years agoCheck is_macro inside check_exceptions, update references to fix test
Glenn Hope [Sat, 9 May 2020 17:14:29 +0000 (10:14 -0700)]
Check is_macro inside check_exceptions, update references to fix test

4 years agoFix test from auto-formatter fix
Glenn Hope [Sat, 9 May 2020 15:33:35 +0000 (08:33 -0700)]
Fix test from auto-formatter fix

4 years agoRemove check for Fn, reflect this in test cases, make test cases more robust/explicit
Glenn Hope [Sat, 9 May 2020 15:04:07 +0000 (08:04 -0700)]
Remove check for Fn, reflect this in test cases, make test cases more robust/explicit

4 years agoRemove unnecessary field, check for Mod/Fn ItemKind
Glenn Hope [Sat, 9 May 2020 01:22:27 +0000 (18:22 -0700)]
Remove unnecessary field, check for Mod/Fn ItemKind

4 years agoAlso have flag disable macro check
Glenn Hope [Thu, 7 May 2020 21:48:27 +0000 (14:48 -0700)]
Also have flag disable macro check

4 years agoAdd check for "test" in parent name. Include flag for disabling wildcard import excep...
Glenn Hope [Thu, 7 May 2020 21:41:54 +0000 (14:41 -0700)]
Add check for "test" in parent name. Include flag for disabling wildcard import exceptions

4 years agoCheck if the parent module name contains "test"
Glenn Hope [Thu, 7 May 2020 15:06:30 +0000 (08:06 -0700)]
Check if the parent module name contains "test"

4 years agoRun `cargo dev fmt`
Glenn Hope [Sun, 3 May 2020 18:18:10 +0000 (11:18 -0700)]
Run `cargo dev fmt`

4 years agoAllow 'use super::*;' imports
Glenn Hope [Sun, 3 May 2020 17:56:25 +0000 (10:56 -0700)]
Allow 'use super::*;' imports

4 years agoAuto merge of #5580 - matthiaskrgr:regex_dep, r=flip1995
bors [Sat, 9 May 2020 12:41:19 +0000 (12:41 +0000)]
Auto merge of #5580 - matthiaskrgr:regex_dep, r=flip1995

deps: remove unused regex dependency from root crate

changelog: none

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`]