Commit graph

105 commits

Author SHA1 Message Date
Matthias Krüger
8eb2bd13d0 update the lint messages and tests 2021-02-28 02:22:05 +01:00
Ryan Sullivant
ee1b959054 Added period back to lint search_is_some and ran
`update-all-references.sh`
2020-11-10 23:18:47 -07:00
Ryan Sullivant
55dc822062 Ran tests/ui/update-all-references.sh" and cargo dev fmt` 2020-11-10 23:18:47 -07:00
Ryan Sullivant
a1cf2d334d Added a lint as suggested in 6010 which recommends using contains()
instead of `find()` follows by `is_some()` on strings

Update clippy_lints/src/find_is_some_on_strs.rs
Co-authored-by: Takayuki Nakata <f.seasons017@gmail.com>

Update clippy_lints/src/methods/mod.rs
Co-authored-by: Philipp Krones <hello@philkrones.com>
2020-11-10 23:18:47 -07:00
ThibsG
e2d86b5b80 Move fixable filter_next and filter_map_next cases to rustfixed tests 2020-10-26 11:02:07 +01:00
ThibsG
3fec6f568d Improve some suggestions for filter_map_next, filter_next and map_unwrap_or lints 2020-10-26 11:02:07 +01:00
ThibsG
2911d9c7de Use better placeholders for some methods lint messages 2020-10-26 11:02:07 +01:00
Tim Nielens
166c520e9a should_impl_trait - pr comments 2020-08-09 15:10:00 +02:00
Tim Nielens
2bc0ecd44b should_implement_trait - add test cases for every checked trait method 2020-08-09 15:10:00 +02:00
Tim Nielens
a77e881ec9 should_impl_trait - ignore methods with lifetime params 2020-08-09 15:10:00 +02:00
Rabi Guha
c2e5534157 Check fn header along with decl when suggesting to implement trait
When checking for functions that are potential candidates for trait
implementations check the function header to make sure modifiers like
asyncness, constness and safety match before triggering the lint.

Fixes #5413, #4290
2020-04-08 21:24:20 +05:30
Micha Ober
c5046fdce5 Add real suggestion to option_map_unwrap_or 2019-12-28 23:24:45 +01:00
Heinz N. Gies
7f454d8d06 Split out tests 2019-10-18 07:40:48 +02:00
James Wang
e23a424b31
Change lint to be pedantic 2019-10-15 09:58:11 +02:00
Andre Bogus
cc622608db new lints around #[must_use] fns
`must_use_unit` lints unit-returning functions with a `#[must_use]`
attribute, suggesting to remove it.

`double_must_use` lints functions with a plain `#[must_use]`
attribute, but which return a type which is already `#[must_use]`,
so the attribute has no benefit.

`must_use_candidate` is a pedantic lint that lints functions and
methods that return some non-unit type that is not already
`#[must_use]` and suggests to add the annotation.
2019-10-14 12:09:04 +02:00
BO41
64cd9e4d60 Try to fix .fixed 2019-09-03 18:56:23 +02:00
BO41
945d4cf69f
Dereference one less on search_is_some and make it auto-fixable 2019-08-29 17:34:02 +02:00
Lzu Tao
2a66196013 Remove feature gate for async_await 2019-08-20 23:21:39 +00:00
Lukas Markeffsky
d55315808d fixed tests (again) and added a test that should actually cause a warning for new_ret_no_self 2019-08-09 23:15:49 +02:00
Lukas Markeffsky
54efffcec1 removed unused imports #2 2019-08-09 19:47:25 +02:00
Lukas Markeffsky
1d2c23a2a5 removed unused imports 2019-08-09 19:44:20 +02:00
Lukas Markeffsky
4fbe9f67ee upgrade test to rust 2018 2019-08-09 19:19:49 +02:00
Lukas Markeffsky
d7b9a845aa new_ret_no_self: walk associated types in impl Trait return types 2019-08-09 17:44:05 +02:00
Philipp Hansch
533abfa613
UI Test Cleanup: No wrong_self_convention in methods.rs
These cases are already covered in `tests/ui/wrong_self_convention.rs`.

