Commit graph

6911 commits

Author SHA1 Message Date
bors
54bf4ffd62 Auto merge of #4613 - Lythenas:lint-assert_eq-unit_exprs, r=flip1995
Add check for assert_eq macros to unit_cmp lint

changelog: Add check for unit comparisons through `assert_eq!`, `debug_assert_eq!`, `assert_ne!` and `debug_assert_ne!` macros to unit_cmp lint.

fixes #4481
2019-10-04 10:27:44 +00:00
bors
933df2ab8e Auto merge of #4621 - JohnTitor:fix-windows, r=phansch
Use windows-sdk-10.1 to avoid installation failure

This fixes installation failure on Windows on Travis but we need to fix rustfmt issue first to pass the CI completely.

changelog: none
2019-10-04 09:35:54 +00:00
bors
249b6cac3e Auto merge of #4625 - phansch:rollup-qp7ki0h, r=phansch
Rollup of 2 pull requests

Successful merges:

 - #4509 (Fix false-positive of redundant_clone and move to clippy::perf)
 - #4614 (Allow casts from the result of `abs` to unsigned)

Failed merges:

changelog: none

r? @ghost
2019-10-04 06:45:04 +00:00
bors
c926f1b571 Auto merge of #4622 - Lythenas:fix-doc-formatting-for-mistyped-literal-suffixes, r=phansch
Correctly align doc of mistyped literal suffixes

changelog: Fix misaligned markdown list in doc of `mistyped_literal_suffixes`
2019-10-04 06:13:47 +00:00
Phil Hansch
19c58d260b
Rollup merge of #4614 - HMPerson1:abs_cast_unsigned, r=flip1995
Allow casts from the result of `abs` to unsigned

changelog: Allow casts from the result of `abs` to unsigned in `cast_sign_loss`

Fixes #4605
2019-10-04 08:08:59 +02: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
bors
b824f021d6 Auto merge of #4624 - sinkuu:workaround_cargo, r=llogiq
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-04 05:42:25 +00: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
Matthias Seiffert
e333ed0d53 Correctly align doc of mistyped literal suffixes 2019-10-03 22:14:32 +02:00
Yuki Okushi
2af1995696 Use windows-sdk-10.1 to avoid installation failure 2019-10-04 04:42:46 +09:00
Matthias Seiffert
5a0a2b383c Remove assert_ne example from doc 2019-10-03 19:53:41 +02:00
Matthias Seiffert
024dfee33c Update unit_cmp tests to include blocks for asserts 2019-10-03 14:38:04 +02:00
Matthias Seiffert
fb25d56799 Mention asserts in doc for unit_cmp lint 2019-10-03 14:35:05 +02:00
Matthias Seiffert
320d17aa63 Update the .stderr to include the backticks 2019-10-03 12:01:02 +02:00
Matthias Seiffert
288f02da44
Print assert macro name in backticks
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2019-10-03 11:43:39 +02:00
Shotaro Yamada
4cded6d901 extern rustc_index 2019-10-03 08:27:47 +09:00
Shotaro Yamada
866729f5db Add comments 2019-10-03 08:10:29 +09:00
Shotaro Yamada
1cee3fe00e Resolve reviews 2019-10-03 08:10:29 +09:00
Shotaro Yamada
a3f403aa50 Apply suggestion
Co-Authored-By: ecstatic-morse <ecstaticmorse@gmail.com>
2019-10-03 08:10:29 +09:00
Shotaro Yamada
555f5a49a2 Test fixes 2019-10-03 08:10:29 +09:00
Shotaro Yamada
667223c35d Add run-rustfix 2019-10-03 08:10:29 +09:00
Shotaro Yamada
301ef6bb2a Fix false-positive of redundant_clone and move to clippy::perf 2019-10-03 08:10:29 +09:00
HMPerson1
0e1dd65c14
Allow casts from the result of abs to unsigned 2019-10-02 17:23:54 -04:00
Matthias Seiffert
3557084b01 Add check for assert_eq macros to unit_cmp lint 2019-10-02 22:48:19 +02:00
bors
737f0a6bb5 Auto merge of #4599 - lzutao:zero-ptr-suggestion, r=flip1995
Add suggestion for zero-ptr lint

