Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Pinot committed Mar 5, 2021
1 parent 8161b15 commit d16cfd2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions structopt-derive/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl Method {
Method { name, args }
}

fn from_lit_or_env(ident: Ident, lit: Option<LitStr>, env_var: &str) -> Option<Self> {
fn from_lit_or_env(ident: Ident, lit: Option<LitStr>, env_var: &str) -> Self {
let mut lit = match lit {
Some(lit) => lit,

Expand All @@ -121,7 +121,7 @@ impl Method {
lit = LitStr::new(&edited, lit.span());
}

Some(Method::new(ident, quote!(#lit)))
Method::new(ident, quote!(#lit))
}
}

Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit d16cfd2

Please sign in to comment.