Commit Graph

4933 Commits

Author SHA1 Message Date
Wayne Warren
67c32eb2c4 Update trivially_copy_pass_by_ref with Trait examples 2018-11-21 07:52:02 -06:00
Wayne Warren
4450b3e47a Fix awkward wording 2018-11-21 07:16:03 -06:00
Wayne Warren
30b3bc8d80 Document how to lint local Clippy changes with locally built Clippy 2018-11-21 07:12:00 -06:00
bors[bot]
70ca052397 Merge #3441
3441: rustup https://github.com/rust-lang/rust/pull/52591 r=flip1995 a=matthiaskrgr



Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2018-11-21 12:42:57 +00:00
Oliver Scherer
617d861041 Enable rustup clippy to refer to the correct documentation 2018-11-21 13:33:42 +01:00
Matthias Krüger
4aae76464c rustup https://github.com/rust-lang/rust/pull/52591 2018-11-21 13:29:23 +01:00
David Tolnay
e4be2b4e64
Downgrade needless_pass_by_value to allow by default
I noticed that I suppress this lint in many of my projects.

https://github.com/search?q=needless_pass_by_value+user%3Adtolnay&type=Code
https://github.com/search?q=needless_pass_by_value+user%3Aserde-rs&type=Code

Upon further inspection, this lint has a *long* history of false
positives (and several remaining).

Generally I feel that this lint is the definition of pedantic and should
not be linted by default.

    #[derive(Debug)]
    enum How {
        ThisWay,
        ThatWay,
    }

    // Are we really better off forcing the call sites to write f(&_)...?
    fn f(how: How) {
        println!("You want to do it {:?}", how);
    }

    fn main() {
        f(How::ThatWay);
    }
2018-11-21 03:11:22 -08:00
bors[bot]
64ff255ac6 Merge #3432
3432: match_ref_pats: don't emit suggestions inside of a macro r=Manishearth a=flip1995

Fixes #2636 

Co-authored-by: flip1995 <hello@philkrones.com>
2018-11-19 21:07:49 +00:00
bors[bot]
0abbc38730 Merge #3435
3435: remove unused allow() attributes, NFC r=flip1995 a=matthiaskrgr



Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2018-11-17 15:24:10 +00:00
Matthias Krüger
3a11cd4289 remove unused allow() attributes, NFC 2018-11-17 13:47:46 +01:00
bors[bot]
f5d868c9ed Merge #3431
3431: rustup https://github.com/rust-lang/rust/pull/55852/ r=flip1995 a=matthiaskrgr



Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2018-11-15 16:10:48 +00:00
flip1995
655a2b4709
Add regression test 2018-11-15 17:06:36 +01:00
flip1995
1000fc5120
Don't emit suggestion when inside of a macro 2018-11-15 17:03:17 +01:00
Matthias Krüger
2d0d41ff29 rustup https://github.com/rust-lang/rust/pull/55852/ 2018-11-15 16:50:28 +01:00
bors[bot]
a2c9d10da5 Merge #3419
3419: Linter to check that all common metadata is included r=flip1995 a=ysimonson

Addresses https://github.com/rust-lang-nursery/rust-clippy/issues/1793

This is not ready to be merged yet. First the associated changes to `cargo_metadata` need to be merged: https://github.com/oli-obk/cargo_metadata/pull/55

Co-authored-by: Yusuf Simonson <simonson@gmail.com>
2018-11-15 14:18:12 +00:00
bors[bot]
7e0ddef4e7 Merge #3428
3428: Typo "too" -> "foo" in format.rs r=matthiaskrgr a=ama0



Co-authored-by: Anton <ama0@users.noreply.github.com>
2018-11-14 13:24:45 +00:00
Anton
93324f1acf
Fix "too" -> "foo" typo in format.rs 2018-11-14 14:08:52 +01:00
bors[bot]
973e70cef7 Merge #3427
3427: Fix wrong suggestion for `redundant_closure_call` r=oli-obk a=mikerite

Fixes #1684

