Commit graph

6415 commits

Author SHA1 Message Date
bors
cf81a3b6d0 Auto merge of #3832 - HarrisonMc555:use_last, r=flip1995
Implement "Use last" lint

Closes #3673

This lint checks the use of `x.get(x.len() - 1)` and suggests `x.last()` (where `x` is a `Vec`).

There's at least one more thing that needs to happen here. I believe I am correctly checking most of the scenarios and avoiding false positives. However, if different `Vec`s are used for the `x.get` and `y.len`, then it will emit a false positive. In other words, I need to check to make sure the `Vec`s are the same.

Also, a lot of these commits were temporary and not helpful to the project history...am I supposed to squash on merge? If so, how do I do that?

changelog: New lint: `get_last_with_len`
2019-05-27 11:04:38 +00:00
bors
abe139c7ac Auto merge of #4148 - sanxiyn:typo, r=Manishearth
Fix typo in comment
2019-05-27 03:38:19 +00:00
Seo Sanghyeon
2c53a3f970 Fix typo in comment 2019-05-27 12:32:04 +09:00
bors
46e64911ad Auto merge of #4145 - rust-lang:rustup, r=oli-obk
Rustup to rustc 1.36.0-nightly (2268d9923 2019-05-26)

changelog: none
2019-05-26 15:36:38 +00:00
Oliver Scherer
637e656451 Rustfmt 2019-05-26 17:36:21 +02:00
Oliver Scherer
fd2ecfcc89 Rustup to rustc 1.36.0-nightly (2268d9923 2019-05-26) 2019-05-26 16:47:26 +02:00
Andrew Xu
dcf064a4f9 Rename "Associated*" to "Assoc*"
This is to fix the breakage introduced by rust-lang/rust#60163.
2019-05-25 20:31:34 +08:00
bors
577ee79668 Auto merge of #4141 - phansch:rustup5, r=oli-obk
Rustup to https://github.com/rust-lang/rust/pull/61026

None
2019-05-25 07:50:39 +00:00
Philipp Hansch
a650659d63
Rustup to https://github.com/rust-lang/rust/pull/61026 2019-05-25 09:45:07 +02:00
Andy Russell
effea41fe4
tweak let_and_return diagnostic
Label the unnecessary let binding and convert the note to structured
suggestion.
2019-05-24 14:52:55 -04:00
bors
d519ed433e Auto merge of #4135 - matthiaskrgr:rustup_obsol, r=phansch
rustup https://github.com/rust-lang/rust/pull/60803/

changelog: none
2019-05-24 14:08:09 +00:00
Matthias Krüger
c67d2b121a rustup https://github.com/rust-lang/rust/pull/60803/ 2019-05-24 15:25:36 +02:00
bors
07b484c9bd Auto merge of #4134 - phansch:rustup4, r=Manishearth
Rustup to https://github.com/rust-lang/rust/pull/59545

