Commit graph

26 commits

Author SHA1 Message Date
Alex Macleod
1d107ab2be Remove $DIR replacement in test output 2024-02-17 12:34:54 +00:00
Quinn Sinclair
fe8c2e24bd Fixed FP in unused_io_amount for Ok(lit), unrachable!
We introduce the following rules for match exprs.
- `panic!` and `unreachable!` are treated as consumption.
- guard expressions in any arm imply consumption.

For match exprs:
- Lint only if exacrtly 2 non-consuming arms exist
- Lint only if one arm is an `Ok(_)` and the other is `Err(_)`

Added additional requirement that for a block return expression
that is a match, the source must be `Normal`.

changelog: FP [`unused_io_amount`] when matching Ok(literal)
2024-02-01 17:05:12 +01:00
Quinn Sinclair
f73879e096 unused_io_amount captures Ok(_)s
Partial rewrite of `unused_io_account` to lint over Ok(_).

Moved the check to `check_block` to simplify context checking for
expressions and allow us to check only some expressions.

For match (expr, arms) we emit a lint for io ops used on `expr` when an
arm is `Ok(_)`. Also considers the cases when there are guards in the
arms. It also captures `if let Ok(_) = ...` cases.

For `Ok(_)` it emits a note indicating where the value is ignored.

changelog: False Negatives [`unused_io_amount`]: Extended
`unused_io_amount` to catch `Ok(_)`s in `If let` and match exprs.
2024-01-21 02:49:27 +01:00
Urgau
a86e758228 Adjust clippy tests with new rustc help suggestion for lints 2023-09-04 14:22:02 +02:00
Philipp Krones
cc61aeea54 Merge commit '080b587854a73f2a8cbaecff1884860a78e2ff37' into clippyup 2023-08-24 21:32:12 +02:00
Philipp Krones
e7fe1f9c14 Merge commit '0f7558148c22e53cd4608773b56cdfa50dcdeac3' into clippyup 2023-02-10 14:01:19 +01:00
Maybe Waffle
8dfbad9e49 bless clippy 2022-10-01 10:03:06 +00:00
flip1995
fb0142ae41 Merge commit '97a5daa65908e59744e2bc625b14849352231c75' into clippyup 2022-01-13 13:18:19 +01:00
flip1995
ae72f1adb9 Merge commit '7c7683c8efe447b251d6c5ca6cce51233060f6e8' into clippyup 2021-04-27 16:55:11 +02:00
Shotaro Yamada
b3971fdd5d Lint vectored IO in unused_io_amount lint 2020-01-09 23:46:55 +09:00
flip1995
e1d573c242
Rustup to rust-lang/rust#62672
try macro is deprecated now, so Clippy will drop the support for it also
2019-08-15 10:14:06 +02:00
uHOOCCOOHu
5265ab8723
Fix tests for edition 2018 compatibility 2019-07-23 03:59:09 +08: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
flip1995
d2dbd0b8a5
Update *.stderr files 2018-12-28 12:41:12 +01:00
Matthias Krüger
38fabcbdf2 tests: fix formatting and update test output
fix script one last time™
2018-12-27 17:03:53 +01:00
Matthias Krüger
7bcc2cd9c8 update test stderr 2018-12-10 08:22:07 +01: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
Oliver Schneider
4f21b5b112
Update changed ui tests 2018-01-17 14:44:40 +01:00
Oliver Schneider
ad63e4eaef
Update ui output to latest nightly 2017-11-29 15:45:12 +01:00
Oliver Schneider
af718413db
Rustup 2017-11-22 10:55:12 +01:00
Oliver Schneider
50ffaca4c9
Reduce the hackiness of cargo-clippy 2017-10-03 12:07:24 +02:00
Oliver Schneider
74c776585c Move all our tests back to ui tests 2017-08-01 17:54:21 +02:00
Oliver Schneider
4465bc3e3f Make most tests an example so we can run them one by one 2017-05-17 14:19:44 +02:00
Luis de Bethencourt
fd3c001ec9 clean tests/ui/unused_io_amount.rs
Cleaning the empty lines for clarity.
2017-05-11 16:22:32 +01:00
Oliver Schneider
fd1351f6e3 rustup and compile-fail -> ui test move 2017-02-07 21:05:30 +01:00