mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-12 02:41:04 +00:00
Resolve get_first clippy lint
warning: accessing first element with `variant.fields.get(0)`
--> serde_derive/src/de.rs:1843:27
|
1843 | let default = variant.fields.get(0).map(|field| {
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `variant.fields.first()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
= note: `-W clippy::get-first` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::get_first)]`
warning: accessing first element with `variant.fields.get(0)`
--> serde_derive/src/de.rs:1888:27
|
1888 | let default = variant.fields.get(0).map(|field| {
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `variant.fields.first()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
This commit is contained in:
@@ -1840,7 +1840,7 @@ fn deserialize_internally_tagged_variant(
|
|||||||
let this_value = ¶ms.this_value;
|
let this_value = ¶ms.this_value;
|
||||||
let type_name = params.type_name();
|
let type_name = params.type_name();
|
||||||
let variant_name = variant.ident.to_string();
|
let variant_name = variant.ident.to_string();
|
||||||
let default = variant.fields.get(0).map(|field| {
|
let default = variant.fields.first().map(|field| {
|
||||||
let default = Expr(expr_is_missing(field, cattrs));
|
let default = Expr(expr_is_missing(field, cattrs));
|
||||||
quote!((#default))
|
quote!((#default))
|
||||||
});
|
});
|
||||||
@@ -1885,7 +1885,7 @@ fn deserialize_untagged_variant(
|
|||||||
let this_value = ¶ms.this_value;
|
let this_value = ¶ms.this_value;
|
||||||
let type_name = params.type_name();
|
let type_name = params.type_name();
|
||||||
let variant_name = variant.ident.to_string();
|
let variant_name = variant.ident.to_string();
|
||||||
let default = variant.fields.get(0).map(|field| {
|
let default = variant.fields.first().map(|field| {
|
||||||
let default = Expr(expr_is_missing(field, cattrs));
|
let default = Expr(expr_is_missing(field, cattrs));
|
||||||
quote!((#default))
|
quote!((#default))
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user