Co-authored-by: Michael Wright <mikerite@lavabit.com>
2018-11-14 08:57:32 +00:00
Michael Wright
3ba4c3a9b1 Fix use_self violation 2018-11-14 08:43:35 +02:00
Michael Wright
e2e892b59b Fix wrong suggestion for redundant_closure_call
Fixes #1684
2018-11-14 08:01:39 +02:00
Yusuf Simonson
866caabb7a Check for common metadata 2018-11-13 08:43:30 -05:00
bors[bot]
6cc502dda0 Merge #3426
3426: Fix `use_self` false positive on `use` statements r=flip1995 a=mikerite

Fixes #3425 

Co-authored-by: Michael Wright <mikerite@lavabit.com>
2018-11-13 12:57:20 +00:00
Michael Wright
5ade9ff44e Fix use_self false positive on use statements 2018-11-13 06:15:33 +02:00
bors[bot]
82044946cd Merge #3423
3423: Fix `use_self` false positive r=flip1995 a=mikerite

This fixes the first error reported in issue #3410.

Co-authored-by: Michael Wright <mikerite@lavabit.com>
2018-11-10 13:16:35 +00:00
Michael Wright
460c2b317b Fix use_self false positive
This fixes the first error reported in issue #3410.
2018-11-10 10:57:11 +02:00
bors[bot]
3bb88775de Merge #3407
3407: Fix `possible_missing_comma` false positives r=oli-obk a=mikerite

`possible_missing_comma` should only trigger when the binary operator has
unary equivalent. Otherwise, it's not possible to insert a comma without
breaking compilation. The operators identified were `+`, `&`, `*` and `-`.

This fixes the specific examples given in issues #3244 and #3396
but doesn't address the conflict this lint has with the style of starting
a line with a binary operator.

Co-authored-by: Michael Wright <mikerite@lavabit.com>
2018-11-07 07:16:43 +00:00
Michael Wright
c20e17f8ee Remove + from has_unary_equivalent
Rust doesn't has a unary + operator!
2018-11-06 07:05:13 +02:00
Michael Wright
2353f24095 Merge branch 'master' into fix-missing-comma-fp 2018-11-06 07:00:54 +02:00
bors[bot]
4c3408c61d Merge #3408
3408: RIIR update lints: Add check mode (update_lints.py rewrite complete) r=oli-obk a=phansch

This finishes up the rewrite of `update_lints.py` in Rust. More
specifically, this

* adds the `--check` flag and handling to clippy_dev
* tracks file changes over the different calls to `replace_region_in_file`
* only writes changes to files if the `--check` flag is *not* used
* runs `./util/dev update_lints --check` on CI instead of the old script
* replaces usage of the `update_lints.py` script with an error

`./util/dev update_lints` behaves 99% the same as the python script.
The only difference that I'm aware of is an ordering change to
`clippy_lints/src/lib.rs` because underscores seem to be sorted
differently in Rust and in Python.

🏁

cc #2882 

Co-authored-by: Philipp Hansch <dev@phansch.net>
Co-authored-by: Philipp Krones <hello@philkrones.com>
2018-11-05 09:02:11 +00:00
Philipp Hansch
745a619657
Fix dogfood 2018-11-05 07:18:47 +01:00
Philipp Krones
5b24f23020
Update println! formatting
Co-Authored-By: phansch <dev@phansch.net>
2018-11-05 07:18:47 +01:00
Philipp Hansch
f6194f33d2
Fix false positive in check mode caused by gen_deprecated
`gen_deprecated` should never have created the string with linebreaks.

Using a single string broke the check because the changed lines were
different.
2018-11-05 07:18:47 +01:00
Philipp Hansch
90f31e21ab
RIIR update lints: Add check mode (update_lints.py rewrite complete)
This finishes up the rewrite of `update_lints.py` in Rust. More
specifically, this

* adds the `--check` flag and handling to clippy_dev
* tracks file changes over the different calls to `replace_region_in_file`
* only writes changes to files if the `--check` flag is *not* used
* runs `./util/dev update_lints --check` on CI instead of the old script
* replaces usage of the `update_lints.py` script with an error

