about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2019-10-04Rollup merge of #4509 - sinkuu:redundant_clone_fix, r=llogiqPhil Hansch-205/+717
Fix false-positive of redundant_clone and move to clippy::perf This PR introduces dataflow analysis to `redundant_clone` lint to filter out borrowed variables, which had been incorrectly detected. Depends on https://github.com/rust-lang/rust/pull/64207. changelog: Moved `redundant_clone` lint to `perf` group # What this lint catches ## `clone`/`to_owned` ```rust let s = String::new(); let t = s.clone(); ``` ```rust // MIR _1 = String::new(); _2 = &_1; _3 = clone(_2); // (*) ``` We can turn this `clone` call into a move if 1. `_2` is the sole borrow of `_1` at the statement `(*)` 2. `_1` is not used hereafter ## `Deref` + type-specific `to_owned` method ```rust let s = std::path::PathBuf::new(); let t = s.to_path_buf(); ``` ```rust // MIR _1 = PathBuf::new(); _2 = &1; _3 = call deref(_2); _4 = _3; // Copies borrow StorageDead(_2); _5 = Path::to_path_buf(_4); // (*) ``` We can turn this `to_path_buf` call into a move if 1. `_3` `_4` are the sole borrow of `_1` at `(*)` 2. `_1` is not used hereafter # What this PR introduces 1. `MaybeStorageLive` that determines whether a local lives at a particular location 2. `PossibleBorrowerVisitor` that constructs [`TransitiveRelation`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_data_structures/transitive_relation/struct.TransitiveRelation.html) of possible borrows, e.g. visiting `_2 = &1; _3 = &_2:` will result in `_3 -> _2 -> _1` relation. Then `_3` and `_2` will be counted as possible borrowers of `_1` in the sole-borrow analysis above.
2019-10-04Auto merge of #4624 - sinkuu:workaround_cargo, r=llogiqbors-3/+14
Workaround cargo issue on appveyor Use absolute paths for `cargo` and `rustfmt` to workaround https://github.com/rust-lang/cargo/issues/7475. Appveyor passed on my fork: https://ci.appveyor.com/project/sinkuu/rust-clippy/builds/27870367 changelog: none
2019-10-04Use home::cargo_homeShotaro Yamada-1/+3
2019-10-04Workaround cargo bug on WindowsShotaro Yamada-3/+12
2019-10-03extern rustc_indexShotaro Yamada-5/+4
2019-10-03Add commentsShotaro Yamada-14/+41
2019-10-03Resolve reviewsShotaro Yamada-14/+12
2019-10-03Apply suggestionShotaro Yamada-2/+1
Co-Authored-By: ecstatic-morse <ecstaticmorse@gmail.com>
2019-10-03Test fixesShotaro Yamada-51/+59
2019-10-03Add run-rustfixShotaro Yamada-97/+241
2019-10-03Fix false-positive of redundant_clone and move to clippy::perfShotaro Yamada-76/+413
2019-10-02Auto merge of #4599 - lzutao:zero-ptr-suggestion, r=flip1995bors-23/+69
Add suggestion for zero-ptr lint changelog: Improve suggestion of `zero_ptr` lint
2019-10-02Auto merge of #4603 - rust-lang:needless-doc-main, r=flip1995bors-12/+55
New lint: needless_doc_main changelog: Add `needless_doc_main` lint
2019-10-02Add suggestion for zero-ptr lintLzu Tao-23/+69
2019-10-02New lint: needless_doc_mainAndre Bogus-12/+55
2019-10-02Auto merge of #4590 - flip1995:ice_4579, r=Manishearthbors-8/+23
Fix ICE #4579 Fixes #4579 Fixes #4584 r? @phansch changelog: Fix ICE caused by Clippys const-utils
2019-10-02Disable hyper and futures-rs integration testsflip1995-4/+4
2019-10-02Fix ICE #4579flip1995-4/+6
2019-10-02Add regression test for ICE #4579flip1995-0/+13
2019-10-01Merge pull request #4606 from Manishearth/rustupManish Goregaokar-75/+2
Fix some tests
2019-10-01Remove tests that only ICE on CIManish Goregaokar-65/+0
2019-10-01Allow const_err in out_of_bounds_indexing testsManish Goregaokar-12/+4
2019-10-01Merge pull request #4604 from Manishearth/rustupManish Goregaokar-8/+10
Rustup to rustc 1.40.0-nightly (702b45e40 2019-10-01)
2019-10-01Use new spans for expansion checking in loop lintsManish Goregaokar-8/+10
2019-09-29Auto merge of #4601 - lzutao:clean-up-unused-vars, r=phanschbors-48/+23
Clean up some unused vars changelog: none
2019-09-29Clean up some unused varsLzu Tao-48/+23
2019-09-29Auto merge of #4600 - lzutao:rustup-63492, r=oli-obkbors-1/+0
Rustup rust-lang/rust#63492 changelog: none
2019-09-29Rustup rust-lang/rust#63492Lzu Tao-1/+0
2019-09-29Auto merge of #4593 - james9909:fix-multiple-inherent-impls, r=llogiqbors-2/+29
Fix false positive in `multiple_inherent_impl` changelog: Fix false positive in `multiple_inherent_impl` by ignoring impls derived from macros. Closes #4578.
2019-09-28Auto merge of #4594 - matthiaskrgr:rustup_18, r=phanschbors-2/+2
rustup https://github.com/rust-lang/rust/pull/64781/ cc https://github.com/rust-lang/rust/issues/64867 changelog: none
2019-09-28rustup https://github.com/rust-lang/rust/pull/64781/Matthias Krüger-2/+2
cc https://github.com/rust-lang/rust/issues/64867
2019-09-27Ignore impls derived from macrosJames Wang-2/+29
2019-09-27Auto merge of #4591 - flip1995:rustup, r=flip1995bors-982/+927
Rustup to rust-lang/rust#64813 cc rust-lang/rust#64843 changelog: none
2019-09-27Remove clippy::author attribute from trailing_zeroes testflip1995-22/+5
2019-09-27Move author issue test to author subdirflip1995-0/+0
2019-09-27Fix author lintflip1995-81/+43
2019-09-27Rustup to rust-lang/rust#64813flip1995-910/+910
2019-09-27Auto merge of #4589 - mikerite:booleans-refactor-20190925, r=phanschbors-8/+4
Refactor `booleans` Remove unused output from `suggest(..)` changelog: none
2019-09-27Refactor `booleans`Michael Wright-8/+4
Remove unused output from `suggest(..)`
2019-09-27Auto merge of #4585 - michaelsproul:arith-assign-op, r=llogiqbors-10/+82
Detect mutating arithmetic in integer_arithmetic restriction lint changelog: detect mutating arithmetic (like +=) in `integer_arithmetic` restriction lint
2019-09-27Detect assignment ops in integer_arithmeticMichael Sproul-10/+82
2019-09-26Auto merge of #4582 - matthiaskrgr:rustup_17, r=Manishearthbors-3/+3
rustup https://github.com/rust-lang/rust/pull/64515 changelog: none
2019-09-26rustup https://github.com/rust-lang/rust/pull/64515Matthias Krüger-3/+3
changelog: none
2019-09-26Auto merge of #4581 - Manishearth:osx-enable, r=matthiaskrgrbors-2/+0
Re enable OSX builders Fixes #4576 changelog: none
2019-09-26Re enable OSX buildersManish Goregaokar-2/+0
Fixes #4576
2019-09-26Auto merge of #4580 - lzutao:rustup, r=flip1995bors-125/+124
Rustup rust-lang/rust#64513 changelog: none
2019-09-26Remove unused importLzu Tao-1/+0
2019-09-26Rustup https://github.com/rust-lang/rust/pull/64513Lzu Tao-124/+124
2019-09-26Auto merge of #4568 - mikerite:fix-4548, r=flip1995bors-55/+102
Fix `nonminimal-bool` false positive Closes #4548 Closes #3847 changelog: Fix `nonminimal-bool` false positive
2019-09-26Auto merge of #4569 - james9909:add-comparison-chain, r=oli-obkbors-107/+362
Add a new lint for comparison chains changelog: Adds a new lint: `comparison_chain`. `comparison_chain` lints all `if` conditional chains where all the conditions are binary comparisons on the same two operands and will suggest a rewrite with `match`. Closes #4531.