Commit Graph

12 Commits

Author SHA1 Message Date
Esteban Küber
11061831f7 Mention type that could be Clone but isn't in more cases
When encountering a moved value of a type that isn't `Clone` because of unmet obligations, but where all the unmet predicates reference crate-local types, mention them and suggest cloning, as we do in other cases already:

```
error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure
  --> f111.rs:14:25
   |
13 | fn do_stuff(foo: Option<Foo>) {
   |             --- captured outer variable
14 |     require_fn_trait(|| async {
   |                      -- ^^^^^ `foo` is moved here
   |                      |
   |                      captured by this `Fn` closure
15 |         if foo.map_or(false, |f| f.foo()) {
   |            ---
   |            |
   |            variable moved due to use in coroutine
   |            move occurs because `foo` has type `Option<Foo>`, which does not implement the `Copy` trait
   |
note: if `Foo` implemented `Clone`, you could clone the value
  --> f111.rs:4:1
   |
4  | struct Foo;
   | ^^^^^^^^^^ consider implementing `Clone` for this type
...
15 |         if foo.map_or(false, |f| f.foo()) {
   |            --- you could clone this value
```
2025-07-25 18:34:10 +00:00
Kivooeo
b28806da23 cleaned up some tests 2025-07-05 00:45:24 +05:00
Kivooeo
986f1c9b69 moved tests 2025-07-01 18:21:05 +05:00
Esteban Küber
89ecae5d85 Better span for "make binding mutable" suggestion 2024-07-04 02:02:21 +00:00
yukang
be9dbe9102 Suggest ref mut for pattern matching assignment 2024-04-25 04:54:25 +08:00
许杰友 Jieyou Xu (Joe)
ec2cc761bc [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
Nilstrieb
41e8d152dc Show number in error message even for one error
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
Urgau
c93d9c1794 Rename drop_ref lint to dropping_references 2023-05-21 14:16:41 +02:00
Urgau
61ff2718f7 Adjust tests for new drop and forget lints 2023-05-10 19:36:02 +02:00
Ezra Shaw
87a1b3840e tweak spans for ref mut suggestion 2023-05-05 22:40:05 +12:00
Esteban Küber
656db98bd9 Tweak E0597
CC #99430
2023-01-15 19:46:20 +00:00
Albert Larsan
cf2dff2b1e Move /src/test to /tests 2023-01-11 09:32:08 +00:00