`./util/dev update_lints` behaves 99% the same as the python script.
The only difference that I'm aware of is an ordering change to
`clippy_lints/src/lib.rs` because underscores seem to be sorted
differently in Rust and in Python.

🏁
2018-11-05 07:18:47 +01:00
bors[bot]
7e417d4cbd Merge #3353
3353: float support added for mistyped_literal_suffixes lint r=mikerite a=Maxgy

I implemented the mistyped_literal_suffixes lint for float literals.

```
#![allow(unused_variables)]

fn main() {
    let x = 1E2_32;
    let x = 75.22_64;
}
```
Given the above, the additional check suggests the variables to be written as `let x = 1E2_f32` and `let x = 75.22_f64`.

Fixes #3167 

Co-authored-by: Maxwell Anderson <maxwell.brayden.anderson@gmail.com>
2018-11-05 03:58:15 +00:00
bors[bot]
d8b426901a Merge #3411
3411: rustup https://github.com/rust-lang/rust/pull/55665 (pass contexts by reference) r=matthiaskrgr a=matthiaskrgr



Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2018-11-04 22:22:03 +00:00
Matthias Krüger
396701613e rustup https://github.com/rust-lang/rust/pull/55665 (pass contexts by reference) 2018-11-04 22:47:20 +01:00
Maxwell Anderson
3e0de1745d changed into_iter to iter and fixed a lint check 2018-11-04 10:39:54 -07:00
Michael Wright
a3ab512576 Fix collapsible_if error 2018-11-04 10:48:24 +02:00
Michael Wright
0c1ffc1d1f Fix possible_missing_comma false positives
`possible_missing_comma` should only trigger when the binary operator has
unary equivalent. Otherwise, it's not possible to insert a comma without
breaking compilation. The operators identified were `+`, `&`, `*` and `-`.

This fixes the specific examples given in issues #3244 and #3396
but doesn't address the conflict this lint has with the style of starting
a line with a binary operator.
2018-11-04 10:02:49 +02:00
bors[bot]
a07c271559 Merge #3399
3399: RIIR update lints: Generate modules section and lint group sections r=flip1995 a=phansch

This adds the last missing parts of the generating code.

cc #2882

Co-authored-by: Philipp Hansch <dev@phansch.net>
2018-11-03 19:11:35 +00:00
Philipp Hansch
71ec4ff636
Merge pull request #3404 from matthiaskrgr/rustup
rustup https://github.com/rust-lang/rust/pull/55330/
2018-11-03 20:06:48 +01:00
Matthias Krüger
b59b60c8ae rustup https://github.com/rust-lang/rust/pull/55330/ 2018-11-03 18:50:23 +01:00
Philipp Hansch
facfb5a7a9
Fix typo 2018-11-03 18:48:39 +01:00
Philipp Hansch
cca50701d9
Improve clippy_dev help text 2018-11-03 13:43:35 +01:00
Philipp Hansch
4f38538d75
RIIR update lints: Generate lint group registrations 2018-11-03 13:43:35 +01:00
Philipp Hansch
6e3320c7ef
Test clippy_dev on CI and fix test 2018-11-03 10:58:45 +01:00
bors[bot]
486300b89d Merge #3400
3400: Fix a false-positive of needless_borrow r=phansch a=sinkuu



Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
2018-11-03 08:34:13 +00:00
bors[bot]
ebcea405f3 Merge #3123
3123: Lint #[cfg_attr(rustfmt, rustfmt_skip)] and suggest #[rustfmt::skip] r=phansch a=flip1995

Closes #3121 

Co-authored-by: flip1995 <9744647+flip1995@users.noreply.github.com>
Co-authored-by: flip1995 <hello@philkrones.com>
2018-11-03 08:12:10 +00:00
Philipp Hansch
5fc25d30e2
RIIR update lints: Generate modules section 2018-11-03 09:09:34 +01:00
flip1995
318f84ffcf
Update stderr 2018-11-02 19:50:24 +01:00