Merge pull request #2594 from Uzaaft/master

Fix: Use `&[T]` instead of `&Vec<T>` wherever possible
This commit is contained in:
David Tolnay 2023-08-23 16:09:22 -07:00 committed by GitHub
commit e797c90ebd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -710,7 +710,7 @@ fn serialize_adjacently_tagged_variant(
}); });
let fields_ty = variant.fields.iter().map(|f| &f.ty); let fields_ty = variant.fields.iter().map(|f| &f.ty);
let fields_ident: &Vec<_> = &match variant.style { let fields_ident: &[_] = &match variant.style {
Style::Unit => { Style::Unit => {
if variant.attrs.serialize_with().is_some() { if variant.attrs.serialize_with().is_some() {
vec![] vec![]

View File

@ -843,7 +843,7 @@ pub fn is_zero(n: &u8) -> bool {
*n == 0 *n == 0
} }
fn vec_first_element<T, S>(vec: &Vec<T>, serializer: S) -> StdResult<S::Ok, S::Error> fn vec_first_element<T, S>(vec: &[T], serializer: S) -> StdResult<S::Ok, S::Error>
where where
T: Serialize, T: Serialize,
S: Serializer, S: Serializer,