changelog: Improve suggestion of `zero_ptr` lint
2019-10-02 17:16:29 +00:00
bors
844765c8a5 Auto merge of #4603 - rust-lang:needless-doc-main, r=flip1995
New lint: needless_doc_main

changelog: Add `needless_doc_main` lint
2019-10-02 15:51:58 +00:00
Lzu Tao
6b1a8683f4 Add suggestion for zero-ptr lint 2019-10-02 22:38:00 +07:00
Andre Bogus
23a9c02120 New lint: needless_doc_main 2019-10-02 17:17:22 +02:00
bors
83f90aaedf Auto merge of #4590 - flip1995:ice_4579, r=Manishearth
Fix ICE #4579

Fixes #4579
Fixes #4584

r? @phansch

changelog: Fix ICE caused by Clippys const-utils
2019-10-02 08:56:56 +00:00
flip1995
eb1fc7b3fd
Disable hyper and futures-rs integration tests 2019-10-02 10:55:52 +02:00
flip1995
93bda4876a
Fix ICE #4579 2019-10-02 09:39:04 +02:00
flip1995
87db6bb1e3
Add regression test for ICE #4579 2019-10-02 09:39:04 +02:00
Manish Goregaokar
648e5b90b4
Merge pull request #4606 from Manishearth/rustup
Fix some tests
2019-10-01 17:53:14 -07:00
Manish Goregaokar
4318854bfc Remove tests that only ICE on CI 2019-10-01 16:45:07 -07:00
Manish Goregaokar
f513aa3a05 Allow const_err in out_of_bounds_indexing tests 2019-10-01 16:37:22 -07:00
Manish Goregaokar
b462905cc9
Merge pull request #4604 from Manishearth/rustup
Rustup to rustc 1.40.0-nightly (702b45e40 2019-10-01)
2019-10-01 11:30:22 -07:00
Manish Goregaokar
9e166e09b8 Use new spans for expansion checking in loop lints 2019-10-01 10:17:29 -07:00
bors
406e89a00c Auto merge of #4601 - lzutao:clean-up-unused-vars, r=phansch
Clean up some unused vars

changelog: none
2019-09-29 17:05:36 +00:00
Lzu Tao
aa4f3fb537 Clean up some unused vars 2019-09-29 23:46:32 +07:00
bors
b292183c68 Auto merge of #4600 - lzutao:rustup-63492, r=oli-obk
Rustup rust-lang/rust#63492

changelog: none
2019-09-29 16:06:56 +00:00
Lzu Tao
6e3a0ea6b3 Rustup rust-lang/rust#63492 2019-09-29 22:58:17 +07:00
bors
fe920ebf8b Auto merge of #4593 - james9909:fix-multiple-inherent-impls, r=llogiq
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-29 06:21:55 +00:00
bors
5f058d80fc Auto merge of #4594 - matthiaskrgr:rustup_18, r=phansch
rustup https://github.com/rust-lang/rust/pull/64781/

cc https://github.com/rust-lang/rust/issues/64867

changelog: none
2019-09-28 09:51:08 +00:00
Matthias Krüger
5f6e3f35b5 rustup https://github.com/rust-lang/rust/pull/64781/
cc https://github.com/rust-lang/rust/issues/64867
2019-09-28 10:42:41 +02:00
James Wang
189eaa54c6
Ignore impls derived from macros 2019-09-27 20:47:00 -05:00
bors
edd90473ec Auto merge of #4591 - flip1995:rustup, r=flip1995
Rustup to rust-lang/rust#64813

cc rust-lang/rust#64843

changelog: none
2019-09-27 16:19:14 +00:00
flip1995
fff6b0e17c
Remove clippy::author attribute from trailing_zeroes test 2019-09-27 18:10:18 +02:00
flip1995
b67dfb4896
Move author issue test to author subdir 2019-09-27 18:07:07 +02:00
flip1995
8d8ba14371
Fix author lint 2019-09-27 18:01:04 +02:00