Commit graph

2408 commits

Author SHA1 Message Date
bors
c3e913650e Auto merge of #3766 - xd009642:issue-3764, r=flip1995
trait bounds lint - repeated types

This PR is to tackle https://github.com/rust-lang/rust-clippy/issues/3764 it's still a WIP and doesn't work but this is an initial stab. It builds though I haven't added any tests as I'm not sure where lint tests should go?

Unfortunately, it seems id isn't tied to the type itself but I guess where it is in the AST? Looking at https://manishearth.github.io/rust-internals-docs/syntax/ast/struct.Ty.html I can't see any members that would let me tell if a type was repeated in multiple trait bounds.

There may be other issues with how I've implemented this so any assistance is appreciated!

changelog: Add new lint: `type_repetition_in_bounds`
2019-07-30 12:11:17 +00:00
Michael Wright
a9714227bd Enable rustfmt tests
This reverts commit d73a953db7.
2019-07-28 06:45:23 +02:00
Michael Wright
dae4076760 Skip fmt test if rustfmt is unavailble 2019-07-28 06:45:09 +02:00
xd009642
bba2c7f02c Updated tests.
Removed unnecessary type repetition in float test and regenerated stderr
Regenerated type_repetition stderr
2019-07-27 22:53:26 +01:00
xd009642
925e8207fa Respond to review comments
Update README and CHANGELOG using the util scripts, refine the help message and fix the float_cmp error.
2019-07-27 21:58:29 +01:00
Matthias Krüger
d73a953db7 ci: temporarily disable rustfmt checks/tetss since it's broken for nightly 2019-07-27 17:47:51 +02:00
xd009642
c962ddbd29 Updated test stderr 2019-07-27 12:07:02 +01:00
xd009642
f71d59e6a6 Lint for type repetition in trait bounds.
This lint adds warning if types are redundantly repeated in trait bounds i.e. `T: Copy, T: Clone` instead of `T: Copy + Clone`. This is a late pass trait lint and has necessitated the addition of code to allow hashing of TyKinds without taking into account Span information.
2019-07-24 21:14:21 +01:00
Matthias Krüger
b0373a5f6b update test stderr, not sure which rustc pull request caused this. 2019-07-24 02:25:03 +02:00
bors
d71e9c4f10 Auto merge of #4266 - uHOOCCOOHu:fix/async_fn_lifetime, r=flip1995
Ignore generated fresh lifetimes in elision check

<!--
Thank you for making Clippy better!

We're collecting our changelog from pull request descriptions.
If your PR only updates to the latest nightly, you can leave the
`changelog` entry as `none`. Otherwise, please write a short comment
explaining your change.

If your PR fixes an issue, you can add "fixes #issue_number" into this
PR description. This way the issue will be automatically closed when
your PR is merged.

If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.

- [ ] Followed [lint naming conventions][lint_naming]
- [ ] Added passing UI tests (including committed `.stderr` file)
- [ ] `cargo test` passes locally
- [ ] Executed `util/dev update_lints`
- [ ] Added lint documentation
- [ ] Run `cargo fmt`

Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.

Delete this line and everything above before opening your PR -->

fixes #3988

changelog: Ignore generated fresh lifetimes in elision check.

**HELP**: It seems `tests/ui` are compiled under edition 2015, and I don't know how to add tests for this properly.

Here is the test input it had already passed:
```rust
#![feature(async_await)]
#![allow(dead_code)]

async fn sink1<'a>(_: &'a str) {} // lint
async fn sink1_elided(_: &str) {} // ok

async fn one_to_one<'a>(s: &'a str) -> &'a str { s } // lint
async fn one_to_one_elided(s: &str) -> &str { s } // ok
async fn all_to_one<'a>(a: &'a str, _b: &'a str) -> &'a str { a } // ok
// async fn unrelated(_: &str, _: &str) {} // Not allowed in async fn

// #3988
struct Foo;
impl Foo {
    pub async fn foo(&mut self) {} // ok
}

// rust-lang/rust#61115
async fn print(s: &str) { // ok
    println!("{}", s);
}

fn main() {}

```
2019-07-23 09:52:18 +00:00
uHOOCCOOHu
5265ab8723
Fix tests for edition 2018 compatibility 2019-07-23 03:59:09 +08:00
uHOOCCOOHu
434f83a6c7
Revert "Revert global fmt config and use rustfmt::skip"
This reverts commit b70b3b14aa.
2019-07-23 02:57:49 +08:00
Michael Wright
67db88f645 Fix breakage due to rust-lang/rust#62705
Also rename `OUTER_EXPN_INFO` to `OUTER_EXPN_EXPN_INFO` to match new
function names.
2019-07-21 09:36:31 +02:00
uHOOCCOOHu
b70b3b14aa
Revert global fmt config and use rustfmt::skip 2019-07-20 00:50:18 +08:00
uHOOCCOOHu
2cc373ac54
Fix fmt 2019-07-19 23:03:34 +08:00
bors
958af10f12 Auto merge of #4286 - phansch:update_pulldown_cmark3, r=flip1995
Update pulldown-cmark to 0.5.3

Fixes a couple of crashes of which I added one example to our tests.

changelog: Update `pulldown-cmark` to 0.5.3 to fix potential crashes in `doc_markdown` lint
2019-07-19 07:25:55 +00:00
Philipp Hansch
8dc6a462f8
Update pulldown-cmark to 0.5.3 2019-07-19 07:29:25 +02:00
Matthias Krüger
deb586a0c6 rustup https://github.com/rust-lang/rust/pull/62764
(was merged as part of https://github.com/rust-lang/rust/pull/62782 )
2019-07-19 00:35:32 +02:00
uHOOCCOOHu
e6bbed909e
Add test 2019-07-19 02:43:10 +08:00
bors
d509b5afef Auto merge of #4274 - daxpedda:implicit_return_fixes, r=flip1995
false positives fixes of `implicit_return`

-  Handle returning macro statements properly (remove "this error originates in a macro outside of the current crate")
-  Handle functions that return never type
-  Handle functions that panic but do not return never type

changelog: Fix false positives in `implicit_return` lint pertaining to macros and panics
2019-07-18 18:20:40 +00:00
bors
0626674d3c Auto merge of #4280 - phansch:uitests_matches, r=flip1995
UI Test Cleanup: Extract match_ref_pats tests

changelog: none

cc #2038
2019-07-17 08:08:18 +00:00
bors
5dfb5adbac Auto merge of #4259 - Darth-Revan:origin/inherent_to_string, r=flip1995
Implement lint for inherent to_string() method.

Fixes #4247

changelog: Implement two new lints: `inherent_to_string` and `inherent_to_string_shadow_display`

1) Emits a warning if a type implements an inherent method `to_string(&self) -> String`
2) Emits an error if a type implements an inherent method `to_string(&self) -> String` and also implements the `Display` trait
2019-07-17 07:23:25 +00:00
Darth-Revan
b7145fbb66
Fix "unkown clippy lint" error in UI test. 2019-07-17 08:58:36 +02:00
Darth-Revan
f0dc97965a
Corrections for PR review. 2019-07-17 08:58:36 +02:00
Darth-Revan
0513202d25
Implement lint for inherent to_string() method. 2019-07-17 08:58:32 +02:00
bors
fb35311e9a Auto merge of #4278 - phansch:uitestcleanup_indexing, r=flip1995
UI Test Cleanup: Split out out_of_bounds_indexing

This moves the `out_of_bounds_indexing` lint tests to their own
directory.

changelog: none

cc #2038
2019-07-17 06:48:53 +00:00
Philipp Hansch
022b9876c2
UI Test Cleanup: Extract match_ref_pats tests 2019-07-17 08:08:26 +02:00
Philipp Hansch
38b6156a51
Update UI tests 2019-07-16 22:26:47 +02:00
bors
7498a5f13c Auto merge of #4276 - phansch:uitestcleanup, r=flip1995
UI Test Cleanup: Split up checked_unwrap tests

Let's slowly bring that ticket closer to the finish line 🐌 🏁

This splits up `tests/ui/checked_unwrap.rs` into:

 * `tests/ui/checked_unwrap/complex.rs`
 * `tests/ui/checked_unwrap/simple.rs`

Based on the naming of the methods in the tests.

