Commit graph

31 commits

Author SHA1 Message Date
Jason Newcomb
78a750e890 Sort the config list using dev fmt 2024-07-28 00:55:46 -04:00
Alex Macleod
1fff3bef4d Add cargo dev setup toolchain 2024-04-16 18:28:07 +00:00
Kisaragi Marine
aff9c01ab9
address or allow clippy::missing_panics_doc in clippy-dev 2023-06-14 22:27:26 +09:00
Yuri Astrakhan
cc6b375cd3 fallout2: rework clippy_dev & _lints fmt inlining
* Inline format args where possible
* simplify a few complex macros into format str
* use formatdoc!() instead format!(indoc!(...))
2022-09-23 23:08:12 -04:00
Samuel E. Moelius III
032f112745 Fix adjacent code 2022-08-16 18:34:51 -04:00
Serial
1ed7bff32c Tell the user how to revert dev setup intellij 2022-07-28 03:40:21 -04:00
Cameron Steffen
d356fb9fa2 Use rustup which rustfmt 2022-01-10 17:04:38 -06:00
Cameron Steffen
7cf4f44e56 Fix output capturing 2022-01-10 15:11:25 -06:00
Alex Macleod
507030f7c4 Run rustfmt on batches of multiple files 2021-11-12 21:22:09 +00:00
Jason Newcomb
24d561f008 Use rustfmt version from rust-toolchain 2021-11-11 21:14:40 -05:00
xFrednet
3d0984975e
Print cargo dev help on missing arg and updated setup documentation 2021-06-25 11:17:00 +02:00
Cameron Steffen
206bb08d10 Remove rustfmt workaround 2021-06-21 10:50:48 -05:00
Jason Newcomb
12fce55766
Fix all occurences of needless_borrow internally 2021-04-06 10:43:47 -04:00
Matthias Krüger
a62e4263d5 rename cargo dev ra_setup to cargo dev ide_setup 2021-03-17 10:12:45 +01:00
Matthias Krüger
b068b742ee lintcheck: fix --fix and document it in the readme.
also hook lintcheck into clippy-dev so that `clippy dev fmt` formats it.
2021-03-11 15:27:30 +01:00
Philipp Hansch
da26b2149f
clippy_dev: Pass stderr to CommandFailed 2021-01-31 11:21:33 +01:00
Matthias Krüger
27dc565d28 cargo dev: rename ra-setup to ra_setup to be in line with the other commands 2020-12-13 18:52:46 +01:00
Matthias Krüger
91fa25c9de clippy dev fmt: don't format if we have a local rustc repo enabled as path dependency via cargo dev ra-setup.
rustfmt would try to format the entire rustc repo, probably because it sees it as a local dependency.
2020-12-13 18:52:44 +01:00
flip1995
8b9d70d349
Define modules in lib.rs instead of main.rs 2020-03-31 17:24:09 +02:00
Philipp Hansch
3036a2c30e
Move project_root function to clippy_dev/src/lib.rs
This allows us to use the method in both `fmt.rs` and `lib.rs` in
multiple places. The downside is that we panic inside the method now,
instead of using the error handling in `fmt.rs`. We may want to
centralize the error handling for clippy_dev at some point, though.
2020-01-30 21:34:25 +01:00
Philipp Hansch
4d1a11d354
Deprecate util/dev in favor of cargo alias
If you've been using `./util/dev` before, this now becomes `cargo dev`.

The key part of this change is found in `.cargo/config`.

This means one less shell script and a bit more cross-platform support
for contributors.
2020-01-30 21:34:31 +01:00
Shotaro Yamada
d2daf8ecf6 Revert "Workaround cargo bug on Windows"
This reverts commit 248251b3b2.
This reverts commit 20b7351439.
2019-10-08 14:21:05 +09:00
Phil Hansch
8d2912ec00
Rollup merge of #4509 - sinkuu:redundant_clone_fix, r=llogiq
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-04 08:08:58 +02:00
Shotaro Yamada
248251b3b2 Use home::cargo_home 2019-10-04 11:11:40 +09:00
Shotaro Yamada
20b7351439 Workaround cargo bug on Windows 2019-10-04 10:38:52 +09:00
Shotaro Yamada
555f5a49a2 Test fixes 2019-10-03 08:10:29 +09:00
Michael Wright
fd9c5a3c71 Merge branch 'master' into dev-fmt-20190728 2019-08-01 07:02:48 +02:00
Jakub Wieczorek
2a13e83f2b Update all the code to pass the updated use_self lint.
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-31 08:50:43 +00:00
Michael Wright
cc779c8050 dev-fmt: better error handling
Check if rustfmt is installed at the start and exit if it isn't.
2019-07-28 06:41:13 +02:00
Michael Wright
2c90083f62 Avoid rustfmt bug on Windows 2019-07-11 05:21:44 +00:00
Michael Wright
4c771c3478
Add dev fmt subcommand 2019-07-07 15:11:33 +02:00