Re: [libgpiod][PATCH] bindings: rust: remove useless clone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28-09-23, 08:23, Erik Schilling wrote:
> Reported by 1.74.0-nightly:
> 
>   warning: call to `.clone()` on a reference in this situation does nothing
>     --> libgpiod/tests/line_request.rs:71:44
>      |
>   71 |             let chip_name = sim.chip_name().clone();
>      |                                            ^^^^^^^^ help: remove this redundant call
>      |
>      = note: the type `str` does not implement `Clone`, so calling `clone` on `&str` copies the reference, which does not do anything and can be removed
>      = note: `#[warn(noop_method_call)]` on by default
> 
> Signed-off-by: Erik Schilling <erik.schilling@xxxxxxxxxx>
> ---
> Found while running nightly toolchains in order to run tests under the
> AddressSanitizers.
> 
> To: Linux-GPIO <linux-gpio@xxxxxxxxxxxxxxx>
> Cc: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> ---
>  bindings/rust/libgpiod/tests/line_request.rs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/bindings/rust/libgpiod/tests/line_request.rs b/bindings/rust/libgpiod/tests/line_request.rs
> index 9af5226..da22bea 100644
> --- a/bindings/rust/libgpiod/tests/line_request.rs
> +++ b/bindings/rust/libgpiod/tests/line_request.rs
> @@ -68,7 +68,7 @@ mod line_request {
>  
>              let arc = config.sim();
>              let sim = arc.lock().unwrap();
> -            let chip_name = sim.chip_name().clone();
> +            let chip_name = sim.chip_name();
>  
>              assert_eq!(config.request().chip_name().unwrap(), chip_name);
>          }

Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>

-- 
viresh



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux