Commit Graph

1397 Commits

Author SHA1 Message Date
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
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
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
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