Needed due to signature changes of `item_children` in [the PR](https://github.com/rust-lang/rust/pull/59545/files) (just grep for `item_children` to see the changes)

I'm not really sure where the .stderr changes came from.
2019-05-24 06:24:12 +00:00
Philipp Hansch
aca56727db
Rustup to https://github.com/rust-lang/rust/pull/59545 2019-05-24 08:19:51 +02:00
Matthias Krüger
5d58163f7d trivially_copy_pass_by_ref: print size of type and limit in the lint message 2019-05-23 23:48:20 +02:00
bors
345ac82934 Auto merge of #4132 - phansch:rollup-0vxoimc, r=phansch
Rollup of 2 pull requests

Successful merges:

 - #4129 (update if_chain to 1.0.0)
 - #4130 (bump rustc_tools_util to 0.2.0 )

Failed merges:

r? @ghost
2019-05-23 19:29:17 +00:00
Philipp Hansch
89962ae165
Rollup merge of #4130 - matthiaskrgr:rtu_2, r=phansch
bump rustc_tools_util to 0.2.0

I want to push a new version to crates.io.

changelog: release rustc_tool_utils 0.2.0
2019-05-23 21:28:50 +02:00
Philipp Hansch
7e9db162b5
Rollup merge of #4129 - matthiaskrgr:if_chain, r=phansch
update if_chain to 1.0.0
2019-05-23 21:28:49 +02:00
bors
c984f77097 Auto merge of #4131 - phansch:rustup2, r=phansch
Rustup to https://github.com/rust-lang/rust/pull/60965

https://github.com/rust-lang/rust/pull/60965
2019-05-23 18:23:39 +00:00
Philipp Hansch
a316179850
Rustup to https://github.com/rust-lang/rust/pull/60965 2019-05-23 20:19:00 +02:00
Matthias Krüger
68281ad0b2 clippy: bump rustc_tools util version to 0.2
rustc_tools_util: fix typo in docs (readme)
2019-05-23 17:40:54 +02:00
Matthias Krüger
c8443c1528 rustc_tool_utils: bump version to 0.2.0 2019-05-23 17:30:05 +02:00
Matthias Krüger
655aef7c6c update if_chain to 1.0.0 2019-05-23 17:23:59 +02:00
bors
9c85b02f78 Auto merge of #4128 - matthiaskrgr:test_update, r=phansch
tests: update needless_bool test stderr

I'm getting a test failure otherwise with rust master (f688ba608923bdbf6b46ec65af2f6464b6233a75).

changelog: none
2019-05-23 15:12:29 +00:00
Matthias Krüger
3d0795bb04 tests: update needless_bool test stderr
I'm getting a test failure otherwise with rust master (f688ba608923bdbf6b46ec65af2f6464b6233a75).
2019-05-23 17:03:59 +02:00
bors
39d1fea6d6 Auto merge of #4126 - phansch:rustup, r=Manishearth
Rustup to https://github.com/rust-lang/rust/pull/60740

https://github.com/rust-lang/rust/pull/60740

changelog: none
2019-05-23 05:43:15 +00:00
Philipp Hansch
edb698105f
cargo fmt
Roses are red
Violets are blue
`Add rustfmt to a pre-commit hook` is what I should do.
2019-05-23 07:24:53 +02:00
Philipp Hansch
635a2fa5df
Rustup to https://github.com/rust-lang/rust/pull/60740
changelog: none
2019-05-23 07:19:25 +02:00
bors
64c1d3bea7 Auto merge of #4120 - phansch:needless_lifetimes_async_test_cleanup, r=Manishearth
Lifetimes UI test cleanup

* Removes an unneeded `#![warn(clippy::extra_unused_lifetimes)]` from
  the `needless_lifetimes` test - the tests for those are in a different
  file.

* Renames `unused_lt.{rs,stderr}` to `extra_unused_lifetimes.{rs,stderr}`
* Renames `lifetimes.{rs,stderr}` to `needless_lifetimes.{rs,stderr}`
2019-05-22 10:44:39 +00:00
bors
a8eeb7cdb1 Auto merge of #4125 - Manishearth:rustup, r=oli-obk
Rustup to rustc 1.36.0-nightly (dbfe70dfc 2019-05-22)

not 100% sure of the Symbol stuff

r? @oli-obk
2019-05-22 08:37:27 +00:00
Oliver Scherer
833ef0036a Disable cargo integration test due to clippy ICE 2019-05-22 10:36:20 +02:00
Manish Goregaokar
a6cf35264f Rustup to rustc 1.36.0-nightly (dbfe70dfc 2019-05-22) 2019-05-21 21:58:27 -07:00
Vincent Dal Maso
40f36658f5 Fix breaking tests
Changes:
- Fix stderr breaking the tests
- Adding tests over the if arms
2019-05-21 13:08:19 +02:00
Vincent Dal Maso
fa9f744c2c Add the common case search
Changes:
- Refactor the common case search into a function.
- Fix the useless Option around the vec in the search_same_list.
2019-05-21 13:08:19 +02:00
Philipp Krones
42d849c185
Formatting inside if_chain! macro 2019-05-21 10:45:38 +02:00
Harrison McCullough
f32c2fcb7e Implement get_last_with_len lint 2019-05-20 18:01:21 -06:00
Philipp Hansch
3f382999ab
Lifetimes UI test cleanup
* Removes an unneeded `#![warn(clippy::extra_unused_lifetimes)]` from
  the `needless_lifetimes` test - the tests for those are in a different
  file.

* Renames `unused_lt.{rs,stderr}` to `extra_unused_lifetimes.{rs,stderr}`
* Renames `lifetimes.{rs,stderr}` to `needless_lifetimes.{rs,stderr}`
2019-05-20 19:19:49 +02:00
BO41
36c8aaba8f Fix tests and make other ascii lints auto-fixable 2019-05-20 16:02:50 +02:00
bors
2cc23a5b18 Auto merge of #4118 - rust-lang:revert, r=phansch
Revert "Turn off two tests broken due to #4108"

This reverts commit 568a3ecfc3 which is unnecessary after https://github.com/rust-lang/rust-clippy/pull/4115

changelog: none
2019-05-20 13:36:26 +00:00
BO41
859b329603 Make non_ascii_literal auto-fixable 2019-05-20 15:23:38 +02:00
BO41
874de889dc Improve verbosity of non_ascii_literal lint example 2019-05-20 15:08:53 +02:00
Oliver Scherer
efac2e5eff Revert "Turn off two tests broken due to #4108"
This reverts commit 568a3ecfc3.
2019-05-20 12:31:53 +02:00
bors
fd56381015 Auto merge of #4088 - pJunger:check1, r=oli-obk
Added lint for TryFrom for checked integer conversion.

works towards #3947

Added lint for try_from for checked integer conversion.
Should recognize simple & straight-forward checked integer conversions.
2019-05-20 09:31:09 +00:00
bors
cbae9ed873 Auto merge of #4115 - ehuss:fix-compiletest, r=Manishearth
Fix compile-test from forcing a rebuild.

If the `compile-test` test was run, then running a cargo build command immediately after caused everything to be rebuilt. This is because the `compile-test` test was deleting all `.rmeta` files in the target directory. Cargo recently switched to always generating `.rmeta` files (https://github.com/rust-lang/cargo/pull/6883), and when the files are deleted, it thinks it needs to be rebuilt.

I am not very familiar with compiletest or clippy, so please take a close look and test this out (with the most recent nightly). In particular, make sure it doesn't revert the fixes from #3380 (it seems to work for me). Also @oli-obk mentioned something related in https://github.com/rust-lang/rust/pull/60190#issuecomment-493617188, and I want to make sure that is addressed as well.

Fixes #4114
2019-05-19 20:44:19 +00:00
Eric Huss
a8bf501239 Fix compile-test from forcing a rebuild. 2019-05-19 13:25:06 -07:00
bors
0331b95718 Auto merge of #4109 - Manishearth:backport-merge, r=phansch
Merge backport branches into master

Attempt 2 at https://github.com/rust-lang/rust-clippy/pull/4103

This does nothing to the code, however it keeps the backport branches in master history, so that deleting a branch won't accidentally break old rustc builds
2019-05-19 11:13:40 +00:00
bors
0417a0ac4d Auto merge of #4107 - taiki-e:useless_attribute, r=flip1995
useless_attribute: Add unreachable_pub to whitelists

Fixes #4106

changelog: `useless_attribute`: whitelist `unreachable_pub` on `use` items
2019-05-19 10:37:09 +00:00
bors
4071b2996e Auto merge of #4099 - flip1995:ul_4094, r=oli-obk
Add macro check for unreadable_literal lint

Closes #4094

changelog: Disable `unreadable_literal` lint inside macros
2019-05-19 08:46:43 +00:00
bors
f4de904919 Auto merge of #4100 - phansch:add_stderr_length_check, r=flip1995
Add a stderr file length check to clippy_dev

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-05-19 08:13:16 +00:00
bors
0a59a78b98 Auto merge of #4111 - Manishearth:changelog, r=oli-obk
Update changelog

r? @oli-obk @phansch
2019-05-19 07:43:34 +00:00