4354 Commits

Author SHA1 Message Date
David Tolnay
fa7da4a935
Fix unused_features warning
warning: feature `never_type` is declared but not used
       --> serde/src/lib.rs:108:43
        |
    108 | #![cfg_attr(feature = "unstable", feature(never_type))]
        |                                           ^^^^^^^^^^
        |
        = note: `#[warn(unused_features)]` (part of `#[warn(unused)]`) on by default
2026-03-05 21:45:51 -08:00
David Tolnay
6b1a17851e
Unpin CI miri toolchain 2026-02-15 19:02:04 -08:00
David Tolnay
dd18663450
Fix redundant_closure clippy lint from PR 3038
warning: redundant closure
       --> serde_derive/src/ser.rs:461:65
        |
    461 |                 let field_names = (0..variant.fields.len()).map(|i| field_i(i));
        |                                                                 ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `field_i`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
        = note: `-W clippy::redundant-closure` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::redundant_closure)]`
2026-02-15 08:22:38 -08:00
David Tolnay
e65b3e7420
Merge pull request #3038 from dishmaker/dishmaker/serde_derive_field_i
serde_derive: reduce llvm-lines in ser.rs, reuse fn field_i
2026-02-15 08:21:05 -08:00
David Tolnay
9d17f29523
Merge pull request #3037 from dishmaker/dishmaker/serde_derive_ast_iter_enumerate
serde_derive: rewrite fields_from_ast with less llvm-lines
2026-02-15 08:19:12 -08:00
David Tolnay
789334771f
Merge pull request #3039 from cuiweixie/typo
typo: tokenenizable to tokenizable
2026-02-15 08:18:07 -08:00
Weixie Cui
7d8427c017 typo: tokenenizable tokenizable 2026-02-15 18:26:26 +08:00
dishmaker
ea04847eef serde_derive: rewrite serialize_struct_visitor 2026-02-13 12:02:01 +01:00
dishmaker
098da70a7e serde_derive: reduce llvm-lines in ser.rs, reuse fn field_i 2026-02-13 11:53:04 +01:00
dishmaker
1229fc8a6d serde_derive: rewrite fields_from_ast with less llvm-lines 2026-02-13 11:03:37 +01:00
David Tolnay
5fd91333c7
Fix semicolon_if_nothing_returned pedantic clippy lint
warning: consider adding a `;` to the last statement for consistent formatting
       --> serde_derive/src/pretend.rs:124:17
        |
    124 |                 patterns.push(quote!(#type_ident::#variant_ident { #(#members: #placeholders),* }))
        |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `patterns.push(quote!(#type_ident::#variant_ident { #(#members: #placeholders),* }));`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
        = note: `-W clippy::semicolon-if-nothing-returned` implied by `-W clippy::pedantic`
        = help: to override `-W clippy::pedantic` add `#[allow(clippy::semicolon_if_nothing_returned)]`
2026-02-12 11:59:11 -08:00
David Tolnay
3587aed5d4
Merge pull request #3035 from dishmaker/dishmaker/serde_derive_with_bound_llvml
serde_derive: rewrite with_bound without filter/chain/vec allocation
2026-02-12 10:46:46 -08:00
David Tolnay
888de67921
Merge pull request #3034 from dishmaker/dishmaker/serde_derive_less_filter_map
serde_derive: rewrite .iter().filter_map() with less llvm-lines
2026-02-12 10:43:55 -08:00
dishmaker
bfc9ccf686 serde_derive: rewrite with_bound without filter/chain/vec allocation 2026-02-12 15:49:28 +01:00
dishmaker
2c6d0d2e09 serde_derive: rewrite .iter().filter_map() with less llvm-lines 2026-02-12 15:06:29 +01:00
David Tolnay
681270e4f0
Raise required compiler for serde_derive to Rust 1.71 2026-02-08 14:04:22 -08:00
David Tolnay
d17902059e
Merge pull request #3019 from xibeiyoumian/master
chore: improve code comments clarity
2025-12-22 03:29:10 -08:00
xibeiyoumian
a27948e209 chore: improve code comments clarity
Signed-off-by: xibeiyoumian <xibeiyoumian@outlook.com>
2025-12-22 14:38:55 +08:00
David Tolnay
576e2ef9d8
Update actions/upload-artifact@v5 -> v6 2025-12-19 21:10:59 -08:00
David Tolnay
dd0eb0f2ca
Update actions/upload-artifact@v4 -> v5 2025-12-18 18:58:13 -08:00
David Tolnay
f7fc3e0d67
Update actions/checkout@v5 -> v6 2025-11-20 10:19:51 -08:00
David Tolnay
1c396d223b
Update actions/checkout@v4 -> v5 2025-11-20 10:19:04 -08:00
David Tolnay
e42684f9a7
Update ui test suite to nightly-2025-11-02 2025-11-01 22:38:40 -07:00
David Tolnay
56c29b3c5d
Update name of empty_enum clippy lint
warning: lint `clippy::empty_enum` has been renamed to `clippy::empty_enums`
       --> serde/src/lib.rs:122:5
        |
    122 |     clippy::empty_enum,
        |     ^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::empty_enums`
        |
        = note: `#[warn(renamed_and_removed_lints)]` on by default

    warning: lint `clippy::empty_enum` has been renamed to `clippy::empty_enums`
      --> serde_core/src/lib.rs:57:5
       |
    57 |     clippy::empty_enum,
       |     ^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::empty_enums`
       |
       = note: `#[warn(renamed_and_removed_lints)]` on by default

    warning: lint `clippy::empty_enum` has been renamed to `clippy::empty_enums`
     --> test_suite/tests/test_de.rs:5:5
      |
    5 |     clippy::empty_enum,
      |     ^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::empty_enums`
      |
      = note: `#[warn(renamed_and_removed_lints)]` on by default

    warning: lint `clippy::empty_enum` has been renamed to `clippy::empty_enums`
     --> test_suite/tests/test_de_error.rs:3:5
      |
    3 |     clippy::empty_enum,
      |     ^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::empty_enums`
      |
      = note: `#[warn(renamed_and_removed_lints)]` on by default
2025-11-01 22:37:05 -07:00
David Tolnay
5a44519a9a
Raise required compiler for serde_derive to Rust 1.68 2025-10-19 15:02:17 -07:00
David Tolnay
fae23fea97
Resolve manual_let_else pedantic clippy lint
warning: this could be rewritten as `let...else`
        --> serde_derive/src/internals/attr.rs:1460:5
         |
    1460 | /     let string = match get_lit_str(cx, attr_name, meta)? {
    1461 | |         Some(string) => string,
    1462 | |         None => return Ok(None),
    1463 | |     };
         | |______^ help: consider writing: `let Some(string) = get_lit_str(cx, attr_name, meta)? else { return Ok(None) };`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
         = note: `-W clippy::manual-let-else` implied by `-W clippy::pedantic`
         = help: to override `-W clippy::pedantic` add `#[allow(clippy::manual_let_else)]`

    warning: this could be rewritten as `let...else`
        --> serde_derive/src/internals/attr.rs:1482:5
         |
    1482 | /     let string = match get_lit_str(cx, attr_name, meta)? {
    1483 | |         Some(string) => string,
    1484 | |         None => return Ok(None),
    1485 | |     };
         | |______^ help: consider writing: `let Some(string) = get_lit_str(cx, attr_name, meta)? else { return Ok(None) };`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else

    warning: this could be rewritten as `let...else`
        --> serde_derive/src/internals/attr.rs:1505:5
         |
    1505 | /     let string = match get_lit_str2(cx, attr_name, meta_item_name, meta)? {
    1506 | |         Some(string) => string,
    1507 | |         None => return Ok(Vec::new()),
    1508 | |     };
         | |______^ help: consider writing: `let Some(string) = get_lit_str2(cx, attr_name, meta_item_name, meta)? else { return Ok(Vec::new()) };`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else

    warning: this could be rewritten as `let...else`
        --> serde_derive/src/internals/attr.rs:1526:5
         |
    1526 | /     let string = match get_lit_str(cx, attr_name, meta)? {
    1527 | |         Some(string) => string,
    1528 | |         None => return Ok(None),
    1529 | |     };
         | |______^ help: consider writing: `let Some(string) = get_lit_str(cx, attr_name, meta)? else { return Ok(None) };`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else

    warning: this could be rewritten as `let...else`
        --> serde_derive/src/internals/attr.rs:1549:5
         |
    1549 | /     let string = match get_lit_str(cx, BORROW, meta)? {
    1550 | |         Some(string) => string,
    1551 | |         None => return Ok(BTreeSet::new()),
    1552 | |     };
         | |______^ help: consider writing: `let Some(string) = get_lit_str(cx, BORROW, meta)? else { return Ok(BTreeSet::new()) };`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else

    warning: this could be rewritten as `let...else`
        --> serde_derive/src/internals/attr.rs:1621:5
         |
    1621 | /     let seg = match path.segments.last() {
    1622 | |         Some(seg) => seg,
    1623 | |         None => {
    1624 | |             return false;
    1625 | |         }
    1626 | |     };
         | |______^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
    help: consider writing
         |
    1621 ~     let Some(seg) = path.segments.last() else {
    1622 +             return false;
    1623 +         };
         |

    warning: this could be rewritten as `let...else`
        --> serde_derive/src/internals/attr.rs:1648:5
         |
    1648 | /     let seg = match path.segments.last() {
    1649 | |         Some(seg) => seg,
    1650 | |         None => {
    1651 | |             return false;
    1652 | |         }
    1653 | |     };
         | |______^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
    help: consider writing
         |
    1648 ~     let Some(seg) = path.segments.last() else {
    1649 +             return false;
    1650 +         };
         |

    warning: this could be rewritten as `let...else`
      --> serde_derive/src/internals/ctxt.rs:49:9
       |
    49 | /         let mut combined = match errors.next() {
    50 | |             Some(first) => first,
    51 | |             None => return Ok(()),
    52 | |         };
       | |__________^ help: consider writing: `let Some(mut combined) = errors.next() else { return Ok(()) };`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else

    warning: this could be rewritten as `let...else`
      --> serde_derive/src/de.rs:29:5
       |
    29 | /     let cont = match Container::from_ast(&ctxt, input, Derive::Deserialize, &private...
    30 | |         Some(cont) => cont,
    31 | |         None => return Err(ctxt.check().unwrap_err()),
    32 | |     };
       | |______^ help: consider writing: `let Some(cont) = Container::from_ast(&ctxt, input, Derive::Deserialize, &private.ident()) else { return Err(ctxt.check().unwrap_err()) };`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else

    warning: this could be rewritten as `let...else`
      --> serde_derive/src/ser.rs:16:5
       |
    16 | /     let cont = match Container::from_ast(&ctxt, input, Derive::Serialize, &private.i...
    17 | |         Some(cont) => cont,
    18 | |         None => return Err(ctxt.check().unwrap_err()),
    19 | |     };
       | |______^ help: consider writing: `let Some(cont) = Container::from_ast(&ctxt, input, Derive::Serialize, &private.ident()) else { return Err(ctxt.check().unwrap_err()) };`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
2025-10-19 15:02:16 -07:00
David Tolnay
d656b4dd6a
Raise required compiler for serde_derive to Rust 1.65 2025-10-19 15:02:12 -07:00
David Tolnay
b517ec9fd7
Merge pull request #3001 from nik-contrib/refactor
refactor: remove 1 level of nesting
2025-10-17 10:35:18 -07:00
Nik Revenco
086353c581 refactor: remove 1 level of nesting 2025-10-17 18:29:26 +01:00
David Tolnay
4e278703c6
Merge pull request #2936 from Mingun/remove-fixme
Remove some ? from generated code
2025-09-28 11:34:47 -07:00
Mingun
9f9a1ea35e Do not use ? operator in the generated code where possible
This may slightly improve compilation time and costs nothing
2025-09-28 23:21:26 +05:00
David Tolnay
a866b336f1
Release 1.0.228 v1.0.228 2025-09-27 09:51:07 -07:00
David Tolnay
5adc9e816c
Merge pull request #2995 from dtolnay/rustdocflags
Workaround for RUSTDOCFLAGS='--cfg=docsrs'
2025-09-27 09:50:33 -07:00
David Tolnay
ab581789f4
Workaround for RUSTDOCFLAGS='--cfg=docsrs' 2025-09-27 09:46:14 -07:00
David Tolnay
415d9fc560
Release 1.0.227 v1.0.227 2025-09-25 16:42:33 -07:00
David Tolnay
7c58427e12
Merge pull request #2991 from dtolnay/inlinecoredoc
Inline serde_core into serde in docsrs mode
2025-09-25 16:41:35 -07:00
David Tolnay
9d3410e3f4
Merge pull request #2992 from dtolnay/inplaceseed
Remove InPlaceSeed public re-export
2025-09-25 16:40:54 -07:00
David Tolnay
2fb6748bf1
Remove InPlaceSeed public re-export 2025-09-25 16:26:14 -07:00
David Tolnay
f8137c79a2
Inline serde_core into serde in docsrs mode 2025-09-25 13:22:15 -07:00
David Tolnay
b7dbf7e3cb
Merge pull request #2990 from dtolnay/integer128
No longer macro_use integer128 module
2025-09-25 11:14:43 -07:00
David Tolnay
7c836915fc
No longer macro_use integer128 module 2025-09-25 11:09:19 -07:00
David Tolnay
aa2d9b208a
Merge pull request #2989 from dtolnay/pr2987
PR 2987 followup
2025-09-25 09:45:25 -07:00
David Tolnay
3a7c11c82c
Rename enum_untagged::generate_newtype_variant -> deserialize_newtype_variant 2025-09-25 09:41:34 -07:00
David Tolnay
11ce4402bd
Rename enum_untagged::generate_variant -> deserialize_variant 2025-09-25 09:41:34 -07:00
David Tolnay
8047570160
Rename generate_body_in_place -> deserialize_in_place 2025-09-25 09:41:34 -07:00
David Tolnay
b395215875
Rename all other generate_body -> deserialize 2025-09-25 09:41:33 -07:00
David Tolnay
a437ff6bf7
Rename identifier::generate_identifier -> deserialize_generated 2025-09-25 09:41:33 -07:00
David Tolnay
20fc31c78a
Rename identifier::generate_body -> deserialize_custom 2025-09-25 09:41:33 -07:00
David Tolnay
ad2b064b0a
Adjust variable names 2025-09-25 09:41:33 -07:00
David Tolnay
dec153b8fa
Adjust comments 2025-09-25 09:41:33 -07:00