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>
3358: Revert "new_ret_no_self: add sample from #3313 to Known Problems section." r=oli-obk a=matthiaskrgr
This reverts commit fd2f6dd382.
Issue #3313 has been fixed.
Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
3331: Disable arithmetic lints in constant items r=oli-obk a=pengowen123
Currently this will not catch cases in associated constants. I'm not sure whether checking spans is the best way to solve this issue, but I don't think it will cause any problems.
Fixes#1858
Co-authored-by: Owen Sanchez <pengowen816@gmail.com>
3346: Add lint for calling `mem::discriminant` on a non-enum type r=flip1995 a=HMPerson1
Also, if the type is a reference to an enum, we suggest removing `&`s and/or dereferencing.
Fixes#3342
Co-authored-by: HMPerson1 <hmperson1@gmail.com>
Co-authored-by: Philipp Krones <hello@philkrones.com>
3356: Fix warnings introduced by #3349 r=flip1995 a=flip1995
I missed these warnings during review, should have checked the Travis log first.
Co-authored-by: flip1995 <hello@philkrones.com>
3338: new_ret_no_self false positives r=flip1995 a=JoshMcguigan
~~WORK IN PROGRESS~~
I plan to fix all of the false positives in #3313 in this PR, but I wanted to open it now to start gathering feedback.
In this first commit, I've updated the lint to allow tuple return types as long as `Self` shows up at least once, in any position of the tuple. I believe this is the broadest possible interpretation of what should be allowed for tuple return types, but I would certainly be okay making the lint more strict.
fixes#3313
Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
3349: Fixes#3347: Lint for wildcard dependencies in Cargo.toml r=ordovicia a=ordovicia
Add a lint for wildcard dependencies in Cargo.toml.
How should I write a test for this lint?
Fixes#3347
Co-authored-by: Hidehito Yabuuchi <hdht.ybuc@gmail.com>
3350: Don't emit `new_without_default_derive` if an impl of Default exists regardless of generics r=oli-obk a=pengowen123
Fixes#2226
Co-authored-by: Owen Sanchez <pengowen816@gmail.com>
3339: Check for known array length in `needless_range_loop` r=phansch a=HMPerson1
In `VarVisitor`, we now keep track of the type of the thing that was directly indexed and, if it's an array, check if the range's end is (or is past) the array's length.
Fixes #3033
Co-authored-by: HMPerson1 <hmperson1@gmail.com>