mirror of
https://github.com/serde-rs/serde.git
synced 2025-10-02 07:21:12 +00:00
Address clippy lints in serde_derive_internals
This commit is contained in:
parent
a185df1e77
commit
9317bc5afa
@ -158,7 +158,7 @@ fn fields_from_ast<'a>(
|
|||||||
ident: field.ident,
|
ident: field.ident,
|
||||||
attrs: attr::Field::from_ast(cx, i, field, attrs, container_default),
|
attrs: attr::Field::from_ast(cx, i, field, attrs, container_default),
|
||||||
ty: &field.ty,
|
ty: &field.ty,
|
||||||
original: &field,
|
original: field,
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
@ -1167,7 +1167,9 @@ fn parse_lit_into_lifetimes(
|
|||||||
}
|
}
|
||||||
return Ok(set);
|
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<T>` where elem="T".
|
// Whether the type looks like it might be `std::borrow::Cow<T>` where elem="T".
|
||||||
@ -1289,7 +1291,8 @@ fn borrowable_lifetimes(
|
|||||||
let mut lifetimes = BTreeSet::new();
|
let mut lifetimes = BTreeSet::new();
|
||||||
collect_lifetimes(ty, &mut lifetimes);
|
collect_lifetimes(ty, &mut lifetimes);
|
||||||
if lifetimes.is_empty() {
|
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 {
|
} else {
|
||||||
Ok(lifetimes)
|
Ok(lifetimes)
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#![doc(html_root_url = "https://docs.rs/serde_derive_internals/0.19.0")]
|
#![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]
|
#[macro_use]
|
||||||
extern crate syn;
|
extern crate syn;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user