From df7bc4e2d9a8a9ce4039bb2e90665a29cc4f5d4d Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Thu, 9 May 2024 21:02:30 +0200 Subject: [PATCH] fix nightly clippy warnings Note that this still compiles warning-free with rustc 1.70. --- derive/Cargo.toml | 2 +- derive/src/argument.rs | 3 --- tests/options.rs | 3 ++- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/derive/Cargo.toml b/derive/Cargo.toml index 5ce3d7b..1e6b1a3 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] -proc_macro = true +proc-macro = true [dependencies] proc-macro2 = "1.0.81" diff --git a/derive/src/argument.rs b/derive/src/argument.rs index ddb4a5a..dec13c2 100644 --- a/derive/src/argument.rs +++ b/derive/src/argument.rs @@ -13,7 +13,6 @@ use crate::{ pub struct Argument { pub ident: Ident, pub field: Option, - pub name: String, pub arg_type: ArgType, pub help: String, } @@ -41,7 +40,6 @@ pub fn parse_arguments_attr(attrs: &[Attribute]) -> ArgumentsAttr { pub fn parse_argument(v: Variant) -> Vec { let ident = v.ident; - let name = ident.to_string(); let attributes = get_arg_attributes(&v.attrs).unwrap(); // Return early because we don't need to check the fields if it's not used. @@ -94,7 +92,6 @@ pub fn parse_argument(v: Variant) -> Vec { Argument { ident: ident.clone(), field: field.clone(), - name: name.clone(), arg_type, help: arg_help, } diff --git a/tests/options.rs b/tests/options.rs index 1f1e972..2475db0 100644 --- a/tests/options.rs +++ b/tests/options.rs @@ -286,7 +286,7 @@ fn actions() { fn apply(&mut self, arg: Arg) { match arg { Arg::Message(m) => { - self.last_message = m.clone(); + self.last_message.clone_from(&m); self.messages.push(m); } Arg::Send => self.send = true, @@ -617,6 +617,7 @@ fn empty_value() { Val(V), } + #[allow(dead_code)] struct Settings {} impl Options for Settings {