Commit graph

6929 commits

Author SHA1 Message Date
Ethan Lam
327c91f8c7 Addresses Issue #4001
Fixed typo

Fixes lint name and uses appropriate linting suggestion

changed lint help message

Added autofixable test

Added Autofixable Test

Removed Broken Autofixable File

updated lints

Generated Autofixable/Nonfixable Test Cases

Changed Suggestion Applicability

Updated Lint Count
2019-10-08 08:46:29 -05:00
bors
5cb983338e Auto merge of #4641 - sinkuu:revert_workaround, r=phansch
Revert "Workaround cargo bug on Windows"

[Cargo is fixed on rust master](https://github.com/rust-lang/rust/pull/65186). This reverts PR #4624.

Fixes #4638

changelog: none
2019-10-08 08:36:26 +00:00
bors
30a3992e97 Auto merge of #4627 - kerhong:fix-typo-in-inherent-to-string, r=phansch
Fix typo in inherent_to_string documentation

A simple typo fix in `inherent_to_string` and `inherent_to_string_shadow_display` documentation

changelog: none
2019-10-08 07:52:44 +00:00
bors
b690cdb1e7 Auto merge of #4611 - rust-lang:doc-visibility, r=flip1995
account for doc visibility

This fixes #4608.

Also I noticed that the lint failed to look at trait and impl items. There's a small bit of fallout in the code, too, but not enough to warrant its own commit.

changelog: check docs of trait items and impl items, also make `missing_safety_doc` account for visibility
2019-10-08 07:11:26 +00:00
bors
bbad77a12a Auto merge of #4595 - rust-lang:rustbot, r=flip1995
Allow everyone to assign labels with rustbot

Also allows people to claim issues even if they aren't part of the org

changelog: none
2019-10-08 06:30:50 +00:00
bors
e2393b09ac Auto merge of #4592 - rust-lang:transmute-collection, r=flip1995
New lint: `unsound_collection_transmute`

changelog: Add `unsound_collection_transmute` lint

This fixes #4515
2019-10-08 05:51:07 +00: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
bors
df80193bda Auto merge of #4628 - flip1995:rustup, r=phansch
Rustup to rust-lang/rust#64874

TODO:
- [x] replace `rvalue_promotable_map` in [1]
- [ ] ~~fix [2] according to this comment https://github.com/rust-lang/rust/pull/64874#issuecomment-536203626 this should be merged with `consume`, but I didn't figure out how to merge them, yet.~~
- [ ] ~~fix [3]; What to do with `LoanCause`?~~

[2]+[3] probably have to be resolved by a rewrite of the lint. https://github.com/rust-lang/rust-clippy/pull/4628#issuecomment-538574944

[1]
54bf4ffd62/clippy_lints/src/methods/mod.rs (L1292-L1299)

[2]
54bf4ffd62/clippy_lints/src/escape.rs (L126)

[3]
54bf4ffd62/clippy_lints/src/escape.rs (L166-L176)

I could need some help with [1]. The purpose of this is to "don't lint for constant values". cc @matthewjasper

For now I see what I can do with [2].

changelog: Temporary break `boxed_local` lint.
2019-10-08 05:09:53 +00:00
flip1995
3d39379f9c
Move is_argument check into mutate 2019-10-06 14:49:26 +02:00
flip1995
3aa531c194
Run util/dev fmt 2019-10-05 12:42:09 +02:00
flip1995
3b23092b69
Get rid of rvalue_promotable_map method call 2019-10-05 12:38:38 +02:00
flip1995
b7d473503b
Merge consume and consume_pat in escape analysis
FIXME: This doesn't work and probably needs a rewrite of the lint

See https://github.com/rust-lang/rust-clippy/pull/4628#issuecomment-538574944
2019-10-05 12:23:59 +02:00
flip1995
c420b07191
Fix needless_pass_by_value
This also accidentally improved the spans of the suggestions
2019-10-04 15:39:46 +02:00
flip1995
b46f5b4a98
Rustup to rust-lang/rust#64874
Episode 1 - The simple cases
2019-10-04 15:39:46 +02:00
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
Edgars Baduns
a1137a8439 Fix typo in inherent_to_string documentation 2019-10-04 10:58:53 +01: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
Andre Bogus
27fa2b7944 New lint: unsound_collection_transmute 2019-10-02 21:18:00 +02:00
Andre Bogus
e3f143ff0a account for doc visibility 2019-10-02 21:15:28 +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