Commit graph

16 commits

Author SHA1 Message Date
xFrednet
811d73a2b7
Test #[expect] for redundant_clone 2022-06-25 14:16:29 +02:00
Jason Newcomb
5cd711b4f1 Add lints drop_non_drop and forget_non_drop 2022-04-04 12:30:09 -04:00
Andre Bogus
a4ede72b3d update most tests to 2021 edition 2021-10-30 14:50:53 +02:00
lyj
251c3b64da fix 5707 2021-07-14 10:57:47 +08:00
Jason Newcomb
aaba9b78a2
Fix redundant_clone fp where the cloned value is modified while the clone is in use. 2021-03-31 15:35:34 -04:00
Cameron Steffen
ada8c72f3f Add version = "Two" to rustfmt.toml
Ignore UI tests since this change makes rustfmt less friendly with UI
test comments.
2021-03-01 16:17:33 -06:00
Andrea Nall
3d3cfd3754 added new lint implicit_clone 2021-02-26 19:13:47 -06:00
Tomasz Miąsko
a5cdd4aeb1 Ignore not really redundant clones of ManuallyDrop
"Redundant" clones of `ManuallyDrop` are sometimes used for the side effect of
invoking the clone, without running the drop implementation of the inner type.
In other words, they aren't really redundant. For example, futures-rs crate:

```rust
#[allow(clippy::redundant_clone)] // The clone here isn't actually redundant.
unsafe fn increase_refcount<T: ArcWake>(data: *const ()) {
    // Retain Arc, but don't touch refcount by wrapping in ManuallyDrop
    let arc = mem::ManuallyDrop::new(Arc::<T>::from_raw(data as *const T));
    // Now increase refcount, but don't drop new refcount either
    let _arc_clone: mem::ManuallyDrop<_> = arc.clone();
}
```

Ignore redundant clone lint for ManuallyDrop.
2020-07-20 00:56:27 +02:00
Rabi Guha
ab3946d7e9 Fixes #5405: redundant clone false positive with arrays
Check whether slice elements implement Copy before suggesting to drop
the clone method
2020-04-13 11:43:42 +05:30
Shotaro Yamada
d9ad33852c Use visit_place 2020-03-13 02:06:47 +09:00
Shotaro Yamada
aca64b8df7 Check for mutation 2020-03-13 01:25:18 +09:00
Shotaro Yamada
9de642190e Extend redundant_clone to the case that cloned value is not consumed 2020-03-13 00:31:09 +09:00
Shotaro Yamada
99eec3f54f Fix redundant_clone 2020-01-08 14:18:00 +09:00
flip1995
e3a74ed2b5
Set mir_opt_level=0
This introduces some FNs. But a building Clippy is more important for now
2019-11-22 14:25:44 +01:00
Manish Goregaokar
d183bda0be Rustup to rustc 1.41.0-nightly (d1da8023d 2019-11-19) 2019-11-19 00:32:35 -08:00
Shotaro Yamada
667223c35d Add run-rustfix 2019-10-03 08:10:29 +09:00