Commit graph

5640 commits

Author SHA1 Message Date
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
bors[bot]
2362b3a312 Merge #3386
3386: docs: use_self: hightlight the "should be" code sample as rust code as well. r=phansch a=matthiaskrgr



Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2018-10-31 06:03:33 +00:00
Michael Wright
4e054ad320 Replace big if/else expression with match 2018-10-31 06:29:38 +02:00
bors[bot]
e695015caa Merge #3384
3384: make ci use master rustc instead of nightly r=flip1995 a=matthiaskrgr



Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2018-10-31 01:29:36 +00:00
Matthias Krüger
9f722e9759 Revert "travis: work around temporary test failure due to rustc crashing on hyper."
This reverts commit 326270ad12.
2018-10-31 02:01:28 +01:00
Matthias Krüger
9b0f767b43 Revert "appveyor: use rustc nightly instead of master"
This reverts commit 3f01619188.
2018-10-31 02:01:28 +01:00
Matthias Krüger
627ca6b578 Revert "Disable rust master toolchain build temporarily"
This reverts commit 0d899562cd.
2018-10-31 02:01:28 +01:00
Matthias Krüger
650eb09981 docs: use_self: hightlight the "should be" code sample as rust code as well. 2018-10-31 01:42:17 +01:00
Philipp Hansch
b421f5ad48
UI test cleanup: Extract for_loop_over_x tests 2018-10-30 21:25:34 +01:00
Manish Goregaokar
481f7880df
Merge pull request #3382 from rust-lang-nursery/rustup
Rustup to rustc 1.31.0-nightly (fb2446ad5 2018-10-30)
2018-10-30 04:23:18 +00:00
Manish Goregaokar
a06296f836 Rustup to rustc 1.31.0-nightly (fb2446ad5 2018-10-30) 2018-10-30 04:06:37 +00:00
Giorgio Gambino
c0c1f1f7fa Fix #3335 rev2: bool_comparison triggers 3 times on same code 2018-10-29 22:23:45 +01:00
flip1995
3d84ffb5ec
Update .stderr file 2018-10-29 20:55:52 +01:00
flip1995
1e43c3bb9f
Register MISTYPED_LITERAL_SUFFIXES lint 2018-10-29 20:54:21 +01:00
flip1995
a7fc6799df
Rewrite registered lint collection 2018-10-29 20:44:45 +01:00
Michael Wright
267d5d3433
Fix lint_without_lint_pass 2018-10-29 20:28:06 +01:00
bors[bot]
3971c42458 Merge #3380
3380: compiletest: clean rmeta data (from "cargo check") before running compiletest r=phansch a=matthiaskrgr

Fixes #2896
Fixes #2139

Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2018-10-29 11:45:03 +00:00
Matthias Krüger
be7656d992 compiletest: clean rmeta data (from "cargo check") before running compiletest.
Fixes #2896
Fixes #2139
2018-10-29 12:29:40 +01:00
bors[bot]
e2df3e25f2 Merge #3379
3379: dependencies: bump compiletest-rs from git to 0.3.16 r=phansch a=matthiaskrgr



Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2018-10-29 10:44:16 +00:00
Matthias Krüger
53edeacdc0 dependencies: bump compiletest-rs from git to 0.3.16 2018-10-29 09:56:00 +01:00
bors[bot]
00ed70526a Merge #3373
3373: UI test cleanup: Extract unnecessary_operation tests r=matthiaskrgr a=phansch

cc #2038 

Co-authored-by: Philipp Hansch <dev@phansch.net>
2018-10-28 22:52:21 +00:00
bors[bot]
a791bf8c08 Merge #3372
3372: UI test cleanup: Extract explicit_counter_loop tests r=matthiaskrgr a=phansch

cc #2038 

Co-authored-by: Philipp Hansch <dev@phansch.net>
2018-10-28 22:19:11 +00:00
Philipp Hansch
18b122005f
UI test cleanup: Extract explicit_counter_loop tests 2018-10-28 18:56:49 +01:00
Philipp Hansch
7adc8dc956
UI test cleanup: Extract unnecessary_operation tests 2018-10-28 18:40:29 +01:00
bors[bot]
14d2700b6f Merge #3217 #3366
3217: Fix string_lit_as_bytes lint for macros r=phansch a=yaahallo

