mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-14 03:31:02 +00:00
Address clippy lint "ptr_arg"
This commit is contained in:
@@ -137,12 +137,12 @@ impl ContainerAttrs {
|
|||||||
self.deny_unknown_fields
|
self.deny_unknown_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ser_where(&self) -> Option<&Vec<ast::WherePredicate>> {
|
pub fn ser_where(&self) -> Option<&[ast::WherePredicate]> {
|
||||||
self.ser_where.as_ref()
|
self.ser_where.as_ref().map(Vec::as_slice)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn de_where(&self) -> Option<&Vec<ast::WherePredicate>> {
|
pub fn de_where(&self) -> Option<&[ast::WherePredicate]> {
|
||||||
self.de_where.as_ref()
|
self.de_where.as_ref().map(Vec::as_slice)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,12 +361,12 @@ impl FieldAttrs {
|
|||||||
self.deserialize_with.as_ref()
|
self.deserialize_with.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ser_where(&self) -> Option<&Vec<ast::WherePredicate>> {
|
pub fn ser_where(&self) -> Option<&[ast::WherePredicate]> {
|
||||||
self.ser_where.as_ref()
|
self.ser_where.as_ref().map(Vec::as_slice)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn de_where(&self) -> Option<&Vec<ast::WherePredicate>> {
|
pub fn de_where(&self) -> Option<&[ast::WherePredicate]> {
|
||||||
self.de_where.as_ref()
|
self.de_where.as_ref().map(Vec::as_slice)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ pub fn without_defaults(generics: &ast::Generics) -> ast::Generics {
|
|||||||
pub fn with_where_predicates(
|
pub fn with_where_predicates(
|
||||||
builder: &AstBuilder,
|
builder: &AstBuilder,
|
||||||
generics: &ast::Generics,
|
generics: &ast::Generics,
|
||||||
predicates: &Vec<ast::WherePredicate>,
|
predicates: &[ast::WherePredicate],
|
||||||
) -> ast::Generics {
|
) -> ast::Generics {
|
||||||
builder.from_generics(generics.clone())
|
builder.from_generics(generics.clone())
|
||||||
.with_predicates(predicates.clone())
|
.with_predicates(predicates.to_vec())
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,14 +41,14 @@ pub fn with_where_predicates_from_fields<F>(
|
|||||||
generics: &ast::Generics,
|
generics: &ast::Generics,
|
||||||
from_field: F,
|
from_field: F,
|
||||||
) -> Result<ast::Generics, Error>
|
) -> Result<ast::Generics, Error>
|
||||||
where F: Fn(&attr::FieldAttrs) -> Option<&Vec<ast::WherePredicate>>,
|
where F: Fn(&attr::FieldAttrs) -> Option<&[ast::WherePredicate]>,
|
||||||
{
|
{
|
||||||
Ok(builder.from_generics(generics.clone())
|
Ok(builder.from_generics(generics.clone())
|
||||||
.with_predicates(
|
.with_predicates(
|
||||||
try!(all_fields_with_attrs(cx, item))
|
try!(all_fields_with_attrs(cx, item))
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|&(_, ref attrs)| from_field(attrs))
|
.flat_map(|&(_, ref attrs)| from_field(attrs))
|
||||||
.flat_map(|predicates| predicates.clone()))
|
.flat_map(|predicates| predicates.to_vec()))
|
||||||
.build())
|
.build())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user