Commit graph

37 commits

Author SHA1 Message Date
J-ZhengLi
cc1bb8f57a make [or_fun_call] and [unwrap_or_default] recursive. 2024-07-13 23:15:40 +08:00
J-ZhengLi
983b4c3720 [unwrap_or_default]: skip warning when calling inside of suggested method's implementation 2024-07-12 17:23:08 +08:00
y21
25d40c9f6b handle parent const effects correctly in type_certainty 2024-06-01 20:10:48 +02:00
Oli Scherer
3d88fae050 Update ui test crate 2023-08-11 14:02:28 +00:00
Samuel Moelius
84c411272d Merge unwrap_or_else_default.rs into or_fun_call.rs 2023-07-19 20:36:10 -04:00
Alex Macleod
2811effe34 Add imports_granularity = "Module" to rustfmt.toml 2023-07-13 12:44:57 +00:00
Pavan Kumar Sunkara
bfd5abad4b Fix all the other tests 2023-06-12 16:21:06 +01:00
y21
05f78e530a allow the lint in a bunch of tests 2023-06-06 22:56:57 +02:00
Oli Scherer
def1705a27 Update to a compiletest-rs version that requires //@ for commands 2023-04-20 14:44:03 +00:00
koka
a41cb7adbe
fix: support map_or for or_fun_call lint
* add `rest_arg` to pass second argument from `map_or(U, F)`
* extract some procedures into closure

refac: rename rest_arg/second_arg

refac: organize function argument order

* put `second_arg` next to `arg` argument
2022-10-23 23:20:20 +09:00
Jason Newcomb
39a7d000b6 Don't suggest moving tuple structs with a significant drop to late evaluation. 2022-10-08 11:23:05 -04:00
Yuri Astrakhan
eb3970285b fallout: fix tests to allow uninlined_format_args
In order to switch `clippy::uninlined_format_args` from pedantic to
style, all existing tests must not raise a warning. I did not want to
change the actual tests, so this is a relatively minor change that:

* add `#![allow(clippy::uninlined_format_args)]` where needed
* normalizes all allow/deny/warn attributes
   * all allow attributes are grouped together
   * sorted alphabetically
   * the `clippy::*` attributes are listed separate from the other ones.
   * deny and warn attributes are listed before the allowed ones

changelog: none
2022-10-02 15:13:22 -04:00
Guilherme-Vasconcelos
1bf8841479 Update all tests to comply with clippy::manual_empty_string_creations 2022-08-14 12:53:15 -03:00
Marek Downar
69d78ceeba
removing unsafe from test fn's && renaming shrink to sugg_span 2022-01-17 12:34:03 +01:00
Marek Downar
49502727e7
issue #8239: fix to prev commit && 4 test cases 2022-01-15 22:19:01 +01:00
Federico Guerinoni
3298de7f66 Add borrow_as_ptr lint
Closes: #6995

Signed-off-by: Federico Guerinoni <guerinoni.federico@gmail.com>
Co-authored-by: Paolo Barbolini <paolo@paolo565.org>
2022-01-11 09:53:29 +01:00
Jason Newcomb
2938ffd0d9 Improve heuristics for determining whether eager of lazy evaluation is preferred 2021-11-15 20:54:13 -05:00
Jade
11ef04728c Add unwrap_or_else_default lint
This will catch `unwrap_or_else(Default::default)` on Result and Option
and suggest `unwrap_or_default()` instead.
2021-08-10 14:40:26 -07:00
Jamie Quigley
45e775697e
Ignore str::len() in or_fun_call lint. 2021-03-22 19:34:20 +00:00
Mateusz Gacek
b1f89ee02f or_fun_call: trigger on unsafe blocks 2021-03-18 08:44:15 +01:00
Mateusz Gacek
2f0e9f7d3a or_fun_call: fix suggestion for or_insert(vec![])
Applies for `std::collections::hash_map::Entry` and `std::collections::btree_map::Entry`

Example:
Previously, for the following code:
`let _ = hash_map.entry("test".to_owned()).or_insert(vec![]);`
clippy would suggest to use:
`or_insert_with(vec![])`, which causes a compiler error (E0277).

Now clippy suggests:
`or_insert_with(Vec::new)`
2021-02-25 14:23:38 +01:00
Hirochika Matsumoto
c7445d7f2c Pluralize lint name 2020-11-18 01:28:37 +09:00
Hirochika Matsumoto
30632fb8e6 Allow this lint on lint tests 2020-11-18 01:28:37 +09:00
Cameron Steffen
9cab08465b Fix or_fun_call for index operator 2020-11-08 14:49:42 -06:00
Eduardo Broto
ce83d8d4d1 Revert "Avoid or_fun_call for const_fn with no args"
This reverts commit 5d66bd7bb3.
2020-09-23 00:39:00 +02:00
Eduardo Broto
3e294b22a4 Revert "or_fn_call: ignore nullary associated const fns"
This reverts commit 7a66e6502d.
2020-09-23 00:34:56 +02:00
Eduardo Broto
7a66e6502d or_fn_call: ignore nullary associated const fns 2020-08-29 01:20:49 +02:00
Eduardo Broto
5d66bd7bb3 Avoid or_fun_call for const_fn with no args 2020-08-10 23:38:58 +02:00
Jeremy Stucki
6bd9cd99a3
Add tests 2020-05-25 21:41:19 +02:00
flip1995
7d58ba20b4
Rustup to rust-lang/rust#70632 2020-04-01 20:14:05 +02:00
Matthias Krüger
b72982759c run rustfmt 2019-09-11 08:26:57 +02:00
Michael Wright
9bdfd0683f Fix or_fun_call bad suggestion
Closes #4514
2019-09-08 11:03:45 +02:00
Philipp Hansch
18fb1d9d2f
Add run-rustfix for or_fun_call tests 2019-08-22 07:41:00 +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
Philipp Hansch
de24a74b45
Add test for or_fun_call macro suggestion
Closes #1018
2019-04-24 08:11:20 +02:00
Philipp Hansch
fdc2255e81
UI test cleanup: Extract or_fun_call tests 2019-04-11 07:47:04 +02:00