Skip to content

Commit

Permalink
Suppress incorrect_clone_impl_on_copy_type clippy false positive
Browse files Browse the repository at this point in the history
rust-lang/rust-clippy#11072

    error: incorrect implementation of `clone` on a `Copy` type
      --> src/lib.rs:93:29
       |
    93 |       fn clone(&self) -> Self {
       |  _____________________________^
    94 | |         Buffer::new()
    95 | |     }
       | |_____^ help: change this to: `{ *self }`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incorrect_clone_impl_on_copy_type
       = note: `-D clippy::incorrect-clone-impl-on-copy-type` implied by `-D clippy::all`
  • Loading branch information
dtolnay committed Jul 3, 2023
1 parent 58f5cc2 commit ab86a74
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ impl Copy for Buffer {}

impl Clone for Buffer {
#[inline]
#[allow(clippy::incorrect_clone_impl_on_copy_type)] // false positive https://github.com/rust-lang/rust-clippy/issues/11072
fn clone(&self) -> Self {
Buffer::new()
}
Expand Down

0 comments on commit ab86a74

Please sign in to comment.