Commit graph

8388 commits

Author SHA1 Message Date
rail
75ad839cd2 Do not trigger manual_memcpy for RangeTo 2020-04-27 18:04:37 +12:00
rail
37261a904c Print 0 when end and offset is 0, and also simplify the suggestion 2020-04-27 17:51:01 +12:00
rail
ad9ad6f402 Don't negate resulted offsets when offset is subtraction by 0 2020-04-27 17:42:57 +12:00
bors
5d8a3e8724 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
2020-04-27 02:29:49 +00:00
Eduardo Broto
303e7d1af8 Split tests in unix/non-unix 2020-04-26 21:27:29 +02:00
Eduardo Broto
4a405c9977 Remove some OSes from the test to comply with stderr line limit 2020-04-26 21:27:29 +02:00
Eduardo Broto
ce50e42ed6 Use the span of the attribute for the error message 2020-04-26 21:27:29 +02:00
Eduardo Broto
d24a106395 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
2020-04-26 21:27:29 +02:00
Eduardo Broto
149f6d6046 Implement mismatched_target_os lint 2020-04-26 21:27:29 +02:00
bors
87a6f3fc2c 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
2020-04-26 14:44:08 +00:00
bors
5c12f2b286 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
2020-04-26 12:30:52 +00:00
Philipp Hansch
eda73fe707
Fix cargo crash 2020-04-26 14:11:58 +02:00
Philipp Hansch
8d596ea01c
Remove util/dev script
`cargo dev` has been the replacement for a while, so I think we can
remove it now.

cc #5394
2020-04-26 14:00:03 +02:00
Philipp Hansch
0a49935270
cargo dev fmt 2020-04-26 13:44:08 +02:00
Philipp Hansch
0480ff861a
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
2020-04-26 13:44:08 +02:00
bors
b7c802b5e3 Auto merge of #5533 - phansch:rustup001, r=matthiaskrgr
rustup to https://github.com/rust-lang/rust/pull/70043

changelog: none
2020-04-26 11:26:15 +00:00
Philipp Hansch
5b1622b324
rustup to https://github.com/rust-lang/rust/pull/70043 2020-04-26 10:12:14 +02:00
bors
07dd5fada9 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.
2020-04-25 21:41:56 +00:00
bors
44eb953adc 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`]
2020-04-25 21:29:03 +00:00
bors
a76bfd46c5 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
2020-04-25 21:16:06 +00:00
Eduardo Broto
806d973adc map_clone: avoid suggesting copied() for &mut 2020-04-25 22:52:19 +02:00
Aleksei Latyshev
69fe6b4c98
fix redundant_pattern_matching lint
- now it gives correct suggestion in case of macros
- better tests
- remove a couple of non-relevant tests
2020-04-25 23:51:30 +03:00
bors
77c23b7089 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
2020-04-25 19:38:04 +00:00
Philipp Krones
9b882bab26
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
2020-04-25 21:06:31 +02:00
Philipp Krones
abbc618d00
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
2020-04-25 21:06:30 +02:00
Philipp Krones
e39550e45e
Rollup merge of #5516 - flip1995:doc_release, r=phansch
Add a note to the beta sections of release.md

changelog: none
2020-04-25 21:06:28 +02:00
Philipp Krones
a33d64a4c3
Rollup merge of #5505 - flip1995:avoid_running_lints, r=matthiaskrgr
Avoid running cargo+internal lints when not enabled

r? @matthiaskrgr

changelog: none
2020-04-25 21:06:27 +02:00
Philipp Krones
e1d13c34b0
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
2020-04-25 21:06:26 +02:00
flip1995
a1826222cf
Add tests for #1654 2020-04-25 20:51:23 +02:00
flip1995
eadd9d24dc
Don't trigger while_let_on_iterator when the iterator is recreated every iteration 2020-04-25 20:51:02 +02:00
bors
6ffe725bbc 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
2020-04-25 18:18:32 +00:00
flip1995
dda1c8d8af
Update issue_2356.stderr reference file 2020-04-25 20:11:15 +02:00
flip1995
44511d5ee6
Update while_let_on_iterator tests 2020-04-25 20:11:15 +02:00
flip1995
fe25dbe549
Fix while_let_on_iterator suggestion and make it MachineApplicable 2020-04-25 20:00:00 +02:00
Philipp Hansch
bf73d51959
Add lifetime test case for new_ret_no_self 2020-04-25 10:43:41 +02:00
Matthias Krüger
f9c1acbc45
rustup https://github.com/rust-lang/rust/pull/71215/ 2020-04-24 15:29:31 +02:00
David Tolnay
ef28361293
Downgrade match_bool to pedantic 2020-04-23 16:30:06 -07:00
flip1995
451badeddf
Run fetch before testing if master contains beta 2020-04-23 23:25:35 +02:00
flip1995
c19ca0e8a8
The beta branch update should not require a force push 2020-04-23 23:25:35 +02:00
flip1995
4619bb243d
Add a note to the beta sections of release.md 2020-04-23 23:25:35 +02:00
bors
02c94352d4 Auto merge of #5513 - matthiaskrgr:reg, r=phansch
fix clippy_dev exit status and make regex match again

changelog: none

Fixes #5510

r? @phansch
2020-04-23 20:56:15 +00:00
flip1995
0476e8b483
Remove apt-get upgrade again 2020-04-23 21:14:45 +02:00
flip1995
35ef280b55
Always use the deploy script and templates of the master branch 2020-04-23 21:14:35 +02:00
bors
a609a9eb79 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
2020-04-23 18:35:22 +00:00
Matthias Krüger
081641249e 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.
2020-04-23 16:11:18 +02:00
Matthias Krüger
d021d3ef88 clippy_dev: make it fatal when the regex for updating lint count does not match
Fixes #5510
2020-04-23 16:11:11 +02:00
bors
d01a49810b Auto merge of #5508 - lzutao:rustup-71044, r=phansch
Rustup "Remove `BodyAndCache`"

cc https://github.com/rust-lang/rust/pull/71044
changelog: none
2020-04-23 05:08:29 +00:00
lzutao
3f6f392730 predecessors_for will be removed soon
Co-Authored-By: ecstatic-morse <ecstaticmorse@gmail.com>
2020-04-23 09:09:09 +07:00
Lzu Tao
9ef9b7946f Rustup "Remove BodyAndCache" 2020-04-23 08:39:35 +07:00
flip1995
f31502f4bb
Only run (late) internal lints, when they are warn/deny/forbid 2020-04-22 20:51:58 +02:00