Commit Graph

4933 Commits

Author SHA1 Message Date
flip1995
5c1385249e
Rename test files 2018-11-02 19:50:24 +01:00
flip1995
cadb367a5c
Also lint cfg_attr(.., rustfmt::skip) 2018-11-02 19:50:24 +01:00
flip1995
7df7a0a86e
Add tests from rustfmt::skip test file 2018-11-02 19:50:24 +01:00
flip1995
bb4083c412
Run update_lints.py script 2018-11-02 19:50:23 +01:00
flip1995
352da1d33d
Add test for non-crate-level inner attributes 2018-11-02 19:49:58 +01:00
flip1995
a770d8edd0
Differ between inner and outer attributes 2018-11-02 19:49:58 +01:00
flip1995
7bd8c303d3
Add tests 2018-11-02 19:49:58 +01:00
flip1995
e1cf160e2a
Add cfg_attr(rustfmt) lint 2018-11-02 19:49:57 +01:00
bors[bot]
dc1e409154 Merge #3344
3344: Added lints `into_iter_on_ref` and `into_iter_on_array`. r=phansch a=kennytm

Fixes #1565.

`into_iter_on_array` is a correctness lint against `into_iter()` on `[T; n]` and `PathBuf` (please provide a concise noun that covers both types 🙃).

`into_iter_on_ref` is a style lint against `into_iter()` on `&C` where `C` is `[T]`, `Vec<T>`, `BTreeSet<T>` etc.

Both suggests replacing the `into_iter()` with `iter()` or `iter_mut()`.

