Commit graph

41 commits

Author SHA1 Message Date
Samuel Moelius
877585089e Fix non-lifetime tests 2024-09-25 13:52:12 -04:00
Samuel Tardieu
6371b308d8 Make it clearer that the suggestion is an alternative one
`needless_pass_by_value` sometimes suggest marking the concerned type as
`Copy`. Adding a `or` before this suggestion makes it clearer that this
is not the second part of the original suggestion, but an alternative one.
2024-09-12 16:32:56 +02:00
Yuri Astrakhan
197b444407 Ignore underscore-prefixed args for needless_pass_by_value lint
When a user explicitly tags a param as unused (yet?), there is no need to raise another lint on it.
2024-07-16 18:00:11 -04:00
Alex Macleod
1d107ab2be Remove $DIR replacement in test output 2024-02-17 12:34:54 +00: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
d75b25faab Merge commit 'ac0e10aa68325235069a842f47499852b2dee79e' into clippyup 2022-10-06 09:44:38 +02:00
Camille GILLOT
d5e33d3ded Shorten def_span for more items. 2022-07-01 17:39:19 +02:00
flip1995
23d5457e6d Merge commit 'cb7915b00c235e9b5861564f3be78dba330980ee' into clippyup 2021-09-28 18:03:12 +01:00
Esteban Kuber
652b6a771f update clippy 2021-08-11 14:21:33 +00:00
Yuki Okushi
07e33633a3 Update stderrs 2020-01-07 18:38:12 +09:00
Lzu Tao
fdc0153ef5 rustup improper_ctypes: extern "C" fns 2019-11-07 00:49:33 +07:00
flip1995
4a52dd6c53
Rustup to rust-lang/rust#65773 2019-10-26 21:54:04 +02:00
flip1995
c420b07191
Fix needless_pass_by_value
This also accidentally improved the spans of the suggestions
2019-10-04 15:39:46 +02:00
Shotaro Yamada
555f5a49a2 Test fixes 2019-10-03 08:10:29 +09:00
Philipp Hansch
f3cd81980d
Fix ICE in needless_pass_by_value lint
If I understand it correctly, we were first creating a type with a
`RegionKind::ReErased` region and then deleted it again in
`util::implements_trait` with:

    cx.tcx.erase_regions(&ty);

causing the type query to fail.

It looks like using `ReEmpty` works around that deletion.
2019-02-06 09:18:35 +01: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
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
Philipp Hansch
eb5f146f14
Fix 'impossible case reached' ICE 2018-10-01 22:34:52 +02:00
flip1995
e9af09c274 Adapt the *.stderr files of the ui-tests to the tool_lints 2018-08-29 11:08:29 -07:00
Mateusz Mikuła
8ed8ee895a Update to nightly 2018-05-28 2018-05-29 10:56:58 +02:00
Oliver Schneider
8217e33718
Only suggest implementing Copy if it can actually be done 2018-01-18 14:27:47 +01:00
Manish Goregaokar
552e950080 needless_pass_by_value: Whitelist RangeArgument (fixes #2357) 2018-01-18 14:30:53 +05:30
Manish Goregaokar
2a30c8a194 needless_pass_by_value: Add suggestion for implementing Copy (fixes #2222) 2018-01-18 14:30:47 +05:30
Oliver Schneider
4f21b5b112
Update changed ui tests 2018-01-17 14:44:40 +01:00
Laurent Mazare
e7f4a9bb46 Fix for the new nightly version. 2017-11-20 07:47:28 +00:00
sinkuu
d88cc5376e Add test to take Self as an argument 2017-11-03 17:56:26 +09:00
sinkuu
cad33c0306 Extend needless_pass_by_value to methods 2017-11-03 17:36:38 +09:00
sinkuu
2be6245179 Duplicate ptr_arg's suggestion logic 2017-10-08 17:51:44 +09:00
sinkuu
bf97cd0338 Reduce false-positives for needless_pass_by_value lint
Excluding a type whose reference also fulfills the trait bound.
2017-10-08 17:25:56 +09: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
Oliver Schneider
a6c8464dde Update to rustc 1.19.0-nightly (6a5fc9eec 2017-05-02) 2017-05-03 12:51:47 +02:00
sinkuu
cb86c57c5f Integrate suggestion spans 2017-02-21 19:03:50 +09:00
sinkuu
3516d45d7c Use multispan_sugg 2017-02-21 18:44:31 +09:00
sinkuu
627d24c80f Fix suggestion for let <pat> 2017-02-21 00:27:12 +09:00
sinkuu
f1b0b774e7 Support non-moving usages at match
This `match` is not moving the `String`:

```rust
fn foo(x: Option<String>) -> i32 {
    match x {
        Some(_) => 1,
        None => 2,
    }
}
```

With this change, it will be linted and suggested to add `*` to deref it.

```rust
fn foo(x: &Option<String>) -> i32 {
    match *x {
        Some(_) => 1,
        None => 2,
    }
}
```
2017-02-20 16:45:37 +09:00
sinkuu
0a6bc6031a Rename lint to needless_take_by_value
And fixes false-positives for generics and `match`
2017-02-20 16:02:48 +09:00