cc #2038
2019-08-01 06:54:57 +02:00
Michael Wright
98585a0324 Fix .map(..).unwrap_or_else(..) bad suggestion
Closes #4144
2019-06-02 08:50:20 +02:00
airt
2d4d275519 change |&x| to |x| in stderr file 2019-05-01 01:06:15 +08:00
Philipp Hansch
0f69aac3d9
Add run-rustfix for option_map_or_none lint 2019-04-18 08:12:59 +02:00
Philipp Hansch
25e2affd31
UI test cleanup: Extract iter_nth tests 2019-04-11 08:23:43 +02:00
Philipp Hansch
fdc2255e81
UI test cleanup: Extract or_fun_call tests 2019-04-11 07:47:04 +02:00
flip1995
3282955238
Update tests 2019-03-10 22:07:10 +01:00
Wilco Kusee
eb70a72459
Fix false negative 2019-02-26 17:29:36 +01:00
Wilco Kusee
54ab22f6db
Only suggest map_or for copy types 2019-02-26 17:27:40 +01:00
Michael Wright
7a43509cc4 rustfmt tests/ui/methods.rs 2019-02-22 08:05:21 +02:00
Michael Wright
b96c4329db Add #[rustfmt::skip] to methods tests
Many people run rustfmt automatically on save. Format-dependent tests
should be marked with `#[rustfmt::skip]` to prevent accidental
reformatting from this. As a bonus the rest of the code can the formatted.
2019-02-22 07:49:17 +02:00
Philipp Hansch
38d4ac7cea
Remove all copyright license headers
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498
2019-01-08 21:46:39 +01:00
Philipp Hansch
a5d3f37c5a
Use compiletest's aux-build header instead of include macro 2019-01-02 22:48:44 +01:00
Philipp Hansch
0c54913afe
Extract IteratorFalsePositives into option_helpers.rs
This was previously duplicated in #3605
2019-01-02 07:49:28 +01:00
Philipp Hansch
eaaee23847
UI test cleanup: Extract lint from methods.rs test 2019-01-02 07:23:00 +01:00
Philipp Hansch
8c4c458ee9
UI test cleanup: Extract iter_skip_next from methods.rs
cc #2038
2018-12-30 13:46:21 +01:00
Russell Greene
d127aed737 Merge new_without_default_derive into new_without_default 2018-12-28 10:57:58 -07:00
flip1995
d2dbd0b8a5
Update *.stderr files 2018-12-28 12:41:12 +01:00
Matthias Krüger
9b839cd4b5 update line numbers of tests 2018-12-09 17:24:08 +01:00
Philipp Hansch
26569f3dde
UI test cleanup: Extract expect_fun_call tests
Note that the new stderr file does not include a `shadow-unrelated`
error, because the new UI test file does not use `#![warn(clippy::all)]`
2018-11-02 07:18:56 +01:00
Philipp Hansch
840e50e97f
Don't expand macro in or_fun_call suggestion 2018-10-27 15:47:56 +02:00
Josh Mcguigan
348d18ebd8 Removed new_ret_no_self tests from method.rs 2018-10-13 06:25:10 -07:00
Michael Wright
7499cb543d Fix #2937 2018-10-10 07:52:58 +02:00
Manish Goregaokar
e9c025ea70 Add license header to Rust files 2018-10-06 09:43:08 -07:00
flip1995
e9af09c274 Adapt the *.stderr files of the ui-tests to the tool_lints 2018-08-29 11:08:29 -07:00
Dale Wijnand
7933d445d1
Move shadow_unrelated to pedantic 2018-08-14 09:52:27 +01:00
Michael Wright
534d546c81 Fix #2979 2018-08-02 08:56:53 +02:00