Skip to content

Commit f93ebac

Browse files
fixup! Don’t require explicit index for skipped fields
1 parent 9e4bed4 commit f93ebac

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ fn serialize_fields(
5555
.iter()
5656
.filter(|field| !field.skip_serializing_if.is_always())
5757
.map(|field| {
58+
// index should only be none if the field is always skipped, so this should never panic
5859
let index = field.index.expect("index must be set for fields that are not skipped") + offset;
5960
let member = &field.member;
6061
let serialize_member = match &field.serialize_with {
@@ -223,6 +224,7 @@ fn match_fields(
223224
.map(|field| {
224225
let label = field.label.clone();
225226
let ident = format_ident!("{}", &field.label);
227+
// index should only be none if the field is always skipped, so this should never panic
226228
let index = field.index.expect("index must be set for fields that are not skipped") + offset;
227229
let span = field.original_span;
228230

0 commit comments

Comments
 (0)