Prior to this change, string_lit_as_bytes would trigger for constructs
like `include_str!("filename").as_bytes()` and would recommend fixing it
by rewriting as `binclude_str!("filename")`.

This change updates the lint to act as an EarlyLintPass lint. It then
differentiates between string literals and macros that have bytes
yielding alternatives.

Closes #3205

3366: Don't expand macros in some suggestions r=oli-obk a=phansch

Fixes #1148 
Fixes #1628
Fixes #2455
Fixes #3023
Fixes #3333
Fixes #3360

Co-authored-by: Jane Lusby <jlusby42@gmail.com>
Co-authored-by: Philipp Hansch <dev@phansch.net>
2018-10-28 17:13:34 +00:00
bors[bot]
6ce5edcdd5 Merge #3364
3364: simplify ci scripts r=phansch a=matthiaskrgr

This makes it easier to flip the switch on pedantic lints on the clippy codebase.

Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2018-10-28 16:54:09 +00:00
Philipp Hansch
1652393a47
Merge pull request #3371 from matthiaskrgr/temp_breakage_fix
merge various PRs to make CI green again
2018-10-28 17:51:09 +01:00
Matthias Krüger
3f01619188 appveyor: use rustc nightly instead of master 2018-10-28 17:14:39 +01:00
Matthias Krüger
261fe249e7 Merge branch 'compiletest' into temp_breakage_fix 2018-10-28 16:56:57 +01:00
Matthias Krüger
349697531f pin compiletest dependency to git version (12c980f47971b5ba6beb7cb2ffebf8b32f6766ea) while we are waiting for a new release 2018-10-28 16:56:33 +01:00
Matthias Krüger
9a1bb7bcf8 Merge remote-tracking branch 'phansch/disable_master_build' into temp_breakage_fix 2018-10-28 16:55:33 +01:00
Giorgio Gambino
62f16803e8 Fix #3335 rev1: bool_comparison triggers 3 times on same code 2018-10-28 16:28:17 +01:00
Giorgio Gambino
7cfde9cfa9 Fix #3335: bool_comparison triggers 3 times on same code 2018-10-28 15:37:39 +01:00
Matthias Krüger
6eb1f23555 rustup: fix build with rustc 1.31.0-nightly (cae6efc37 2018-10-27) 2018-10-28 13:56:50 +01:00
Michael Rutter
232a483331
more consistent use of terminology; trait > syntax 2018-10-28 12:31:02 +00:00
Michael Rutter
061a48321c added downsides to "known problems" for get_unwrap lint 2018-10-28 08:12:47 +00:00
Philipp Hansch
0d899562cd
Disable rust master toolchain build temporarily 2018-10-28 08:11:18 +01:00
Maxwell Anderson
183e19a1c3 Merge remote-tracking branch 'upstream/master' 2018-10-27 12:50:12 -06:00
Philipp Hansch
840e50e97f
Don't expand macro in or_fun_call suggestion 2018-10-27 15:47:56 +02:00
Philipp Hansch
af1548f58f
Don't expand macro in single_match suggestion 2018-10-27 15:47:56 +02:00
Philipp Hansch
aa7bcb9074
Don't expand macro in identity_conversion suggestion 2018-10-27 15:47:56 +02:00
Matthias Krüger
a90084d587 slightly simplify integration tests 2018-10-27 10:54:46 +02:00
Matthias Krüger
d6ca12a70d simplify ci base-tests 2018-10-26 20:00:43 +02:00
Jane Lusby
19ac2e94c6 fix: correctly reconstruct raw strings 2018-10-26 09:12:01 -07:00
Jane Lusby
f9020bb2dd fix: extra semicolon, only create callsite once 2018-10-26 09:12:01 -07:00
Jane Lusby
c209fc9349 Fix string_lit_as_bytes lint for macros
Prior to this change, string_lit_as_bytes would trigger for constructs
like `include_str!("filename").as_bytes()` and would recommend fixing it
by rewriting as `binclude_str!("filename")`.

This change updates the lint to act as an EarlyLintPass lint. It then
differentiates between string literals and macros that have bytes
yielding alternatives.

Closes #3205
2018-10-26 09:12:01 -07:00