From d16cfd264d3173fe64a883dea67e9975dc7bbb2d Mon Sep 17 00:00:00 2001 From: Guillaume Pinot Date: Fri, 5 Mar 2021 11:41:32 +0100 Subject: [PATCH] fix clippy --- structopt-derive/src/attrs.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/structopt-derive/src/attrs.rs b/structopt-derive/src/attrs.rs index 11655b8..aa16145 100644 --- a/structopt-derive/src/attrs.rs +++ b/structopt-derive/src/attrs.rs @@ -100,7 +100,7 @@ impl Method { Method { name, args } } - fn from_lit_or_env(ident: Ident, lit: Option, env_var: &str) -> Option { + fn from_lit_or_env(ident: Ident, lit: Option, env_var: &str) -> Self { let mut lit = match lit { Some(lit) => lit, @@ -121,7 +121,7 @@ impl Method { lit = LitStr::new(&edited, lit.span()); } - Some(Method::new(ident, quote!(#lit))) + Method::new(ident, quote!(#lit)) } } @@ -335,11 +335,15 @@ impl Attrs { } About(ident, about) => { - self.about = Method::from_lit_or_env(ident, about, "CARGO_PKG_DESCRIPTION"); + self.about = Some(Method::from_lit_or_env( + ident, + about, + "CARGO_PKG_DESCRIPTION", + )); } Author(ident, author) => { - self.author = Method::from_lit_or_env(ident, author, "CARGO_PKG_AUTHORS"); + self.author = Some(Method::from_lit_or_env(ident, author, "CARGO_PKG_AUTHORS")); } Version(ident, version) => {