changelog: none

cc #2038
2019-07-16 20:24:03 +00:00
Philipp Hansch
7a888968f9
Allow no_effect lint
for cleaner stderr file

Co-Authored-By: Philipp Krones <hello@philkrones.com>
2019-07-16 21:29:03 +02:00
Philipp Hansch
65e9477b84
Remove comment
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2019-07-16 21:28:37 +02:00
Philipp Hansch
633934da18
cargo fmt 2019-07-16 21:28:03 +02:00
Philipp Hansch
48bff49484
UI Test Cleanup: Split up checked_unwrap tests
This splits up `tests/ui/checked_unwrap.rs` into:

 * `tests/ui/checked_unwrap/complex.rs`
 * `tests/ui/checked_unwrap/simple.rs`

Based on the naming of the methods in the tests.

cc #2038
2019-07-16 21:23:43 +02:00
daxpedda
a2b63af746
Removed lintining on never type.
Abstracted repeating strings into statics.
2019-07-16 14:46:33 +02:00
Philipp Hansch
33010ae7e6
UI Test Cleanup: Split out out_of_bounds_indexing
This moves the `out_of_bounds_indexing` lint tests to their own
directory.
2019-07-16 07:30:23 +02:00
Jerry Hardee
8adbf7f2c1 Fix float_cmp false positive when comparing signum
f1.signum() == f2.signum()
f1.signum() != f2.signum()
should not trigger a warning.
2019-07-15 12:46:58 -05:00
daxpedda
6c067bf50e
false positives fixes of implicit_return
-  Handle returning macro statements properly
-  Handle functions that return never type
-  Handle functions that panic but do not return never type
2019-07-15 16:02:50 +02:00
flip1995
ce2a7b0160
Disable dogfood on windows for faster build time on travis 2019-07-14 15:21:50 +02:00
bors
3267e054da Auto merge of #4232 - mikerite:dev-fmt-4, r=flip1995
Add dev fmt subcommand

changelog: none
2019-07-13 09:26:16 +00:00
Michael Wright
76d66e6413 Merge branch 'master' into dev-fmt-4 2019-07-13 09:20:54 +02:00
Michael Wright
de7749832c Fix bug in implicit_hasher causing crashes
Skip linting if the type is from an external macro. Closes #4260.
2019-07-11 08:47:05 +02:00
bors
032ae96856 Auto merge of #4257 - skade:improve-cast-alignment, r=flip1995
Improve cast_ptr_alignment lint

<!--
Thank you for making Clippy better!

We're collecting our changelog from pull request descriptions.
If your PR only updates to the latest nightly, you can leave the
`changelog` entry as `none`. Otherwise, please write a short comment
explaining your change.

If your PR fixes an issue, you can add "fixes #issue_number" into this
PR description. This way the issue will be automatically closed when
your PR is merged.

If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.

- [x] Followed [lint naming conventions][lint_naming]
- [x] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Executed `util/dev update_lints`
- [x] Added lint documentation
- [x] Run `cargo fmt`

Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.

Delete this line and everything above before opening your PR -->

* print alignment in bytes in the lint message
* ignore ZST left-hand types

Fixes #3797 and #4256
changelog:
* `cast_ptr_alignment`: Print alignment in bytes in the lint message
* `cast_ptr_alignment`: Ignore casting from ZST left-hand types
2019-07-09 15:28:26 +00:00
Florian Gilcher
aa72cac87a
Improve cast_ptr_alignment lint
* print alignment in bytes in the lint message
* ignore ZST left-hand types
2019-07-09 17:02:26 +02:00
bors
5c921a9f61 Auto merge of #4233 - thiagoarrais:jens1o-fix-1208, r=phansch,flip1995
Avoid reporting string_lit_as_bytes for long strings

Port of @jens1o code ([b76f939][jens1o_commit])

Fixes #1208

[jens1o_commit]: b76f939ac2

<!--
Thank you for making Clippy better!

We're collecting our changelog from pull request descriptions.
If your PR only updates to the latest nightly, you can leave the
`changelog` entry as `none`. Otherwise, please write a short comment
explaining your change.

If your PR fixes an issue, you can add "fixes #issue_number" into this
PR description. This way the issue will be automatically closed when
your PR is merged.

