about summary refs log tree commit diff
path: root/clippy_dev/src
AgeCommit message (Collapse)AuthorLines
2019-10-04Rollup merge of #4509 - sinkuu:redundant_clone_fix, r=llogiqPhil Hansch-4/+1
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-04Use home::cargo_homeShotaro Yamada-1/+1
2019-10-04Workaround cargo bug on WindowsShotaro Yamada-3/+12
2019-10-03Test fixesShotaro Yamada-4/+1
2019-08-19Add option_and_then_some lintLzu Tao-3/+3
2019-08-12Update lint deprecation for tool lintsPhilipp Hansch-3/+3
Our lint deprecation previously didn't work for tool lints, because `register_removed` was registering lints to be removed _without_ the `clippy` prefix.
2019-08-01Merge branch 'master' into dev-fmt-20190728Michael Wright-2/+2
2019-07-31Update all the code to pass the updated `use_self` lint.Jakub Wieczorek-2/+2
One struct required a temporary `#[allow(dead_code)]` annotation due to a bug in the Rust compiler: https://github.com/rust-lang/rust/issues/63151.
2019-07-28dev-fmt: better error handlingMichael Wright-0/+29
Check if rustfmt is installed at the start and exit if it isn't.
2019-07-17Decrease maximum length for stderr filesPhilipp Hansch-1/+1
Now at 275.
2019-07-11Avoid rustfmt bug on WindowsMichael Wright-1/+5
2019-07-07Fix crash on `dev --limit-stderr-length`Michael Wright-1/+1
2019-07-07Add dev fmt subcommandMichael Wright-18/+208
2019-06-14Use replace_region_in_file for creating the lint listflip1995-16/+17
2019-06-12make it pass dogfoodJane Lusby-2/+2
2019-06-12run rustfmtJane Lusby-1/+1
2019-06-12fix padding and put clippy someplacesJane Lusby-0/+1
2019-06-12show default lint levelsJane Lusby-0/+1
2019-06-12prelim arg parseJane Lusby-2/+2
2019-06-12move Lint static def into its own moduleJane Lusby-10/+3
2019-06-12switch to sorted usable lintsJane Lusby-5/+10
2019-06-12Update clippy_dev/src/main.rsJane Lusby-1/+1
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2019-06-12initial commit for help improvements on clippy-driverJane Lusby-0/+22
2019-05-17Collect at callsite, use eprintln instead of printlnPhilipp Hansch-4/+3
2019-05-16Add a stderr file length check to clippy_devPhilipp Hansch-2/+65
This adds a check to `clippy_dev` that enforces a maximum line count for `stderr` files. CI will fail if the line count is exceeded. It's currently set to `320` lines. Ideally this would be implemented in `compiletest-rs` but there are plans to move Rust's `compiletest` into the `compiletest-rs` repository and I don't want to do the work in `compiletest` twice. However, I also don't want to wait until the move is done, so I added the check to `clippy_dev` until it makes sense to add it to compiletest-rs. cc #2038
2019-04-15Remove clippy::default_hash_types internal lintflip1995-2/+0
2019-03-10Various cosmetic improvements.Alexander Regueiro-2/+2
2019-03-08Improve Clippy dev helpMichael Wright-2/+4
+ Print help if no subcommand is supplied + Make a short version of `update_lints` help for the subcommand listing
2019-03-05move lint documentation into macro invocationsAndy Russell-3/+5
2019-02-10removing redundant closures in the whole projectGrzegorz-2/+2
2019-01-25dependencies: update itertools from 0.7 to 0.8Matthias Krüger-10/+15
2019-01-08Remove all copyright license headersPhilipp Hansch-18/+0
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498
2018-12-25fix a couple of ftrivial typos (NFC).Matthias Krüger-2/+2
2018-11-27Run rustfmt on clippy_devflip1995-115/+181
2018-11-22rust-lang-nursery/rust-clippy => rust-lang/rust-clippyMatthias Krüger-3/+3
2018-11-05Fix dogfoodPhilipp Hansch-10/+10
2018-11-05Update println! formattingPhilipp Krones-1/+1
Co-Authored-By: phansch <dev@phansch.net>
2018-11-05Fix false positive in check mode caused by `gen_deprecated`Philipp Hansch-39/+50
`gen_deprecated` should never have created the string with linebreaks. Using a single string broke the check because the changed lines were different.
2018-11-05RIIR update lints: Add check mode (update_lints.py rewrite complete)Philipp Hansch-32/+68
This finishes up the rewrite of `update_lints.py` in Rust. More specifically, this * adds the `--check` flag and handling to clippy_dev * tracks file changes over the different calls to `replace_region_in_file` * only writes changes to files if the `--check` flag is *not* used * runs `./util/dev update_lints --check` on CI instead of the old script * replaces usage of the `update_lints.py` script with an error `./util/dev update_lints` behaves 99% the same as the python script. The only difference that I'm aware of is an ordering change to `clippy_lints/src/lib.rs` because underscores seem to be sorted differently in Rust and in Python. :checkered_flag:
2018-11-03Merge #3399bors[bot]-4/+109
3399: RIIR update lints: Generate modules section and lint group sections r=flip1995 a=phansch This adds the last missing parts of the generating code. cc #2882 Co-authored-by: Philipp Hansch <dev@phansch.net>
2018-11-03Fix typoPhilipp Hansch-1/+1
2018-11-03Improve clippy_dev help textPhilipp Hansch-2/+7
2018-11-03RIIR update lints: Generate lint group registrationsPhilipp Hansch-0/+58
2018-11-03Test clippy_dev on CI and fix testPhilipp Hansch-3/+3
2018-11-03RIIR update lints: Generate modules sectionPhilipp Hansch-2/+44
2018-11-02clippy: fix pedantic warnings and run clippy::pedantic lints on the codebase.Matthias Krüger-1/+0
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-10-31Fix dogfood and pedantic lintsPhilipp Hansch-19/+21
2018-10-31RIIR update lints: Generate deprecated lintsPhilipp Hansch-0/+41
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-17RIIR update_lints: Update changelog linksPhilipp Hansch-3/+41
This now also updates the link list at the bottom of the changelog.
2018-10-16Fix dogfoodPhilipp Hansch-1/+2
`expect_fun_call` causes a false-positive, so I disabled it for now.