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>
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#1148Fixes#1628Fixes#2455Fixes#3023Fixes#3333Fixes#3360
Co-authored-by: Jane Lusby <jlusby42@gmail.com>
Co-authored-by: Philipp Hansch <dev@phansch.net>
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>
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
3355: Lint to remove redundant `clone()`s r=oli-obk a=sinkuu
This PR adds lint `redundant_clone`. It suggests to remove redundant `clone()` that clones a owned value that will be dropped without any usage after that.
Real-world example: https://github.com/rust-lang/rust/compare/7b0735a..sinkuu:redundant_clone2
Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
3359: ci: allow all branches except trying.tmp and staging.tmp to be built r=phansch a=matthiaskrgr
r? @flip1995
The problem was that with the current configuration, if I made a branch `feature1` and pushed it to travis to have it checked before making a PR, travis would skip it because it only built the 3 branches that were specified when setting up bors.
The change allows all branch names to be build by default again, except for travis.tmp.
The gh-pages branch is skipped as per travis-ci defaults: https://docs.travis-ci.com/user/customizing-the-build/#safelisting-or-blocklisting-branches
Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
3362: travis: work around temporary test failure due to rustc crashing on hyper r=phansch a=matthiaskrgr
Upstream ticket: https://github.com/rust-lang/rust/issues/55376
Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>