If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.

- [ ] Followed [lint naming conventions][lint_naming]
- [ ] Added passing UI tests (including committed `.stderr` file)
- [ ] `cargo test` passes locally
- [ ] Executed `util/dev update_lints`
- [ ] Added lint documentation
- [ ] Run `cargo fmt`

Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.

Delete this line and everything above before opening your PR -->

changelog: bugfix for long strings as bytes
2019-07-09 09:48:33 +00:00
Bara
2fb73fe037 Use empty block instead of unit type for needless return 2019-07-08 20:45:51 +02:00
Jens Hausdorf
6d1aaac6c3 Avoid reporting string_lit_as_bytes for long strings
Port of @jens1o code ([b76f939][jens1o_commit])

Fixes #1208

[jens1o_commit]: b76f939ac2

Co-authored-by: Thiago Arrais <thiago.arrais@gmail.com>
2019-07-08 13:13:01 -03:00
Jeremy Stucki
1fd617d6df
Add test for unnecessary_flat_map 2019-07-08 17:11:52 +02:00
Michael Wright
c0c2a8d9c1
Work around rustup fallback error on Windows 2019-07-07 15:11:38 +02:00
Michael Wright
aeac3da2c1
Improve fmt test failure message 2019-07-07 15:11:37 +02:00
Michael Wright
4c771c3478
Add dev fmt subcommand 2019-07-07 15:11:33 +02:00
Lzu Tao
481499101b Remove lint for ONCE_INIT
ONCE_INIT will be deprecated in rust 1.38.0
2019-07-06 12:34:32 +07:00
Lzu Tao
3a76bea04b Update rustfix tests 2019-07-06 12:34:32 +07:00
Michael Wright
8fa023272f Fix allow bug in trivially_copy_pass_by_ref
Closes #3992
2019-07-03 07:15:21 +02:00
Michael Wright
c199d9068e Fix match_same_arms false negative
Closes #4244
2019-07-02 08:18:55 +02:00
flip1995
fb56e90e12
Test for melted ICE #4121 2019-07-01 15:53:48 +02:00
bors
47ada9ae07 Auto merge of #4243 - mikerite:fix-4058, r=flip1995
Fix `never_loop` false positive

Closes #4058

changelog: none
2019-07-01 08:10:25 +00:00
bors
ad638a3e42 Auto merge of #4222 - jfrikker:try_err, r=flip1995
Adding try_err lint

changelog: Adds the "try_err" lint, which catches instances of the following: Err(x)?
fixes #4212
2019-07-01 07:41:33 +00:00
Michael Wright
7c98915da9 Fix never_loop false positive
Closes #4058
2019-07-01 07:22:04 +02:00
Joe Frikker
c96bb2c303 Running rustfmt on test 2019-06-30 18:28:12 -04:00
Alex Gaynor
fffdbc0e8f Removed use of intrinsics::uninit from tests.
This is in preperation for https://github.com/rust-lang/rust/pull/62150

