From ffa76cb02e06592b12bacee4288adc545086a5d7 Mon Sep 17 00:00:00 2001 From: wcampbell Date: Mon, 17 Jul 2023 21:03:40 -0400 Subject: [PATCH] backhand: Fix clippy::incorrect_clone_impl_on_copy_type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove manual Clone impl for FilesystemReaderFile. * See: https://rust-lang.github.io/rust-clippy/master/index.html#/incorrect_clone_impl_on_copy_type > If both Clone and Copy are implemented, they must agree. > This is done by dereferencing self in Clone’s implementation. > Anything else is incorrect. --- CHANGELOG.md | 1 + src/filesystem/reader.rs | 11 +---------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a602a550..0830f973 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## backhand ### Bug Fix - When creating an empty image using `FilesystemWriter::default()`, correctly create the ID table for UID and GID entries. Reported: ([@hwittenborn](https://github.com/hwittenborn)) ([!250](https://github.com/wcampbell0x2a/backhand/issues/275)), Fixed: ([#275](https://github.com/wcampbell0x2a/backhand/pull/275)) +- Remove manual `Clone` impl for `FilesystemReaderFile` ([#277](https://github.com/wcampbell0x2a/backhand/pull/277)) ## All binaries ### Changes diff --git a/src/filesystem/reader.rs b/src/filesystem/reader.rs index f16d0e2f..02d1e86e 100644 --- a/src/filesystem/reader.rs +++ b/src/filesystem/reader.rs @@ -169,21 +169,12 @@ impl FilesystemReader { } /// Filesystem handle for file -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct FilesystemReaderFile<'a> { pub(crate) system: &'a FilesystemReader, pub(crate) basic: &'a BasicFile, } -impl<'a> Clone for FilesystemReaderFile<'a> { - fn clone(&self) -> Self { - Self { - system: self.system, - basic: self.basic, - } - } -} - impl<'a> FilesystemReaderFile<'a> { pub fn new(system: &'a FilesystemReader, basic: &'a BasicFile) -> Self { Self { system, basic }