From 9317bc5afa38a989af95828acab324bd33e960b1 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 26 Jan 2018 00:22:38 -0800 Subject: [PATCH] Address clippy lints in serde_derive_internals --- serde_derive_internals/src/ast.rs | 2 +- serde_derive_internals/src/attr.rs | 7 +++++-- serde_derive_internals/src/lib.rs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/serde_derive_internals/src/ast.rs b/serde_derive_internals/src/ast.rs index 8fb9a83b..2ba1f5d9 100644 --- a/serde_derive_internals/src/ast.rs +++ b/serde_derive_internals/src/ast.rs @@ -158,7 +158,7 @@ fn fields_from_ast<'a>( ident: field.ident, attrs: attr::Field::from_ast(cx, i, field, attrs, container_default), ty: &field.ty, - original: &field, + original: field, }) .collect() } diff --git a/serde_derive_internals/src/attr.rs b/serde_derive_internals/src/attr.rs index c32c256c..7081907e 100644 --- a/serde_derive_internals/src/attr.rs +++ b/serde_derive_internals/src/attr.rs @@ -1167,7 +1167,9 @@ fn parse_lit_into_lifetimes( } return Ok(set); } - Err(cx.error(format!("failed to parse borrowed lifetimes: {:?}", string.value()))) + + cx.error(format!("failed to parse borrowed lifetimes: {:?}", string.value())); + Err(()) } // Whether the type looks like it might be `std::borrow::Cow` where elem="T". @@ -1289,7 +1291,8 @@ fn borrowable_lifetimes( let mut lifetimes = BTreeSet::new(); collect_lifetimes(ty, &mut lifetimes); if lifetimes.is_empty() { - Err(cx.error(format!("field `{}` has no lifetimes to borrow", name))) + cx.error(format!("field `{}` has no lifetimes to borrow", name)); + Err(()) } else { Ok(lifetimes) } diff --git a/serde_derive_internals/src/lib.rs b/serde_derive_internals/src/lib.rs index c1630a9e..0119d7f7 100644 --- a/serde_derive_internals/src/lib.rs +++ b/serde_derive_internals/src/lib.rs @@ -7,7 +7,7 @@ // except according to those terms. #![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.19.0")] -#![cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity, doc_markdown, match_same_arms, unit_expr))] +#![cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity, doc_markdown, match_same_arms))] #[macro_use] extern crate syn;