Also allows deprecations in preperations for intrinsics::init being deprecated, which is a planned future step.
2019-06-29 09:34:42 -04:00
Joe Frikker
8880677b4f Making try_err machine applicable 2019-06-24 21:28:46 -04:00
Joe Frikker
1e6c6976dd PR comments 2019-06-23 18:02:13 -04:00
Mazdak Farrokhzad
6ef8b57e34 Account for let_chains in collapsible_if ui test cases. 2019-06-23 17:24:45 +02:00
Joe Frikker
60a80849ce Adding try_err lint 2019-06-22 16:37:05 -04:00
Daniele D'Orazio
316a9f2711 cargo fmt 2019-06-21 16:47:34 +02:00
Daniele D'Orazio
66dbc02b05 more idiomatic code 2019-06-21 14:46:34 +02:00
Daniele D'Orazio
e1a78ae528 update tests and fix lints in clippy 2019-06-21 14:17:59 +02:00
Daniele D'Orazio
6396a7a425 make needless_return work with void functions 2019-06-21 13:58:22 +02:00
Lzu Tao
4fa498a3eb Fix warnings about unnecessary lifetime bounds
Rustup https://github.com/rust-lang/rust/pull/61172
2019-06-20 01:36:23 +07:00
Daniele D'Orazio
be14ea8c37 fix suggestion for floating points inequality
It should be of the form `(a - b).abs() > error` whereas it was
`(a - b).abs() < error` that is instead what should be used for equality.
2019-06-17 16:42:43 +02:00
flip1995
7e07d1bed8
Restructure rename tests 2019-06-14 10:45:03 +02:00
krk
fefa7e7f67
Register rename to the LintStore. 2019-06-14 10:45:03 +02:00
krk
55740219b0
Rename REDUNDANT_STATIC_LIFETIME to REDUNDANT_STATIC_LIFETIMES. 2019-06-14 10:45:03 +02:00
krk
637e92d44e
Rename const_static_lifetime to redundant_static_lifetime. 2019-06-14 10:45:02 +02:00
krk
b38ce08e76
Merge StaticConst and StaticStatic lints into StaticConst. 2019-06-14 09:41:47 +02:00
krk
16bd4796e9
Add lint for statics with explicit static lifetime. 2019-06-14 09:41:46 +02:00
Thiago Arrais
b364eb7b54 Adds lint for integer division 2019-06-12 09:37:14 -03:00
Grzegorz
d4ad23bb3f redundant_closure_for_method_calls fixes:
lint does not trigger when there is a difference in mutability
lint does not trigger when the method belongs to a trait which is not implemebted directly (Deref)
2019-06-12 13:43:36 +02:00
Alexander Shabalin
41a4ce52dd Workaround for rust-lang/rustfmt#3615 2019-06-10 20:19:29 +03:00
Alexander Shabalin
86bab94631 Fixing eta with respect to lazy evaluation. 2019-06-10 13:58:40 +03:00
Michael Wright
b726b41daf Add OUTER_EXPN_INFO lint 2019-06-08 13:35:04 +02:00
bors
5be4e71262 Auto merge of #4136 - euclio:println-writeln-suggestions, r=flip1995
add suggestions for print/write with newline lint

changelog: Add machine-applicable suggestions for `print!`/`write!` with newline lints.
2019-06-06 08:26:48 +00:00
Michael Wright
98585a0324 Fix .map(..).unwrap_or_else(..) bad suggestion
Closes #4144
2019-06-02 08:50:20 +02:00
Philipp Hansch
6feef17071
Fix ellipsis_inclusive_range_patterns lint warnings
Changed from `allow` to `warn` in https://github.com/rust-lang/rust/pull/61342
2019-06-01 07:54:47 +02:00
Andy Russell
2d0c797da6
add suggestions for print/write with newline lint 2019-05-30 13:46:04 -04:00
bors
0ab3f1762e Auto merge of #4113 - rust-lang:author, r=flip1995
Fix `Block`  dump in author lint

changelog: The `#[clippy::author]` attribute now emits correct pattern code for block expressions
2019-05-30 10:34:56 +00:00
Philipp Hansch
2c72026fcb
Rustup to https://github.com/rust-lang/rust/pull/61203
Migrates all trait objects to use `dyn`
2019-05-30 08:31:09 +02:00
Oliver Scherer
3908d86f8a
Don't rustfmt author test
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2019-05-28 15:34:25 +02:00
Oliver Scherer
f98e4bd33b
Fix Block dump in author lint 2019-05-28 13:01:11 +02:00
bors
d57845ffdf Auto merge of #4071 - matthiaskrgr:sizeof, r=flip1995
trivially_copy_pass_by_ref: print size of type and limit in the lint message

changelog: trivially_copy_pass_by_ref: print size of type and limit in the lint message
2019-05-28 07:56:04 +00:00
bors
7b501f0f6a Auto merge of #4137 - euclio:let-return, r=oli-obk
tweak `let_and_return` diagnostic

changelog: `let_and_return`: label the unnecessary let binding and convert the note to a structured
suggestion
2019-05-27 13:04:14 +00:00
bors
eb0a2884d2 Auto merge of #4149 - flip1995:rollup-6knpdqb, r=flip1995
Rollup of 2 pull requests

Successful merges:

 - #4102 (Fix match_same_arms to fail late)
 - #4119 (Improve non ascii literal)