`into_iter_on_array` is a correctness lint since it is very likely the standard library would provide an `into_iter()` method for `[T; n]` (rust-lang/rust#25725) and existing type inference of `[a, b, c].into_iter()` will be broken. `PathBuf` is also placed under this lint since `PathBuf::into_iter` currently doesn't exist and it makes some sense to implement `IntoIterator` on it yielding `OsString`s.

Co-authored-by: kennytm <kennytm@gmail.com>
2018-11-02 15:08:38 +00:00
kennytm
5563bd6cc3
Addressed comments. 2018-11-02 22:53:57 +08:00
kennytm
2b2acf1002
Fix dogfood error. 2018-11-02 22:53:57 +08:00
kennytm
2d1c9313b0
Added lints into_iter_on_ref and into_iter_on_array. Fix #1565. 2018-11-02 22:53:56 +08:00
bors[bot]
a8d258454f Merge #3161
3161: New lint: Unknown clippy lints r=phansch a=flip1995

This is the Clippy version of the `rustc` lint `unknown_lints`. The behavior of this lint is pretty much the same.

Before this is merged a small change in the compiler needs to be done: `CheckLintNameResult` needs to be public. See rust-lang/rust#54106

Co-authored-by: flip1995 <9744647+flip1995@users.noreply.github.com>
Co-authored-by: flip1995 <hello@philkrones.com>
2018-11-02 13:17:59 +00:00
flip1995
32396f6e18
Allow single_match_else 2018-11-02 14:00:46 +01:00
flip1995
faa1db3391
Update stderr 2018-11-02 13:49:10 +01:00
flip1995
4e1102f56c
Add copyright statement© 2018-11-02 13:49:10 +01:00
flip1995
014cf3d6e0
Fix typos 2018-11-02 13:49:10 +01:00
flip1995
cf89c40e34
Fix dogfood error 2018-11-02 13:49:10 +01:00
flip1995
ea4a80f215
Fix typo and indentation 2018-11-02 13:49:10 +01:00
flip1995
6819127f1e
run update_lints script 2018-11-02 13:49:10 +01:00
flip1995
8d516b36fe
Add tests for unknwon_clippy_lints lint 2018-11-02 13:49:09 +01:00
flip1995
f6d57862c7
Add new lint: unknwon_clippy_lintsg 2018-11-02 13:49:09 +01:00
bors[bot]
62568923d5 Merge #3402
3402: clippy: fix pedantic warnings and run clippy::pedantic lints on the codebase r=oli-obk a=matthiaskrgr

Turn on pedantic lints in dogfood and base tests.

needless_bool: fix clippy::items-after-statements
redundant_pattern_matching: fix clippy::similar-names
mods.rs: fix clippy::explicit-iter-loop
returns.rs: allow clippy::cast-possible-wrap

Fixes #3172

Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2018-11-02 11:30:03 +00:00
Matthias Krüger
df7cff31dc clippy: fix pedantic warnings and run clippy::pedantic lints on the codebase.
Turn on pedantic lints in dogfood and base tests.

needless_bool: fix clippy::items-after-statements
redundant_pattern_matching: fix clippy::similar-names
mods.rs: fix clippy::explicit-iter-loop
returns.rs: allow clippy::cast-possible-wrap

Fixes #3172
2018-11-02 12:16:43 +01:00
bors[bot]
7c86a9c05c Merge #3387
3387: Replace big if/else expression with match r=flip1995 a=mikerite



Co-authored-by: Michael Wright <mikerite@lavabit.com>
2018-11-02 07:58:00 +00:00
bors[bot]
ae137d526c Merge #3397 #3398
3397: UI test cleanup: Extract expect_fun_call tests r=matthiaskrgr a=phansch

Note that the new stderr file does not include a `shadow-unrelated`
error, because the new UI test file does not use `#![warn(clippy::all)]`

cc #2038 

3398: UI test cleanup: Extract match_overlapping_arm tests r=matthiaskrgr a=phansch

cc #2038

Co-authored-by: Philipp Hansch <dev@phansch.net>
2018-11-02 07:34:38 +00:00
Shotaro Yamada
d4370f8b07 Fix a false-positive of needless_borrow 2018-11-02 15:58:54 +09:00
bors[bot]
0ad5b9b9e0 Merge #3388
3388: RIIR update lints: Generate deprecated lints r=phansch a=phansch

The update script now also generates the 'register_removed' section in
`clippy_lints/src/lib.rs`.

Also, instead of using `let mut store ...`, I added a new identifier
line so that the replacement will continue to work in case `let mut
store ...` ever changes.

cc #2882

Co-authored-by: Philipp Hansch <dev@phansch.net>
2018-11-02 06:29:40 +00:00
Philipp Hansch
e5af43d426
UI test cleanup: Extract match_overlapping_arm tests 2018-11-02 07:19:30 +01:00
Philipp Hansch
26569f3dde
UI test cleanup: Extract expect_fun_call tests
Note that the new stderr file does not include a `shadow-unrelated`
error, because the new UI test file does not use `#![warn(clippy::all)]`
2018-11-02 07:18:56 +01:00
bors[bot]
5172271e70 Merge #3389
3389: ci: when installing rust-toolchain-installer-master, install it in debug mode to save some time on ci. r=phansch a=matthiaskrgr

the compiletime optimizations probably take longer than the speedup we get when executing the optimized binary vs debug build.

Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2018-11-02 05:49:49 +00:00
Maxwell Anderson
b6b97e5c1f format code 2018-11-01 15:43:40 -06:00
Maxwell Anderson
6c1f89e8dc Merge remote-tracking branch 'upstream/master' 2018-11-01 15:26:38 -06:00
Manish Goregaokar
93701b3255
Merge pull request #3395 from phansch/add_missing_coc_file
Add missing code of conduct file
2018-11-01 14:24:36 -07:00
Manish Goregaokar
a20599ab57
Merge pull request #3394 from phansch/rustup
Fix clippy build failure on latest master
2018-11-01 13:57:27 -07:00
Philipp Hansch
f33dd175f3
Add missing code of conduct file
We are already using the Rust code of conduct, this just ticks off an
additional checkbox [here][community].

This version is taken from [rustfmt][rustfmt].

[community]: https://github.com/rust-lang-nursery/rust-clippy/community
[rustfmt]: https://github.com/rust-lang-nursery/rustfmt
2018-11-01 21:31:05 +01:00
Philipp Hansch
beb44ef6ca
Fix clippy build failure on latest master 2018-11-01 20:35:23 +01:00
Maxwell Anderson
02340cc891
fix comment spacing 2018-11-01 12:35:01 -06:00
Michael Wright
0a41dfd946 Use slice patterns instead of padding 2018-11-01 07:06:47 +02:00
Maxwell Anderson
98ce3348d9 change single char str to char 2018-10-31 18:09:56 -06:00
Maxwell Anderson
3c22b2314c Merge remote-tracking branch 'upstream/master' 2018-10-31 16:48:47 -06:00
Maxwell Anderson
f4b919cad7 add lint to lintarray macro 2018-10-31 16:48:24 -06:00
Maxwell Anderson
6b895b8267 Revert "small fix"
This reverts commit b1abc81a60.
2018-10-31 16:39:12 -06:00
bors[bot]
6a165e5a92 Merge #3392
3392: UI test cleanup: Extract for_loop_over_x tests r=matthiaskrgr a=phansch

cc #2038

Co-authored-by: Philipp Hansch <dev@phansch.net>
2018-10-31 21:08:34 +00:00
Philipp Hansch
7e027217f1
Fix dogfood and pedantic lints 2018-10-31 21:54:30 +01:00
bors[bot]
73458aebe3 Merge #3368
3368: added downsides to "known problems" for get_unwrap lint r=flip1995 a=humean

As a beginner I found this lint to be confusing because I was not sure how the `Option` type disappeared as conceptually I know that my `.get()` and Index could fail. Initially I thought maybe the compiler or clippy was smart enough to understand that it was impossible for my `.get()` to fail in this particular case, but it was explained to me that using the Index syntax is just shorthand for directly unwrapping the value:

https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#1547

For beginners or users trying to iterate quickly it seems common to litter your code with `unwrap` or `except` as placeholders for where some explicit error handling might need to take place. I think it should be warned that using Index is merely more concise, but doesn't at all reduce the risk of panics and might in fact cause you to miss handling them in a future refactor.

Co-authored-by: Michael Rutter <michael.john.rutter@gmail.com>
Co-authored-by: Michael Rutter <humean@users.noreply.github.com>
2018-10-31 10:21:51 +00:00
Matthias Krüger
59f4aba5b9 ci: when installing rust-toolchain-installer-master, install it in debug mode to save some time in ci.
the compiletime optimizations probably take longer than the speedup we get when executing the optimized binary vs debug build.
2018-10-31 11:18:20 +01:00
bors[bot]
c8308c92b6 Merge #3378
3378: Fix lint_without_lint_pass r=phansch a=mikerite



Co-authored-by: Michael Wright <mikerite@lavabit.com>
Co-authored-by: flip1995 <hello@philkrones.com>
2018-10-31 07:18:42 +00:00
Philipp Hansch
64bd658516
RIIR update lints: Generate deprecated lints
The update script now also generates the 'register_removed' section in
`clippy_lints/src/lib.rs`.

Also, instead of using `let mut store ...`, I added a new identifier
line so that the replacement will continue to work in case `let mut
store ...` ever changes.
2018-10-31 08:03:50 +01:00
bors[bot]
b144c7f35d Merge #3370
3370: bool_comparison triggers 3 times on same code r=phansch a=mrbuzz

Fix #3335 

Co-authored-by: Giorgio Gambino <gambnio.giorgio@gmail.com>
2018-10-31 06:48:49 +00:00