Commit graph

26 commits

Author SHA1 Message Date
Oli Scherer
3d88fae050 Update ui test crate 2023-08-11 14:02:28 +00:00
Centri3
51b57723d1 new lint redundant_guards 2023-07-22 06:28:05 -05:00
y21
2e856fa99b add test for block comment and add note to description 2023-06-19 20:07:31 +02:00
y21
d7e723441e [single_match]: don't lint if block contains comments 2023-06-19 17:18:27 +02:00
Centri3
26f50395ba Add needless_if lint 2023-06-10 06:51:03 -05:00
Yuri Astrakhan
ed935de087 Run-rustfix 2023-05-22 23:00:28 -04:00
Yuri Astrakhan
9fd34e0c75 Use #[rustfmt::skip] 2023-05-22 20:02:45 -04:00
Yuri Astrakhan
1c277d1be8 Unit tests highlighting unsafe match issue
These unit tests generate non-compilable code.  I did NOT `bless` them on purpose because the stderr output is not good.

I'm surprised we don't auto-compile the suggestions here - is this something that can be easily enabled?

See #10808
2023-05-22 02:48:14 -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
Jason Newcomb
8ce2d46cac Check for cfg attrubutes before linting match expressions 2022-02-17 14:04:10 -05:00
Georgy Komarov
467a0bfdea matches: Restore match_type logic; add tests for these cases 2022-01-26 18:20:35 +03:00
Georgy Komarov
a0c5087520 single_match: Clarify the don't lint test case 2022-01-21 07:28:26 +03:00
Georgy Komarov
a5a07e503f single_match: Don't lint non-exhaustive matches; support tuples
This commit changes the behavior of `single_match` lint.

After that, we won't lint non-exhaustive matches like this:

```rust
match Some(v) {
    Some(a) => println!("${:?}", a),
    None => {},
}
```

The rationale is that, because the type of `a` could be changed, so the
user can get non-exhaustive match after applying the suggested lint (see
https://github.com/rust-lang/rust-clippy/issues/8282#issuecomment-1013566068
for context).

We also will lint `match` constructions with tuples. When we see the
tuples on the both arms, we will check them both at the same time, and
if they form exhaustive match, we could display the warning.

Closes #8282
2022-01-20 15:14:25 +03:00
Jason Newcomb
9a55c0c176
Fix single_match
Check for `PartialEq` in addition to `StructuralPartialEq` before suggesting `==`
2021-04-15 22:09:20 -04:00
Jason Newcomb
85edd65bf6
Address review comments
Add: attempt to remove address of expressions from the scrutinee expression before adding references to the pattern
2021-01-14 14:26:26 -05:00
Jason Newcomb
8d7417d807
Add: single_match will suggest using if .. == .. instead of if let when applicable 2021-01-10 23:32:23 -05:00
pmk21
79ab05458f Small formatting change 2020-03-31 16:13:51 +05:30
pmk21
ba6a3280f5 Added test for single_match in macro 2020-03-31 15:49:27 +05:30
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
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
Matthias Krüger
435299be30 rustfmt tests 2018-12-09 23:26:16 +01:00
Philipp Hansch
af1548f58f
Don't expand macro in single_match suggestion 2018-10-27 15:47:56 +02:00
Oliver Scherer
b8654eaa6c Stabilize tool lints 2018-10-11 12:16:22 +02:00
Manish Goregaokar
e9c025ea70 Add license header to Rust files 2018-10-06 09:43:08 -07:00
flip1995
1b6f6051a8 Adapt ui-tests to the tool_lints 2018-08-29 11:08:29 -07:00
Philipp Hansch
641f0685d0
Split up some single_match UI tests
This moves only the single_match tests over to the new file.
2018-04-05 22:45:36 +02:00