Failed merges:

r? @ghost
2019-05-27 11:33:29 +00:00
Philipp Krones
dce670c73c
Rollup merge of #4119 - BO41:non_ascii_literal, r=flip1995
Improve non ascii literal

This PR improves the example of the [non_ascii_literal](https://rust-lang.github.io/rust-clippy/master/index.html#non_ascii_literal) lint.
It also makes it auto-fixable.

Please review. This is my first PR to this project.
(Thanks @flip1995 for the help :)

changelog: none
fixes #4117
2019-05-27 13:09:17 +02:00
Philipp Krones
f0a767352b
Rollup merge of #4102 - Urriel:fix/4096_match_same_arms, r=flip1995
Fix match_same_arms to fail late

Changes:
- Add a function search_same_list which return a list of matched expressions
- Change the match_same_arms implementation behavior. It will lint each same arms found.

fixes #4096

changelog: none
2019-05-27 13:09:16 +02:00
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
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
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
Philipp Hansch
a316179850
Rustup to https://github.com/rust-lang/rust/pull/60965 2019-05-23 20:19:00 +02: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
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
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
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
Eric Huss
a8bf501239 Fix compile-test from forcing a rebuild. 2019-05-19 13:25:06 -07: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
pJunger
00a5ef64a2 Added suggestion for conversion with is_ok. 2019-05-18 09:33:26 +02:00
pJunger
47444c44ad Added lint for TryFrom for checked integer conversion rust-lang#3947. 2019-05-18 09:33:25 +02:00
Taiki Endo
40fc725298 useless_attribute: Add unreachable_pub to whitelists 2019-05-18 14:22:16 +09:00
Oliver Scherer
568a3ecfc3 Turn off two tests broken due to #4108 2019-05-18 00:57:23 +02:00
flip1995
08d2a0d6b2
Also rename the lint in test files 2019-05-16 20:18:07 +02:00
Vincent Dal Maso
bfb230369e Add test for multiple same arms lints
Changes:
- Add a test to match multiple arms in the same match statement
2019-05-16 14:13:57 +02:00
Michael Wright
4fcaab3d62 Split redundant_closure lint
Move the method checking into a new lint called
`redundant_closures_for_method_calls` and put it in the pedantic group.

This aspect of the lint seems more controversial than the rest.

cc #3942
2019-05-16 08:25:39 +02:00
flip1995
3543f58c84
Add macro check for unreadable_literal lint
Closes #4094
2019-05-15 14:57:56 +02:00
bors
82b2dfb9f6 Auto merge of #4095 - flip1995:mscn_test, r=phansch
Add test for #3198

Closes #3198

changelog: none
2019-05-14 12:02:22 +00:00
flip1995
861d233256
Add test for #3198 2019-05-14 13:46:10 +02:00
bors
501830bf01 Auto merge of #4084 - mikerite:fix-4019, r=oli-obk
Fix 4019

Fixes #4019
2019-05-14 11:26:16 +00:00
flip1995
a5bcaf538d
Add regression test for identity_conversion FP 2019-05-12 21:32:29 +02:00
bors
2122bdb94b Auto merge of #4087 - phansch:move_tests, r=matthiaskrgr
UI test cleanup: Extract many_single_char_names tests

changelog: none

cc #2038, #4086
2019-05-12 17:36:39 +00:00
Philipp Hansch
915ada04f5
UI test cleanup: Extract many_single_char_names tests 2019-05-12 18:40:32 +02:00
bors
e9b7a7125e Auto merge of #4085 - phansch:empty_loop_tests, r=matthiaskrgr
Add tests for empty_loop lint

changelog: none

Closes #4072
2019-05-12 13:50:57 +00:00
Philipp Hansch
9a24ab8466
Add tests for empty_loop lint 2019-05-12 13:07:58 +02:00
Michael Wright
e6e3f24e0c Fix #4019 2019-05-12 10:18:38 +02:00
Michael Wright
c44a882a84 Move ctor tests from methods.rs to or_fun_calls.rs 2019-05-12 09:32:39 +02:00
Manish Goregaokar
7eb8018554 Rename in_macro to in_macro_or_desugar 2019-05-11 21:39:02 -07:00
Manish Goregaokar
19cfb84405 Start handling desugarings in author lint 2019-05-10 23:43:58 -07:00
Manish Goregaokar
0499184201 Ignore desugarings in macro checks 2019-05-10 23:40:42 -07:00
Michael Wright
dcfe380de4 Remove unused attrs in while_let_on_iterator tests 2019-05-09 05:58:54 +02:00
Michael Wright
225f86f2c3 Fix while_let_on_iterator.stderr 2019-05-09 05:54:05 +02:00
Michael Wright
5149ed40a9 Rename while_loop tests to while_let_on_iterator 2019-05-08 09:30:17 +02:00
Michael Wright
1cb94a7e6c Split while_loop.rs tests
Split out while_let_loop tests into separate file.
Split ice-360 out into separate file.
2019-05-08 09:24:24 +02:00
Michael Wright
87f7eaa2c8 Add test for #771.
Closes #771
2019-05-07 06:28:51 +02:00
Michael Wright
a4bba694c0 Clean up while_loop tests
At some stage, we started adding test cases inside the function which tests
refutable patterns. This commits splits those test cases out into separate
functions.
2019-05-06 07:49:45 +02:00
bors
8b906f94f3 Auto merge of #4053 - euclio:too-many-args-span, r=flip1995
remove function body from "too many args" span

changelog: Remove the function body from the "too many arguments" span.
2019-05-03 07:26:55 +00:00
Andy Russell
9253506112
remove function body from "too many args" span 2019-05-02 10:36:59 -04:00
bors
8151a17422 Auto merge of #4049 - airt:fix-4033-search_is_some, r=flip1995
Fix #4033 search_is_some

Fixes #4033.

Suggest `any(|x| ..)` instead of `any(|&x| ..)` for `find(|&x| ..).is_some()` (Lint [search_is_some](https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some))

FnDecl of `find`:

```rust
fn find<P>(&mut self, mut p: P) -> Option<Self::Item> where
    P: FnMut(&Self::Item) -> bool
```

FnDecl of `any`:

```rust
fn any<F>(&mut self, mut f: F) -> bool where
    F: FnMut(Self::Item) -> bool
```

If match on `|&_|` in closure of `find`, only use `|_|` in the suggestion.

PS. It's the first time that I have used the `hir` API, please correct me if there is any mistake 😺
2019-05-02 08:45:02 +00:00
bors
1cf5d7f04c Auto merge of #4035 - JoshMcguigan:useless_let_if_seq-3043, r=oli-obk
useless_let_if_seq handle interior mutability

fixes #3043

This passes all tests, including a new one specifically dealing with a type with interior mutability. The main thing I'm unsure of is whether the span I used in the call to `is_freeze` is the most appropriate span to use, or if it matters.
2019-05-02 07:03:28 +00:00
Matthias Krüger
f195680edb more Use->DropTemps fixes 2019-05-01 23:04:35 +02:00
Jane Lusby
0df6564d95 use clippy-preview instead of clippy in cargo 2019-04-30 18:29:25 -07:00
André Luis Leal Cardoso Junior
e428862c95 Update find(p).map(p) occurrences to use find_map(p) 2019-04-30 16:45:32 -03:00
André Luis Leal Cardoso Junior
b411391f8e Add lints for find_map 2019-04-30 16:45:28 -03:00
airt
2d4d275519 change |&x| to |x| in stderr file 2019-05-01 01:06:15 +08:00
bors
f1eda09ea1 Auto merge of #4032 - phansch:add_tests, r=phansch
Add two more tests for redundant_closure

These two cases were fixed by #4008.

Closes #1439

changelog: none
2019-04-29 07:03:54 +00:00
Manish Goregaokar
770de14505 Suggest .copied() for map_clone on iterators too 2019-04-28 11:14:39 -07:00
Michael Wright
5ad79c2b3d Fix breakage due to rust-lang/rust#60225 2019-04-28 09:11:20 +02:00
Philipp Hansch
3f637cb369
Add two more tests for redundant_closure
These two cases were fixed by #4008.

Closes #1439

changelog: none
2019-04-26 06:48:27 +02:00