Commit graph

1382 commits

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